on xenial help sign in
Disable Dash horizontal scroll while Navigation InverseMouseArea is pressed Fixes: #1403048
fd7a329Albert Astals
qml/Dash/DashContent.qml+2−2
@@ -113,7 +113,7 @@ Item {
113 objectName: "dashContentList"
113 objectName: "dashContentList"
114
114
115 interactive: !dashContent.forceNonInteractive && dashContent.scopes.loaded && currentItem
115 interactive: !dashContent.forceNonInteractive && dashContent.scopes.loaded && currentItem
116− && !currentItem.moving && !currentItem.navigationShown && !currentItem.subPageShown
116+ && !currentItem.moving && !currentItem.navigationDisableParentInteractive && !currentItem.subPageShown
117 anchors.fill: parent
117 anchors.fill: parent
118 orientation: ListView.Horizontal
118 orientation: ListView.Horizontal
119 boundsBehavior: Flickable.DragAndOvershootBounds
119 boundsBehavior: Flickable.DragAndOvershootBounds
@@ -175,7 +175,7 @@ Item {
175 objectName: "scopeLoader" + index
175 objectName: "scopeLoader" + index
176
176
177 readonly property bool moving: item ? item.moving : false
177 readonly property bool moving: item ? item.moving : false
178− readonly property bool navigationShown: item ? item.navigationShown : false
178+ readonly property bool navigationDisableParentInteractive: item ? item.navigationDisableParentInteractive : false
179 readonly property bool subPageShown: item ? item.subPageShown : false
179 readonly property bool subPageShown: item ? item.subPageShown : false
180 readonly property var categoryView: item ? item.categoryView : null
180 readonly property var categoryView: item ? item.categoryView : null
181 readonly property var theScope: scope
181 readonly property var theScope: scope
qml/Dash/DashNavigation.qml+4
@@ -33,6 +33,10 @@ Item {
33 if (altNavigationButton.showList) return altNavigationButton.listView;
33 if (altNavigationButton.showList) return altNavigationButton.listView;
34 return null;
34 return null;
35 }
35 }
36+ readonly property bool disableParentInteractive: {
37+ return navigationButton.showList || altNavigationButton.showList ||
38+ navigationButton.inverseMousePressed || altNavigationButton.inverseMousePressed;
39+ }
36
40
37 // FIXME this is only here for highlight purposes (see Background.qml, too)
41 // FIXME this is only here for highlight purposes (see Background.qml, too)
38 readonly property var background: backgroundItem
42 readonly property var background: backgroundItem
qml/Dash/DashNavigationButton.qml+2
@@ -31,6 +31,7 @@ AbstractButton {
31 // Used by parent
31 // Used by parent
32 readonly property var currentNavigation: scope && scope[hasNavigation] ? getNavigation(scope[currentNavigationId]) : null
32 readonly property var currentNavigation: scope && scope[hasNavigation] ? getNavigation(scope[currentNavigationId]) : null
33 readonly property alias listView: navigationListView
33 readonly property alias listView: navigationListView
34+ readonly property bool inverseMousePressed: inverseMouseArea.pressed
34 property bool showList: false
35 property bool showList: false
35
36
36 // Internal
37 // Internal
@@ -210,6 +211,7 @@ AbstractButton {
210 onCurrentNavigationChanged: setNewNavigation();
211 onCurrentNavigationChanged: setNewNavigation();
211
212
212 InverseMouseArea {
213 InverseMouseArea {
214+ id: inverseMouseArea
213 anchors.fill: navigationListView
215 anchors.fill: navigationListView
214 enabled: root.showList
216 enabled: root.showList
215 onPressed: root.showList = false
217 onPressed: root.showList = false
qml/Dash/GenericScopeView.qml+1−1
@@ -25,7 +25,7 @@ import "../Components/ListItems" as ListItems
25FocusScope {
25FocusScope {
26 id: scopeView
26 id: scopeView
27
27
28− readonly property bool navigationShown: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].openList : false
28+ readonly property bool navigationDisableParentInteractive: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].disableParentInteractive : false
29 property bool forceNonInteractive: false
29 property bool forceNonInteractive: false
30 property var scope: null
30 property var scope: null
31 property UnitySortFilterProxyModel categories: categoryFilter
31 property UnitySortFilterProxyModel categories: categoryFilter
tests/qmltests/Dash/tst_DashContent.qml+21
@@ -505,6 +505,27 @@ Item {
505 compare(dashAltNavigationButton.showList, false);
505 compare(dashAltNavigationButton.showList, false);
506 }
506 }
507
507
508+ function test_navigationsSwipeToNextScope() {
509+ var dashContentList = findChild(dashContent, "dashContentList");
510+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
511+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
512+ tryCompare(dashNavigation, "visible", true);
513+ var dashNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
514+ verify(dashNavigationButton, "Can't find navigation button");
515+
516+ compare(dashNavigationButton.showList, false);
517+ waitForRendering(dashNavigationButton);
518+ mouseClick(dashNavigationButton, 0, 0);
519+ compare(dashNavigationButton.showList, true);
520+
521+ mouseFlick(dashNavigationButton, dashNavigationButton.width - units.gu(1), units.gu(1), units.gu(1), units.gu(1));
522+ compare(dashNavigationButton.showList, false);
523+
524+ var dashContentList = findChild(dashContent, "dashContentList");
525+ expectFail("", "should not change the parent list.");
526+ tryCompare(dashContentList, "currentIndex", 1);
527+ }
528+
508 function test_searchHint() {
529 function test_searchHint() {
509 var dashContentList = findChild(dashContent, "dashContentList");
530 var dashContentList = findChild(dashContent, "dashContentList");
510 verify(dashContentList !== null);
531 verify(dashContentList !== null);