on xenial help sign in
Don't specify a distanceThreshold as it conflicts with hintDisplacment

TODO: Improve DragHandle API so that such conflics won't be possible. Likely by removing DirectionalDragArea's gesture recognition parameters from it. Also use real timers in TouchRegistry when running "make tryFoo" tests (uqmlscene), so you can manually test the fix for bug lp1381108 (simplified TestUtil::ensureTouchRegistryInstalled while at it) Fixes: 1381108

commitf7a361af608f45c94e6a2fbd8a2f48d1d3e9ef8d authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 30 Oct 2014, 21:42 (12 years ago) parent036c9641c64e21
4 files changed+17−30
qml/Panel/IndicatorsMenu.qml+2−2 tests/uqmlscene/main.cpp+5−5 tests/utils/modules/Unity/Test/testutil.cpp+10−22 tests/utils/modules/Unity/Test/testutil.h−1
qml/Panel/IndicatorsMenu.qml+2−2
@@ -167,7 +167,8 @@ Showable {
167167 enabled: !root.shown && root.available
168168 autoCompleteDragThreshold: maxTotalDragDistance / 2
169169 stretch: true
170− distanceThreshold: minimizedPanelHeight
170+ distanceThreshold: enableHint ? 0 : minimizedPanelHeight
171+
171172 onTapped: showTapped(Qt.point(touchSceneX, touchSceneY));
172173
173174 // using hint regulates minimum to hint displacement, but in fullscreen mode, we need to do it manually.
@@ -185,7 +186,6 @@ Showable {
185186 autoCompleteDragThreshold: maxTotalDragDistance / 6
186187 stretch: true
187188 maxTotalDragDistance: openedHeight - expandedPanelHeight - handle.height
188− distanceThreshold: 0
189189
190190 onTouchSceneXChanged: {
191191 if (root.state === "locked") {
tests/uqmlscene/main.cpp+5−5
@@ -428,6 +428,10 @@ int main(int argc, char ** argv)
428428
429429 MouseTouchAdaptor mouseTouchAdaptor;
430430 app.installNativeEventFilter(&mouseTouchAdaptor);
431+ // Create it before loading the module, so that TestUtil
432+ // doesn't create one with a fake timer factory.
433+ // When interacting manually with a test we want the real deal.
434+ new TouchRegistry;
431435
432436#ifndef QT_NO_TRANSLATION
433437 QTranslator translator;
@@ -499,11 +503,7 @@ int main(int argc, char ** argv)
499503 QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel);
500504 if (contentItem) {
501505 qxView = new QQuickView(&engine, nullptr);
502− if (TouchRegistry::instance() == nullptr) {
503− new TouchRegistry(qxView);
504− } else {
505− TouchRegistry::instance()->setParent(qxView);
506− }
506+ TouchRegistry::instance()->setParent(qxView);
507507 qxView->installEventFilter(TouchRegistry::instance());
508508 window = qxView;
509509 // Set window default properties; the qml can still override them
tests/utils/modules/Unity/Test/testutil.cpp+10−22
@@ -31,7 +31,6 @@ TestUtil::TestUtil(QObject *parent)
3131 : QObject(parent)
3232 , m_targetWindow(0)
3333 , m_touchDevice(0)
34− , m_installedTouchRegistry(false)
3534{
3635}
3736
@@ -83,30 +82,19 @@ void TestUtil::ensureTouchDevice()
8382
8483void TestUtil::ensureTouchRegistryInstalled()
8584{
86− if (m_installedTouchRegistry)
85+ if (TouchRegistry::instance())
8786 return;
8887
89− TouchRegistry *touchRegistry;
90− if (TouchRegistry::instance() == nullptr) {
91− // Tests can be *very* slow to run and we don't want things timing out because
92− // of that. So give it fake timers to use (they will never time out)
93− touchRegistry = new TouchRegistry(this, new FakeTimerFactory);
94− } else {
95− touchRegistry = TouchRegistry::instance();
96− if (touchRegistry->parent() != this) {
97− // someone else created it. leave it alone
98− m_installedTouchRegistry = true;
99− }
100− }
88+ if (!m_targetWindow)
89+ return;
10190
102− ensureTargetWindow();
91+ // Tests can be *very* slow to run and we don't want things timing out because
92+ // of that. So give it fake timers to use (they will never time out)
93+ TouchRegistry *touchRegistry = new TouchRegistry(this, new FakeTimerFactory);
10394
104− if (m_targetWindow) {
105− QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
106− if (view) {
107− view->installEventFilter(touchRegistry);
108− touchRegistry->setParent(view);
109− m_installedTouchRegistry = true;
110− }
95+ QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
96+ if (view) {
97+ view->installEventFilter(touchRegistry);
98+ touchRegistry->setParent(view);
11199 }
112100}
tests/utils/modules/Unity/Test/testutil.h−1
@@ -42,7 +42,6 @@ private:
4242
4343 QWindow *m_targetWindow;
4444 QTouchDevice *m_touchDevice;
45− bool m_installedTouchRegistry;
4645};
4746
4847QML_DECLARE_TYPE(TestUtil)