Fix context menus on Qt 5.9

This commit is contained in:
Cameron Gutman
2019-01-02 19:49:06 -08:00
parent dfefdc93c5
commit e2774309fb
2 changed files with 14 additions and 2 deletions
+6
View File
@@ -134,8 +134,14 @@ GridView {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onClicked: { onClicked: {
// popup() ensures the menu appears under the mouse cursor // popup() ensures the menu appears under the mouse cursor
if (appContextMenu.popup) {
appContextMenu.popup() appContextMenu.popup()
} }
else {
// Qt 5.9 doesn't have popup()
appContextMenu.open()
}
}
} }
Keys.onMenuPressed: { Keys.onMenuPressed: {
+6
View File
@@ -192,8 +192,14 @@ GridView {
onClicked: { onClicked: {
if (!model.addPc) { if (!model.addPc) {
// popup() ensures the menu appears under the mouse cursor // popup() ensures the menu appears under the mouse cursor
if (pcContextMenu.popup) {
pcContextMenu.popup() pcContextMenu.popup()
} }
else {
// Qt 5.9 doesn't have popup()
pcContextMenu.open()
}
}
} }
} }