on xenial help sign in
Make the MenuBar InverseMouseArea eat hover events when there's a popup open
commit903a55cb95e0b4cf65a740802aa69022efb520e6 authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 27 Jan 2017, 10:24 (10 years ago) parent502020d
2 files changed+18
qml/ApplicationMenus/MenuBar.qml+1 tests/qmltests/Stage/tst_DesktopStage.qml+17
qml/ApplicationMenus/MenuBar.qml+1
@@ -75,6 +75,7 @@ Item {
7575 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
7676 anchors.fill: parent
7777 enabled: d.currentItem != null
78+ hoverEnabled: enabled && d.currentItem.__popup != null
7879 onPressed: d.dismissAll()
7980 }
8081
tests/qmltests/Stage/tst_DesktopStage.qml+17
@@ -955,5 +955,22 @@ Item {
955955 expectFail("", "Double clicking a menu should not change the window below");
956956 tryCompareFunction(function() { return appDelegate1.windowState != previousWindowState; }, true);
957957 }
958+
959+ function test_openMenuEatsHoverOutsideIt() {
960+ var appDelegate = startApplication("gmail-webapp");
961+
962+ var wd = findChild(appDelegate, "appWindowDecoration");
963+ var closeButton = findChild(wd, "closeWindowButton");
964+
965+ // Open menu
966+ var menuItem = findChild(appDelegate, "menuBar-item3");
967+ menuItem.show();
968+ var menu = findChild(appDelegate, "menuBar-item3-menu");
969+ tryCompare(menu, "visible", true);
970+
971+ mouseMove(closeButton, closeButton.width/2, closeButton.height/2);
972+ expectFail("", "Hovering the window controls should be ignored when the menu is open");
973+ tryCompare(closeButton, "containsMouse", true);
974+ }
958975 }
959976}