on xenial help sign in
Make the double click on a menu not be maximize the window below
commit1d2c4c0b02fc153b0706fe404313e228bdd754ee authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 26 Jan 2017, 11:28 (10 years ago) parent5a0e98a
3 files changed+33−8
qml/ApplicationMenus/MenuItem.qml−7 qml/ApplicationMenus/MenuPopup.qml+8−1 tests/qmltests/Stage/tst_DesktopStage.qml+25
qml/ApplicationMenus/MenuItem.qml−7
@@ -140,11 +140,4 @@ ActionItem {
140140 name: "chevron"
141141 }
142142 }
143−
144− MouseArea {
145− anchors.fill: parent
146− onClicked: {
147− root.trigger(action && action.checkable ? !action.checked : undefined);
148− }
149− }
150143}
qml/ApplicationMenus/MenuPopup.qml+8−1
@@ -217,7 +217,6 @@ UbuntuShape {
217217 MouseArea {
218218 anchors.fill: parent
219219 hoverEnabled: true
220− propagateComposedEvents: true // propogate events so we send clicks to children.
221220 z: 1 // on top so we override any other hovers
222221 onEntered: updateCurrentItemFromPosition(Qt.point(mouseX, mouseY))
223222 onPositionChanged: updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))
@@ -239,6 +238,14 @@ UbuntuShape {
239238 }
240239 }
241240 }
241+
242+ onClicked: {
243+ var pos = mapToItem(listView.contentItem, mouse.x, mouse.y);
244+ var clickedItem = menuColumn.childAt(pos.x, pos.y);
245+ if (clickedItem.enabled && !clickedItem.__isSeparator) {
246+ clickedItem.item.trigger();
247+ }
248+ }
242249 }
243250
244251 ActionContext {
tests/qmltests/Stage/tst_DesktopStage.qml+25
@@ -884,5 +884,30 @@ Item {
884884 tryCompare(menu, "x", data.expectedMenuCoordinates.x);
885885 tryCompare(menu, "y", data.expectedMenuCoordinates.y);
886886 }
887+
888+ function test_menuDoubleClickNoMaximizeWindowBehind() {
889+ var appDelegate1 = startApplication("dialer-app");
890+ var appDelegate2 = startApplication("gmail-webapp");
891+
892+ // Open menu
893+ var menuItem = findChild(appDelegate2, "menuBar-item3");
894+ menuItem.show();
895+ var menu = findChild(appDelegate2, "menuBar-item3-menu");
896+ menuItem = findChild(menu, "menuBar-item3-menu-item3-actionItem");
897+ tryCompare(menuItem, "visible", true);
898+
899+ // Place the other application window decoration under the menu
900+ var pos = menuItem.mapToItem(null, menuItem.width / 2, menuItem.height / 2);
901+ appDelegate1.windowedX = pos.x - appDelegate1.width / 2;
902+ appDelegate1.windowedY = pos.y - units.gu(1);
903+
904+ var previousWindowState = appDelegate1.windowState;
905+
906+ mouseMove(menuItem);
907+ mouseDoubleClickSequence(menuItem);
908+
909+ expectFail("", "Double clicking a menu should not change the window below");
910+ tryCompareFunction(function() { return appDelegate1.windowState != previousWindowState; }, true);
911+ }
887912 }
888913}