Merge lp:~aacid/unity8/autoOpenSubMenus into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2778
Merged at revision: 2812
Proposed branch: lp:~aacid/unity8/autoOpenSubMenus
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/makeSureMenuPositionOnScreen
Diff against target: 79 lines (+31/-2)
2 files modified
qml/ApplicationMenus/MenuPopup.qml (+17/-2)
tests/qmltests/ApplicationMenus/tst_MenuPopup.qml (+14/-0)
To merge this branch: bzr merge lp:~aacid/unity8/autoOpenSubMenus
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+315567@code.launchpad.net

Commit message

Auto open submenus on hover

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2774
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3020/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3927
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2303
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2303
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3955
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3800/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3800/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3800/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3800/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3800/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3800
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3800/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3020/rebuild

review: Needs Fixing (continuous-integration)
lp:~aacid/unity8/autoOpenSubMenus updated
2775. By Albert Astals Cid

remerge

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2775
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3024/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3934/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3962
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3807
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3807/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3807/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3807/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3807
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3807/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3807
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3807/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3807
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3807/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3024/rebuild

review: Needs Fixing (continuous-integration)
lp:~aacid/unity8/autoOpenSubMenus updated
2776. By Albert Astals Cid

Merge

2777. By Albert Astals Cid

Merge

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2776
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3034/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3949
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2307
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2307
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3977
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3822/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3822/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3822/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3822/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3822/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3822
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3822/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3034/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2777
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3044/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3959
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2315
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2315
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3987
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3831/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3044/rebuild

review: Needs Fixing (continuous-integration)
lp:~aacid/unity8/autoOpenSubMenus updated
2778. By Albert Astals Cid

refinements

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2778
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3053/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3969
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2319
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2319
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3997
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3842/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3842/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3842/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3842/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3842/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3842
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3842/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3053/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

looking mostly good, working fine. Wouldn't there be a way to use the timer timeout somehow from the style instead of hardcoding it here?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

> looking mostly good, working fine. Wouldn't there be a way to use the timer
> timeout somehow from the style instead of hardcoding it here?

Unfortunately we can't since that information in Qt is held in QStyle that is only available for QWidget based applications (i.e QApplication vs our QGuiApplication)

Revision history for this message
Michael Zanetti (mzanetti) wrote :

ok then. the rest looks fine to me

review: Approve
lp:~aacid/unity8/autoOpenSubMenus updated
2779. By Albert Astals Cid

Merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
2--- qml/ApplicationMenus/MenuPopup.qml 2017-02-07 15:45:42 +0000
3+++ qml/ApplicationMenus/MenuPopup.qml 2017-02-07 15:45:43 +0000
4@@ -110,6 +110,8 @@
5 } else {
6 hoveredItem = null;
7 }
8+
9+ submenuHoverTimer.stop();
10 }
11
12 onSelect: {
13@@ -210,6 +212,12 @@
14 contentHeight: menuColumn.height
15 interactive: height < contentHeight
16
17+ Timer {
18+ id: submenuHoverTimer
19+ interval: 225 // GTK MENU_POPUP_DELAY, Qt SH_Menu_SubMenuPopupDelay in QCommonStyle is 256
20+ onTriggered: d.currentItem.item.trigger();
21+ }
22+
23 MouseArea {
24 anchors.fill: parent
25 hoverEnabled: true
26@@ -223,12 +231,17 @@
27
28 if (!d.hoveredItem || !d.currentItem ||
29 !d.hoveredItem.contains(Qt.point(pos.x - d.currentItem.x, pos.y - d.currentItem.y))) {
30+ submenuHoverTimer.stop();
31+
32 d.hoveredItem = menuColumn.childAt(pos.x, pos.y)
33 if (!d.hoveredItem || !d.hoveredItem.enabled)
34- return false;
35+ return;
36 d.currentItem = d.hoveredItem;
37+
38+ if (!d.currentItem.__isSeparator && d.currentItem.item.hasSubmenu && d.currentItem.item.enabled) {
39+ submenuHoverTimer.start();
40+ }
41 }
42- return true;
43 }
44 }
45
46@@ -283,6 +296,8 @@
47 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
48
49 action.onTriggered: {
50+ submenuHoverTimer.stop();
51+
52 d.currentItem = loader;
53
54 if (hasSubmenu) {
55
56=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuPopup.qml'
57--- tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-01-18 12:08:14 +0000
58+++ tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-02-07 15:45:43 +0000
59@@ -223,6 +223,20 @@
60 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);
61 }
62
63+ function test_mouseHoverOpensSubMenu() {
64+ menu.unityMenuModel.modelData = appMenuData.generateTestData(3,3,1,0,"menu",false);
65+
66+ var menuItem = findChild(menu, "menu-item0");
67+
68+ var priv = findInvisibleChild(menu, "d");
69+ priv.currentItem = menuItem;
70+
71+ mouseMove(menuItem, menuItem.width/2, menuItem.height/2);
72+ verify(!menuItem.popup);
73+
74+ tryCompareFunction(function() { return menuItem.popup != null; }, true);
75+ }
76+
77 function test_differentSizes() {
78 var differentSizesMenu = [{
79 "rowData": { "label": "Short" }}, {

Subscribers

People subscribed via source and target branches