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
=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
--- qml/ApplicationMenus/MenuPopup.qml 2017-02-07 15:45:42 +0000
+++ qml/ApplicationMenus/MenuPopup.qml 2017-02-07 15:45:43 +0000
@@ -110,6 +110,8 @@
110 } else {110 } else {
111 hoveredItem = null;111 hoveredItem = null;
112 }112 }
113
114 submenuHoverTimer.stop();
113 }115 }
114116
115 onSelect: {117 onSelect: {
@@ -210,6 +212,12 @@
210 contentHeight: menuColumn.height212 contentHeight: menuColumn.height
211 interactive: height < contentHeight213 interactive: height < contentHeight
212214
215 Timer {
216 id: submenuHoverTimer
217 interval: 225 // GTK MENU_POPUP_DELAY, Qt SH_Menu_SubMenuPopupDelay in QCommonStyle is 256
218 onTriggered: d.currentItem.item.trigger();
219 }
220
213 MouseArea {221 MouseArea {
214 anchors.fill: parent222 anchors.fill: parent
215 hoverEnabled: true223 hoverEnabled: true
@@ -223,12 +231,17 @@
223231
224 if (!d.hoveredItem || !d.currentItem ||232 if (!d.hoveredItem || !d.currentItem ||
225 !d.hoveredItem.contains(Qt.point(pos.x - d.currentItem.x, pos.y - d.currentItem.y))) {233 !d.hoveredItem.contains(Qt.point(pos.x - d.currentItem.x, pos.y - d.currentItem.y))) {
234 submenuHoverTimer.stop();
235
226 d.hoveredItem = menuColumn.childAt(pos.x, pos.y)236 d.hoveredItem = menuColumn.childAt(pos.x, pos.y)
227 if (!d.hoveredItem || !d.hoveredItem.enabled)237 if (!d.hoveredItem || !d.hoveredItem.enabled)
228 return false;238 return;
229 d.currentItem = d.hoveredItem;239 d.currentItem = d.hoveredItem;
240
241 if (!d.currentItem.__isSeparator && d.currentItem.item.hasSubmenu && d.currentItem.item.enabled) {
242 submenuHoverTimer.start();
243 }
230 }244 }
231 return true;
232 }245 }
233 }246 }
234247
@@ -283,6 +296,8 @@
283 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)296 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
284297
285 action.onTriggered: {298 action.onTriggered: {
299 submenuHoverTimer.stop();
300
286 d.currentItem = loader;301 d.currentItem = loader;
287302
288 if (hasSubmenu) {303 if (hasSubmenu) {
289304
=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuPopup.qml'
--- tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-01-18 12:08:14 +0000
+++ tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-02-07 15:45:43 +0000
@@ -223,6 +223,20 @@
223 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);223 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);
224 }224 }
225225
226 function test_mouseHoverOpensSubMenu() {
227 menu.unityMenuModel.modelData = appMenuData.generateTestData(3,3,1,0,"menu",false);
228
229 var menuItem = findChild(menu, "menu-item0");
230
231 var priv = findInvisibleChild(menu, "d");
232 priv.currentItem = menuItem;
233
234 mouseMove(menuItem, menuItem.width/2, menuItem.height/2);
235 verify(!menuItem.popup);
236
237 tryCompareFunction(function() { return menuItem.popup != null; }, true);
238 }
239
226 function test_differentSizes() {240 function test_differentSizes() {
227 var differentSizesMenu = [{241 var differentSizesMenu = [{
228 "rowData": { "label": "Short" }}, {242 "rowData": { "label": "Short" }}, {

Subscribers

People subscribed via source and target branches