Skip to content

Instantly share code, notes, and snippets.

/qml Secret
Created Aug 28, 2017

Embed
What would you like to do?
Menu {
id: menu
y: menuButton.height
x: (menuButton.openLeft === true) ? menuButton.width - menu.width : 0;
width: Math.max(menuButton.width, minimumMenuWidth)
height: contentItem.contentHeight
Instantiator {
id: menuItemMaker
model: menuButton.model
active: menuButton.model !== null;
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
delegate: MenuItem {
readonly property var cData: (modelData === undefined) ? "??" : modelData
height: font.pixelSize + 10
text: cData
onTriggered: menuButton.text = cData
}
}
onVisibleChanged: {
if (visible === false && menuButton.checked) {
menuButton.checked = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.