on xenial help sign in
merge prereq
commit4179f5ac7c08eb646be7389d5eb37094145a2e32 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 2 Sep 2015, 11:53 (11 years ago) parente0112a4f2acb4d
13 files changed+202−117
plugins/Utils/CMakeLists.txt+1 tests/uqmlscene/ActiveFocusLogger.cpp → plugins/Utils/activefocuslogger.cpp+21−8 tests/uqmlscene/ActiveFocusLogger.h → plugins/Utils/activefocuslogger.h+9−8 plugins/Utils/plugin.cpp+2 qml/Stages/ApplicationWindow.qml−3 qml/Stages/DesktopStage.qml+126−77 qml/Stages/WindowMoveResizeArea.qml+1−1 tests/mocks/Utils/CMakeLists.txt+1 tests/mocks/Utils/plugin.cpp+2 tests/qmltests/Stages/tst_DesktopStage.qml+2−3 tests/qmltests/tst_Shell.qml+37−3 tests/uqmlscene/CMakeLists.txt−1 tests/uqmlscene/main.cpp−13
plugins/Utils/CMakeLists.txt+1
@@ -9,6 +9,7 @@ include_directories(
99)
1010
1111set(QMLPLUGIN_SRC
12+ activefocuslogger.cpp
1213 constants.cpp
1314 HomeKeyWatcher.cpp
1415 inputwatcher.cpp
tests/uqmlscene/ActiveFocusLogger.cpp → plugins/Utils/activefocuslogger.cpprenamed+21−8
@@ -14,21 +14,34 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#include "ActiveFocusLogger.h"
17+#include "activefocuslogger.h"
1818
19−#include <QDebug>
20−#include <QQuickItem>
19+#include <QQuickWindow>
2120
22−void ActiveFocusLogger::setWindow(QQuickWindow *window)
21+ActiveFocusLogger::ActiveFocusLogger(QQuickItem *parent)
22+ : QQuickItem(parent)
2323{
24− m_window = window;
25− QObject::connect(window, &QQuickWindow::activeFocusItemChanged,
26− this, &ActiveFocusLogger::printActiveFocusInfo);
24+ connect(this, &QQuickItem::windowChanged,
25+ this, &ActiveFocusLogger::setupFilterOnWindow);
26+}
27+
28+void ActiveFocusLogger::setupFilterOnWindow(QQuickWindow *window)
29+{
30+ if (!m_window.isNull()) {
31+ disconnect(m_window.data(), nullptr, this, nullptr);
32+ m_window.clear();
33+ }
34+
35+ if (window) {
36+ m_window = window;
37+ QObject::connect(window, &QQuickWindow::activeFocusItemChanged,
38+ this, &ActiveFocusLogger::printActiveFocusInfo);
39+ }
2740}
2841
2942void ActiveFocusLogger::printActiveFocusInfo()
3043{
31− if (!m_window) {
44+ if (!m_window || !isEnabled()) {
3245 return;
3346 }
3447
tests/uqmlscene/ActiveFocusLogger.h → plugins/Utils/activefocuslogger.hrenamed+9−8
@@ -14,24 +14,25 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef ACTIVE_FOCUS_LOGGER_H
18−#define ACTIVE_FOCUS_LOGGER_H
17+#ifndef UNITY_ACTIVEFOCUSLOGGER_H
18+#define UNITY_ACTIVEFOCUSLOGGER_H
1919
20−#include <QObject>
21−#include <QQuickWindow>
20+#include <QQuickItem>
2221#include <QPointer>
2322
24−class ActiveFocusLogger : public QObject {
23+class ActiveFocusLogger : public QQuickItem
24+{
2525 Q_OBJECT
26−
2726public:
28− void setWindow(QQuickWindow *window);
27+ ActiveFocusLogger(QQuickItem *parent = 0);
2928
3029private Q_SLOTS:
30+ void setupFilterOnWindow(QQuickWindow *window);
3131 void printActiveFocusInfo();
3232
3333private:
3434 QPointer<QQuickWindow> m_window;
3535};
3636
37−#endif // ACTIVE_FOCUS_LOGGER_H
37+#endif // UNITY_ACTIVEFOCUSLOGGER_H
38+
plugins/Utils/plugin.cpp+2
@@ -23,6 +23,7 @@
2323#include "plugin.h"
2424
2525// local
26+#include "activefocuslogger.h"
2627#include "easingcurve.h"
2728#include "HomeKeyWatcher.h"
2829#include "inputwatcher.h"
@@ -66,6 +67,7 @@ void UtilsPlugin::registerTypes(const char *uri)
6667 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
6768 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
6869 qmlRegisterSingletonType<Constants>(uri, 0, 1, "Constants", createConstants);
70+ qmlRegisterType<ActiveFocusLogger>(uri, 0, 1, "ActiveFocusLogger");
6971}
7072
7173void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
qml/Stages/ApplicationWindow.qml−3
@@ -137,9 +137,6 @@ FocusScope {
137137 onSurfaceChanged: {
138138 if (sessionContainer.surface) {
139139 surfaceInitTimer.start();
140− if (ApplicationManager.focusedApplicationId == application.appId) {
141− root.forceActiveFocus();
142− }
143140 } else {
144141 d.surfaceInitialized = false;
145142 }
qml/Stages/DesktopStage.qml+126−77
@@ -77,7 +77,6 @@ Rectangle {
7777 var appIndex = priv.indexOf(appId);
7878 var appDelegate = appRepeater.itemAt(appIndex);
7979 appDelegate.minimized = false;
80− appDelegate.focus = true;
8180 ApplicationManager.focusApplication(appId);
8281 }
8382 }
@@ -91,12 +90,6 @@ Rectangle {
9190 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
9291 }
9392
94− onFocusedAppDelegateChanged: {
95− if (focusedAppDelegate) {
96− focusedAppDelegate.focus = true;
97− }
98− }
99−
10093 function indexOf(appId) {
10194 for (var i = 0; i < ApplicationManager.count; i++) {
10295 if (ApplicationManager.get(i).appId == appId) {
@@ -133,23 +126,28 @@ Rectangle {
133126 id: appContainer
134127 objectName: "appContainer"
135128 anchors.fill: parent
129+ focus: true
136130
137131 Keys.onPressed: {
138132 switch (event.key) {
139133 case Qt.Key_Left:
140134 case Qt.Key_Backtab:
141135 selectPrevious(event.isAutoRepeat)
136+ event.accepted = true;
142137 break;
143138 case Qt.Key_Right:
144139 case Qt.Key_Tab:
145140 selectNext(event.isAutoRepeat)
141+ event.accepted = true;
146142 break;
147143 case Qt.Key_Escape:
148144 appRepeater.highlightedIndex = -1
145+ event.accepted = true;
149146 case Qt.Key_Enter:
150147 case Qt.Key_Return:
151148 case Qt.Key_Space:
152149 root.state = ""
150+ event.accepted = true;
153151 }
154152 }
155153
@@ -180,7 +178,8 @@ Rectangle {
180178
181179 function focusSelected() {
182180 if (appRepeater.highlightedIndex != -1) {
183− appRepeater.itemAt(appRepeater.highlightedIndex).focus = true;
181+ var application = ApplicationManager.get(appRepeater.highlightedIndex);
182+ ApplicationManager.focusApplication(application.appId);
184183 }
185184 }
186185
@@ -192,6 +191,15 @@ Rectangle {
192191 property int highlightedIndex: -1
193192 property int closingIndex: -1
194193
194+ function indexOf(delegateItem) {
195+ for (var i = 0; i < appRepeater.count; i++) {
196+ if (appRepeater.itemAt(i) === delegateItem) {
197+ return i;
198+ }
199+ }
200+ return -1;
201+ }
202+
195203 delegate: FocusScope {
196204 id: appDelegate
197205 z: ApplicationManager.count - index
@@ -199,23 +207,19 @@ Rectangle {
199207 width: units.gu(60)
200208 height: units.gu(50)
201209
210+ property int windowWidth: 0
211+ property int windowHeight: 0
212+ // We don't want to resize the actual application when we're transforming things for the spread only
213+ onWidthChanged: if (appDelegate.state !== "altTab") windowWidth = width
214+ onHeightChanged: if (appDelegate.state !== "altTab") windowHeight = height
215+
202216 readonly property int minWidth: units.gu(10)
203217 readonly property int minHeight: units.gu(10)
204218
205219 property bool maximized: false
206220 property bool minimized: false
207221
208− onFocusChanged: {
209− if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
210− ApplicationManager.requestFocusApplication(model.appId);
211− decoratedWindow.forceActiveFocus();
212− }
213− }
214− Component.onCompleted: {
215− if (ApplicationManager.focusedApplicationId == model.appId) {
216− decoratedWindow.forceActiveFocus();
217− }
218− }
222+ focus: priv.focusedAppId === model.appId && root.state !== "altTab"
219223
220224 Binding {
221225 target: ApplicationManager.get(index)
@@ -266,7 +270,9 @@ Rectangle {
266270 PropertyChanges {
267271 target: appDelegate
268272 x: spreadMaths.animatedX
269− y: spreadMaths.animatedY + (appDelegate.height - decoratedWindow.height)
273+ y: spreadMaths.animatedY + (appDelegate.height - decoratedWindow.height) - units.gu(2)
274+ width: spreadMaths.spreadHeight
275+ height: spreadMaths.sceneHeight
270276 angle: spreadMaths.animatedAngle
271277 itemScale: spreadMaths.scale
272278 itemScaleOriginY: decoratedWindow.height / 2;
@@ -281,6 +287,7 @@ Rectangle {
281287 width: spreadMaths.spreadHeight
282288 height: spreadMaths.spreadHeight
283289 shadowOpacity: spreadMaths.shadowOpacity
290+ anchors.topMargin: units.gu(2)
284291 }
285292 PropertyChanges {
286293 target: tileInfo
@@ -302,6 +309,18 @@ Rectangle {
302309 from: "maximized,minimized,normal,"
303310 to: "maximized,minimized,normal,"
304311 PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
312+ },
313+ Transition {
314+ from: ""
315+ to: "altTab"
316+ PropertyAction { target: appDelegate; properties: "y,angle,z,itemScale,itemScaleOriginY" }
317+ PropertyAction { target: decoratedWindow; properties: "anchors.topMargin" }
318+ PropertyAnimation {
319+ target: appDelegate; properties: "x"
320+ from: root.width
321+ duration: rightEdgePushArea.containsMouse ? UbuntuAnimation.FastDuration :0
322+ easing: UbuntuAnimation.StandardEasing
323+ }
305324 }
306325 ]
307326 property real angle: 0
@@ -326,7 +345,7 @@ Rectangle {
326345 resizeHandleWidth: units.gu(2)
327346 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
328347
329− onPressed: appDelegate.focus = true;
348+ onPressed: ApplicationManager.focusApplication(model.appId);
330349 }
331350
332351 DecoratedWindow {
@@ -334,11 +353,11 @@ Rectangle {
334353 objectName: "decoratedWindow"
335354 anchors.left: appDelegate.left
336355 anchors.top: appDelegate.top
337− windowWidth: appDelegate.width
338− windowHeight: appDelegate.height
356+ windowWidth: appDelegate.windowWidth
357+ windowHeight: appDelegate.windowHeight
339358 application: ApplicationManager.get(index)
340359 active: ApplicationManager.focusedApplicationId === model.appId
341− focus: false
360+ focus: true
342361
343362 onClose: ApplicationManager.stopApplication(model.appId)
344363 onMaximize: appDelegate.maximize()
@@ -363,31 +382,6 @@ Rectangle {
363382 anchors.fill: parent
364383 anchors.margins: -units.gu(2)
365384 enabled: false
366− hoverEnabled: enabled
367−
368− // There is a bug in MouseArea where containsMouse doesn't
369− // return to false if the MouseArea is disabled while
370− // containing the mouse. Let's manage the property our own.
371− property bool upperThirdContainsMouse: false
372− onContainsMouseChanged: evaluateContainsMouse()
373− onMouseYChanged: evaluateContainsMouse()
374− function evaluateContainsMouse() {
375− if (containsMouse) {
376− appRepeater.highlightedIndex = index
377− }
378−
379− if (containsMouse && mouseY < height / 3) {
380− spreadSelectArea.upperThirdContainsMouse = true
381− } else {
382− spreadSelectArea.upperThirdContainsMouse = false;
383− }
384− }
385− onEnabledChanged: {
386− if (!enabled) {
387− spreadSelectArea.upperThirdContainsMouse = false
388− }
389− }
390−
391385 onClicked: {
392386 root.state = ""
393387 }
@@ -396,24 +390,28 @@ Rectangle {
396390
397391 Image {
398392 id: closeImage
399− anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
393+ anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset + units.gu(2) }
400394 source: "graphics/window-close.svg"
401− visible: spreadSelectArea.upperThirdContainsMouse
395+ readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
396+ visible: index == appRepeater.highlightedIndex
397+ && mousePos.y < (decoratedWindow.height / 3)
398+ && mousePos.y > -units.gu(4)
399+ && mousePos.x > -units.gu(4)
400+ && mousePos.x < (decoratedWindow.width * 2 / 3)
402401 height: units.gu(1.5)
403402 width: height
404403 sourceSize.width: width
405404 sourceSize.height: height
406− }
407405
408− MouseArea {
409− id: closeMouseArea
410− objectName: "closeMouseArea"
411− anchors.fill: closeImage
412− anchors.margins: -units.gu(2)
413− enabled: spreadSelectArea.upperThirdContainsMouse
414− onClicked: {
415− appRepeater.closingIndex = index;
416− ApplicationManager.stopApplication(model.appId)
406+ MouseArea {
407+ id: closeMouseArea
408+ objectName: "closeMouseArea"
409+ anchors.fill: closeImage
410+ anchors.margins: -units.gu(2)
411+ onClicked: {
412+ appRepeater.closingIndex = index;
413+ ApplicationManager.stopApplication(model.appId)
414+ }
417415 }
418416 }
419417
@@ -462,9 +460,58 @@ Rectangle {
462460 }
463461 }
464462
463+ MouseArea {
464+ id: hoverMouseArea
465+ anchors.fill: appContainer
466+ propagateComposedEvents: true
467+ hoverEnabled: true
468+ enabled: false
469+
470+ property int scrollAreaWidth: root.width / 3
471+ property bool progressiveScrollingEnabled: false
472+
473+ onMouseXChanged: {
474+ mouse.accepted = false
475+
476+ // Find the hovered item and mark it active
477+ var mapped = mapToItem(appContainer, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
478+ var itemUnder = appContainer.childAt(mapped.x, mapped.y)
479+ if (itemUnder) {
480+ mapped = mapToItem(itemUnder, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
481+ var delegateChild = itemUnder.childAt(mapped.x, mapped.y)
482+ if (delegateChild.objectName === "decoratedWindow" || delegateChild.objectName === "tileInfo") {
483+ appRepeater.highlightedIndex = appRepeater.indexOf(itemUnder)
484+ }
485+ }
486+
487+ if (spreadFlickable.contentWidth > spreadFlickable.minContentWidth) {
488+ var margins = spreadFlickable.width * 0.05;
489+
490+ if (!progressiveScrollingEnabled && mouseX < spreadFlickable.width - scrollAreaWidth) {
491+ progressiveScrollingEnabled = true
492+ }
493+
494+ // do we need to scroll?
495+ if (mouseX < scrollAreaWidth) {
496+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
497+ var contentX = (1 - progress) * (spreadFlickable.contentWidth - spreadFlickable.width)
498+ spreadFlickable.contentX = Math.max(0, Math.min(spreadFlickable.contentX, contentX))
499+ }
500+ if (mouseX > spreadFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
501+ var progress = Math.min(1, (mouseX - (spreadFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
502+ var contentX = progress * (spreadFlickable.contentWidth - spreadFlickable.width)
503+ spreadFlickable.contentX = Math.min(spreadFlickable.contentWidth - spreadFlickable.width, Math.max(spreadFlickable.contentX, contentX))
504+ }
505+ }
506+ }
507+ onPressed: mouse.accepted = false
508+ }
509+
465510 FloatingFlickable {
466511 id: spreadFlickable
512+ objectName: "spreadFlickable"
467513 anchors.fill: parent
514+ property int minContentWidth: 6 * Math.min(height / 4, width / 5)
468515 contentWidth: Math.max(6, ApplicationManager.count) * Math.min(height / 4, width / 5)
469516 enabled: false
470517
@@ -579,10 +626,10 @@ Rectangle {
579626 State {
580627 name: "altTab"; when: root.altTabPressed
581628 PropertyChanges { target: workspaceSelector; visible: true }
582− PropertyChanges { target: spreadFlickable; enabled: true }
629+ PropertyChanges { target: spreadFlickable; enabled: spreadFlickable.contentWidth > spreadFlickable.minContentWidth }
583630 PropertyChanges { target: currentSelectedLabel; visible: true }
584631 PropertyChanges { target: spreadBackground; visible: true }
585− PropertyChanges { target: appContainer; focus: true }
632+ PropertyChanges { target: hoverMouseArea; enabled: true }
586633 }
587634 ]
588635 signal updateWorkspaces();
@@ -592,6 +639,7 @@ Rectangle {
592639 from: "*"
593640 to: "altTab"
594641 SequentialAnimation {
642+ PropertyAction { target: hoverMouseArea; property: "progressiveScrollingEnabled"; value: false }
595643 PropertyAction { target: appRepeater; property: "highlightedIndex"; value: Math.min(ApplicationManager.count - 1, 1) }
596644 PauseAnimation { duration: 50 }
597645 PropertyAction { target: workspaceSelector; property: "visible" }
@@ -616,19 +664,20 @@ Rectangle {
616664 ]
617665
618666 MouseArea {
619− anchors {
620− top: parent.top
621− right: parent.right
622− bottom: parent.bottom
623− }
624− // TODO: Make this a push to edge thing like the launcher when we can,
625− // for now, yes, we want 1 pixel, regardless of the scaling
626− width: 1
627− hoverEnabled: true
628− onContainsMouseChanged: {
629− if (containsMouse) {
630− root.state = "altTab"
631− }
632− }
667+ id: rightEdgePushArea
668+ anchors {
669+ top: parent.top
670+ right: parent.right
671+ bottom: parent.bottom
672+ }
673+ // TODO: Make this a push to edge thing like the launcher when we can,
674+ // for now, yes, we want 1 pixel, regardless of the scaling
675+ width: 1
676+ hoverEnabled: true
677+ onContainsMouseChanged: {
678+ if (containsMouse) {
679+ root.state = "altTab";
680+ }
681+ }
633682 }
634683}
qml/Stages/WindowMoveResizeArea.qml+1−1
@@ -104,6 +104,6 @@ MouseArea {
104104 }
105105
106106 Component.onDestruction: {
107− windowStateStorage.saveGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height))
107+ windowStateStorage.saveGeometry(root.windowId, Qt.rect(target.x, target.y, target.windowWidth, target.windowHeight))
108108 }
109109}
tests/mocks/Utils/CMakeLists.txt+1
@@ -10,6 +10,7 @@ include_directories(
1010)
1111
1212set(QMLPLUGIN_SRC
13+ ${CMAKE_SOURCE_DIR}/plugins/Utils/activefocuslogger.cpp
1314 ${CMAKE_SOURCE_DIR}/plugins/Utils/qlimitproxymodelqml.cpp
1415 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
1516 ${CMAKE_SOURCE_DIR}/plugins/Utils/relativetimeformatter.cpp
tests/mocks/Utils/plugin.cpp+2
@@ -35,6 +35,7 @@
3535#include "constants.h"
3636
3737// plugin
38+#include <activefocuslogger.h>
3839#include <inputwatcher.h>
3940#include <qlimitproxymodelqml.h>
4041#include <unitysortfilterproxymodelqml.h>
@@ -74,6 +75,7 @@ void FakeUtilsPlugin::registerTypes(const char *uri)
7475 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
7576 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
7677 qmlRegisterSingletonType<Constants>(uri, 0, 1, "Constants", createConstants);
78+ qmlRegisterType<ActiveFocusLogger>(uri, 0, 1, "ActiveFocusLogger");
7779}
7880
7981void FakeUtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
tests/qmltests/Stages/tst_DesktopStage.qml+2−3
@@ -61,7 +61,6 @@ Item {
6161 Component.onDestruction: {
6262 desktopStageLoader.itemDestroyed = true;
6363 }
64− focus: true
6564 }
6665 }
6766 }
@@ -142,8 +141,8 @@ Item {
142141
143142 function test_appFocusSwitch_data() {
144143 return [
145− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
146− {tag: "dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
144+ {tag: "dash to dialer", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 0, focusTo: 1 },
145+ {tag: "dialer to dash", apps: [ "unity8-dash", "dialer-app", "camera-app" ], focusfrom: 1, focusTo: 0 },
147146 ]
148147 }
149148
tests/qmltests/tst_Shell.qml+37−3
@@ -1566,8 +1566,6 @@ Rectangle {
15661566 keyPress(Qt.Key_Control)
15671567 keyClick(Qt.Key_Tab);
15681568
1569− appRemovedSpy.clear();
1570−
15711569 var focusAppId = ApplicationManager.get(2).appId;
15721570 var appDelegate2 = appRepeater.itemAt(2);
15731571 var decoratedWindow = findChild(appDelegate2, "decoratedWindow");
@@ -1577,7 +1575,7 @@ Rectangle {
15771575
15781576 // Move the mouse over tile 2 and verify the highlight becomes visible
15791577 var x = 0;
1580− var y = shell.height * (data.tileInfo ? .5 : 0.95)
1578+ var y = shell.height * (data.tileInfo ? .95 : 0.5)
15811579 mouseMove(shell, x, y)
15821580 while (appRepeater.highlightedIndex !== 2 && x <= 4000) {
15831581 x+=10;
@@ -1595,5 +1593,41 @@ Rectangle {
15951593
15961594 keyRelease(Qt.Key_Control);
15971595 }
1596+
1597+ function test_progressiveAutoScrolling() {
1598+ loadDesktopShellWithApps()
1599+
1600+ var appRepeater = findInvisibleChild(shell, "appRepeater");
1601+ verify(appRepeater !== null);
1602+
1603+ keyPress(Qt.Key_Control)
1604+ keyClick(Qt.Key_Tab);
1605+
1606+ var spreadFlickable = findChild(shell, "spreadFlickable")
1607+ print("have flickable", spreadFlickable, spreadFlickable.contentX)
1608+
1609+ compare(spreadFlickable.contentX, 0);
1610+
1611+ // Move the mouse to the right and make sure it scrolls the Flickable
1612+ var x = 0;
1613+ var y = shell.height * .5
1614+ mouseMove(shell, x, y)
1615+ while (x <= spreadFlickable.width) {
1616+ x+=10;
1617+ mouseMove(shell, x, y)
1618+ wait(0); // spin the loop so bindings get evaluated
1619+ }
1620+ tryCompare(spreadFlickable, "contentX", spreadFlickable.contentWidth - spreadFlickable.width);
1621+
1622+ // And turn around
1623+ while (x > 0) {
1624+ x-=10;
1625+ mouseMove(shell, x, y)
1626+ wait(0); // spin the loop so bindings get evaluated
1627+ }
1628+ tryCompare(spreadFlickable, "contentX", 0);
1629+
1630+ keyRelease(Qt.Key_Control);
1631+ }
15981632 }
15991633}
tests/uqmlscene/CMakeLists.txt−1
@@ -1,6 +1,5 @@
11add_executable(uqmlscene
22 ${shellapplication_MOC_SRCS}
3− ActiveFocusLogger.cpp
43 main.cpp
54 )
65
tests/uqmlscene/main.cpp−13
@@ -63,12 +63,6 @@
6363#include <QtCore/QTranslator>
6464#include <QtCore/QLibraryInfo>
6565
66−#define UQMLSCENE_DEBUG_ACTIVE_FOCUS 0
67−
68−#if UQMLSCENE_DEBUG_ACTIVE_FOCUS
69− #include "ActiveFocusLogger.h"
70−#endif
71−
7266#ifdef QML_RUNTIME_TESTING
7367class RenderStatistics
7468{
@@ -393,10 +387,6 @@ int main(int argc, char ** argv)
393387{
394388 Options options;
395389
396− #if UQMLSCENE_DEBUG_ACTIVE_FOCUS
397− ActiveFocusLogger activeFocusLogger;
398− #endif
399−
400390 QStringList imports;
401391 QList<QPair<QString, QString> > bundles;
402392 for (int i = 1; i < argc; ++i) {
@@ -515,9 +505,6 @@ int main(int argc, char ** argv)
515505 QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel);
516506 if (contentItem) {
517507 qxView = new QQuickView(&engine, nullptr);
518− #if UQMLSCENE_DEBUG_ACTIVE_FOCUS
519− activeFocusLogger.setWindow(qxView);
520− #endif
521508 window = qxView;
522509 // Set window default properties; the qml can still override them
523510 QString oname = contentItem->objectName();