I have a QML Menu component that I would like to place at the top of each and everyone of my views and sort of sync up so it goes the look and feel of the typical webpage menu. How do I go about doing this please
import QtQuick 1.0
Row {
width: 500
height: 50
anchors.centerIn: parent
spacing: parent.width/6
Button {
id: loadButton
text: qsTr("Menu")
}
Button {
id: saveButton
text: qsTr("Profile")
}
Button {
id: exitButton
text: qsTr("View Products")
}
}
Read about "z" property QDeclarativeItem or QML Item. The answer is to give your menu component instance the highest z value.
MyMenu
{
z: 100
...
}
Rectangle
{
z: 1
...
}
The qml renderer decides upon this values which items to draw first; and in case of something overlaying your menu it will end below it. By the way, the default z value is 0, so all are same and it is more or less undefined in which order it is rendered.
Good Luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With