diff options
author | Liang Qi <liang.qi@qt.io> | 2018-05-15 15:32:04 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-05-15 15:32:04 +0200 |
commit | 6e5251dd3d7b21b67693a79d3470ec2ba80ba97e (patch) | |
tree | 9df6575fa02be4f47bc9a97dafad6ac71f02419f | |
parent | b159b766eb7974419c2f16a01a8d15221c352dbf (diff) | |
parent | 9ef0d2da99f4593d50c16912d00bef121bb76f9b (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/qml/qml/qqmltypeloader.cpp
Change-Id: If9874faf23e813b05ee4cf042133a528d73ba72a
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 14 | ||||
-rw-r--r-- | src/qml/compiler/qqmlirbuilder_p.h | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 5 | ||||
-rw-r--r-- | src/qmltest/quicktest.cpp | 8 | ||||
-rw-r--r-- | src/quick/handlers/qquickmultipointhandler.cpp | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickpinchhandler.cpp | 7 | ||||
-rw-r--r-- | src/quick/items/qquickevents.cpp | 11 | ||||
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 8 | ||||
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktextcontrol.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/jsimport.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/library.js | 4 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/qmlcachegen.pro | 2 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/script.js | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp | 11 | ||||
-rw-r--r-- | tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 41 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 2 |
18 files changed, 132 insertions, 24 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index c4b5859b58..6b75f8b8b7 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -323,16 +323,16 @@ Document::Document(bool debugMode) { } -ScriptDirectivesCollector::ScriptDirectivesCollector(QQmlJS::Engine *engine, QV4::Compiler::JSUnitGenerator *unitGenerator) - : engine(engine) - , jsGenerator(unitGenerator) - , hasPragmaLibrary(false) +ScriptDirectivesCollector::ScriptDirectivesCollector(Document *doc) + : document(doc) + , engine(&doc->jsParserEngine) + , jsGenerator(&doc->jsGenerator) { } void ScriptDirectivesCollector::pragmaLibrary() { - hasPragmaLibrary = true; + document->jsModule.unitFlags |= QV4::CompiledData::Unit::IsSharedLibrary; } void ScriptDirectivesCollector::importFile(const QString &jsfile, const QString &module, int lineNumber, int column) @@ -343,7 +343,7 @@ void ScriptDirectivesCollector::importFile(const QString &jsfile, const QString import->qualifierIndex = jsGenerator->registerString(module); import->location.line = lineNumber; import->location.column = column; - imports << import; + document->imports << import; } void ScriptDirectivesCollector::importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column) @@ -359,7 +359,7 @@ void ScriptDirectivesCollector::importModule(const QString &uri, const QString & import->qualifierIndex = jsGenerator->registerString(module); import->location.line = lineNumber; import->location.column = column; - imports << import; + document->imports << import; } IRBuilder::IRBuilder(const QSet<QString> &illegalNames) diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index fa93130252..f8d481e14f 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -455,14 +455,14 @@ struct Q_QML_PRIVATE_EXPORT Document static void removeScriptPragmas(QString &script); }; -struct Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives +class Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives { - ScriptDirectivesCollector(QQmlJS::Engine *engine, QV4::Compiler::JSUnitGenerator *unitGenerator); - + QmlIR::Document *document; QQmlJS::Engine *engine; QV4::Compiler::JSUnitGenerator *jsGenerator; - QList<const QV4::CompiledData::Import *> imports; - bool hasPragmaLibrary; + +public: + ScriptDirectivesCollector(QmlIR::Document *doc); void pragmaLibrary() override; void importFile(const QString &jsfile, const QString &module, int lineNumber, int column) override; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 2ebbbf8c4a..8c3c487e96 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2991,7 +2991,7 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) return; } - QmlIR::ScriptDirectivesCollector collector(&irUnit.jsParserEngine, &irUnit.jsGenerator); + QmlIR::ScriptDirectivesCollector collector(&irUnit); irUnit.jsParserEngine.setDirectives(&collector); QList<QQmlError> errors; @@ -3008,9 +3008,6 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) unit.adopt(new QV4::CompiledData::CompilationUnit); } irUnit.javaScriptCompilationUnit = unit; - irUnit.imports = collector.imports; - if (collector.hasPragmaLibrary) - irUnit.jsModule.unitFlags |= QV4::CompiledData::Unit::IsSharedLibrary; QmlIR::QmlUnitGenerator qmlGenerator; QV4::CompiledData::Unit *unitData = qmlGenerator.generate(irUnit); diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 75c06edb25..8d3f5ffb23 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -207,7 +207,11 @@ public: TestCaseCollector(const QFileInfo &fileInfo, QQmlEngine *engine) { - QQmlComponent component(engine, fileInfo.absoluteFilePath()); + QString path = fileInfo.absoluteFilePath(); + if (path.startsWith(QLatin1String(":/"))) + path.prepend(QLatin1String("qrc")); + + QQmlComponent component(engine, path); m_errors += component.errors(); if (component.isReady()) { @@ -534,7 +538,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch QTestRootObject::instance()->init(); QString path = fi.absoluteFilePath(); if (path.startsWith(QLatin1String(":/"))) - view.setSource(QUrl(QLatin1String("qrc:") + path.midRef(2))); + view.setSource(QUrl(QLatin1String("qrc:") + path.midRef(1))); else view.setSource(QUrl::fromLocalFile(path)); diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index b126b93211..d595b4c9b4 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -76,8 +76,10 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event) if (!QQuickPointerDeviceHandler::wantsPointerEvent(event)) return false; +#if QT_CONFIG(gestures) if (event->asPointerNativeGestureEvent()) return true; +#endif if (sameAsCurrentPoints(event)) return true; diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index 155822197f..fc69accffc 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -248,6 +248,7 @@ bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event) if (!QQuickMultiPointHandler::wantsPointerEvent(event)) return false; +#if QT_CONFIG(gestures) if (const auto gesture = event->asPointerNativeGestureEvent()) { if (minimumPointCount() == 2) { switch (gesture->type()) { @@ -263,6 +264,7 @@ bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event) return false; } } +#endif return true; } @@ -319,6 +321,7 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event) } qreal dist = 0; +#if QT_CONFIG(gestures) if (const auto gesture = event->asPointerNativeGestureEvent()) { switch (gesture->type()) { case Qt::EndNativeGesture: @@ -349,7 +352,9 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event) m_centroidVelocity = QVector2D(); m_activeTranslation = QVector2D(); } - } else { + } else +#endif // QT_CONFIG(gestures) + { bool containsReleasedPoints = event->isReleaseEvent(); if (!active()) { // Verify that at least one of the points has moved beyond threshold needed to activate the handler diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 3343ea3fa7..d964f2bb32 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -1388,6 +1388,7 @@ void QQuickPointerTouchEvent::localize(QQuickItem *target) point->localizePosition(target); } +#if QT_CONFIG(gestures) QQuickPointerEvent *QQuickPointerNativeGestureEvent::reset(QEvent *event) { auto ev = static_cast<QNativeGestureEvent*>(event); @@ -1417,6 +1418,7 @@ void QQuickPointerNativeGestureEvent::localize(QQuickItem *target) { m_gesturePoint->localizePosition(target); } +#endif // QT_CONFIG(gestures) QQuickEventPoint *QQuickPointerMouseEvent::point(int i) const { if (i == 0) @@ -1430,11 +1432,13 @@ QQuickEventPoint *QQuickPointerTouchEvent::point(int i) const { return nullptr; } +#if QT_CONFIG(gestures) QQuickEventPoint *QQuickPointerNativeGestureEvent::point(int i) const { if (i == 0) return m_gesturePoint; return nullptr; } +#endif // QT_CONFIG(gestures) QQuickEventPoint::QQuickEventPoint(QQuickPointerEvent *parent) : QObject(parent), m_pointId(0), m_exclusiveGrabber(nullptr), m_timestamp(0), m_pressTimestamp(0), @@ -1662,6 +1666,7 @@ QMouseEvent *QQuickPointerTouchEvent::syntheticMouseEvent(int pointID, QQuickIte return &m_synthMouseEvent; } +#if QT_CONFIG(gestures) /*! Returns the exclusive grabber of this event, if any, in a vector. */ @@ -1719,6 +1724,7 @@ qreal QQuickPointerNativeGestureEvent::value() const { return static_cast<QNativeGestureEvent *>(m_event)->value(); } +#endif // QT_CONFIG(gestures) /*! \internal @@ -1742,12 +1748,13 @@ QQuickEventPoint *QQuickPointerTouchEvent::pointById(int pointId) const { return nullptr; } +#if QT_CONFIG(gestures) QQuickEventPoint *QQuickPointerNativeGestureEvent::pointById(int pointId) const { if (m_gesturePoint && pointId == m_gesturePoint->pointId()) return m_gesturePoint; return nullptr; } - +#endif /*! \internal @@ -1866,6 +1873,7 @@ QTouchEvent *QQuickPointerTouchEvent::asTouchEvent() const return static_cast<QTouchEvent *>(m_event); } +#if QT_CONFIG(gestures) bool QQuickPointerNativeGestureEvent::allPointsAccepted() const { return m_gesturePoint->isAccepted(); } @@ -1878,6 +1886,7 @@ bool QQuickPointerNativeGestureEvent::allPointsGrabbed() const { return m_gesturePoint->exclusiveGrabber() != nullptr; } +#endif // QT_CONFIG(gestures) #ifndef QT_NO_DEBUG_STREAM diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 00ee0e18f9..bb6726706d 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -66,7 +66,9 @@ QT_BEGIN_NAMESPACE class QQuickPointerDevice; class QQuickPointerEvent; class QQuickPointerMouseEvent; +#if QT_CONFIG(gestures) class QQuickPointerNativeGestureEvent; +#endif class QQuickPointerTabletEvent; class QQuickPointerTouchEvent; class QQuickPointerHandler; @@ -414,11 +416,15 @@ public: // helpers for C++ only (during event delivery) virtual QQuickPointerMouseEvent *asPointerMouseEvent() { return nullptr; } virtual QQuickPointerTouchEvent *asPointerTouchEvent() { return nullptr; } virtual QQuickPointerTabletEvent *asPointerTabletEvent() { return nullptr; } +#if QT_CONFIG(gestures) virtual QQuickPointerNativeGestureEvent *asPointerNativeGestureEvent() { return nullptr; } +#endif virtual const QQuickPointerMouseEvent *asPointerMouseEvent() const { return nullptr; } virtual const QQuickPointerTouchEvent *asPointerTouchEvent() const { return nullptr; } virtual const QQuickPointerTabletEvent *asPointerTabletEvent() const { return nullptr; } +#if QT_CONFIG(gestures) virtual const QQuickPointerNativeGestureEvent *asPointerNativeGestureEvent() const { return nullptr; } +#endif virtual bool allPointsAccepted() const = 0; virtual bool allUpdatedPointsAccepted() const = 0; virtual bool allPointsGrabbed() const = 0; @@ -519,6 +525,7 @@ private: Q_DISABLE_COPY(QQuickPointerTouchEvent) }; +#if QT_CONFIG(gestures) class Q_QUICK_PRIVATE_EXPORT QQuickPointerNativeGestureEvent : public QQuickPointerEvent { Q_OBJECT @@ -553,6 +560,7 @@ private: Q_DISABLE_COPY(QQuickPointerNativeGestureEvent) }; +#endif // QT_CONFIG(gestures) // ### Qt 6: move this to qtbase, replace QTouchDevice and the enums in QTabletEvent diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 052da9fe82..c9316c0406 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -910,7 +910,7 @@ void QQuickMouseArea::ungrabMouse() if (d->pressed) { // if our mouse grab has been removed (probably by Flickable), fix our // state - d->pressed = nullptr; + d->pressed = Qt::NoButton; d->stealMouse = false; d->doubleClick = false; d->overThreshold = false; diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index e3080dfe48..1cb12235c1 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -1304,8 +1304,12 @@ void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) cursor.removeSelectedText(); } + QTextBlock block; + // insert commit string if (!e->commitString().isEmpty() || e->replacementLength()) { + if (e->commitString().endsWith(QChar::LineFeed)) + block = cursor.block(); // Remember the block where the preedit text is QTextCursor c = cursor; c.setPosition(c.position() + e->replacementStart()); c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor); @@ -1324,7 +1328,9 @@ void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } } - QTextBlock block = cursor.block(); + if (!block.isValid()) + block = cursor.block(); + QTextLayout *layout = block.layout(); if (isGettingInput) { layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index b0b747a5eb..9b95dce3a8 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2234,8 +2234,10 @@ QQuickPointerEvent *QQuickWindowPrivate::queryPointerEventInstance(QQuickPointer for (QQuickPointerEvent *e : pointerEventInstances) { // If device can generate native gestures (e.g. a trackpad), there might be two QQuickPointerEvents: // QQuickPointerNativeGestureEvent and QQuickPointerTouchEvent. Use eventType to disambiguate. +#if QT_CONFIG(gestures) if (eventType == QEvent::NativeGesture && !qobject_cast<QQuickPointerNativeGestureEvent*>(e)) continue; +#endif // Otherwise we assume there's only one event type per device. // More disambiguation tests might need to be added above if that changes later. if (e->device() == device) @@ -2259,9 +2261,11 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevic break; case QQuickPointerDevice::TouchPad: case QQuickPointerDevice::TouchScreen: +#if QT_CONFIG(gestures) if (eventType == QEvent::NativeGesture) ev = new QQuickPointerNativeGestureEvent(q, device); else // assume QEvent::Type is one of TouchBegin/Update/End +#endif ev = new QQuickPointerTouchEvent(q, device); break; default: @@ -2296,9 +2300,11 @@ QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) con dev = QQuickPointerDevice::touchDevice(static_cast<QTouchEvent *>(event)->device()); break; // TODO tablet event types +#if QT_CONFIG(gestures) case QEvent::NativeGesture: dev = QQuickPointerDevice::touchDevice(static_cast<QNativeGestureEvent *>(event)->device()); break; +#endif default: break; } @@ -2320,8 +2326,9 @@ void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event) deliverMouseEvent(event->asPointerMouseEvent()); // failsafe: never allow any kind of grab to persist after release if (event->isReleaseEvent() && event->buttons() == Qt::NoButton) { + QQuickItem *oldGrabber = q->mouseGrabberItem(); event->clearGrabbers(); - sendUngrabEvent(q->mouseGrabberItem(), false); + sendUngrabEvent(oldGrabber, false); } } else if (event->asPointerTouchEvent()) { deliverTouchEvent(event->asPointerTouchEvent()); diff --git a/tests/auto/qml/qmlcachegen/jsimport.qml b/tests/auto/qml/qmlcachegen/jsimport.qml new file mode 100644 index 0000000000..9c40878e60 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/jsimport.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import "script.js" as Script + +QtObject { + property int value: Script.getter() +} diff --git a/tests/auto/qml/qmlcachegen/library.js b/tests/auto/qml/qmlcachegen/library.js new file mode 100644 index 0000000000..51fb41dc23 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/library.js @@ -0,0 +1,4 @@ + +function getter() { + return 42; +} diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro index a2f963e8c3..f62b950844 100644 --- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro +++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro @@ -12,4 +12,6 @@ RESOURCES += versionchecks.qml RESOURCES += trickypaths.qrc +RESOURCES += jsimport.qml script.js library.js + QT += core-private qml-private testlib diff --git a/tests/auto/qml/qmlcachegen/script.js b/tests/auto/qml/qmlcachegen/script.js new file mode 100644 index 0000000000..fa55f9069e --- /dev/null +++ b/tests/auto/qml/qmlcachegen/script.js @@ -0,0 +1,6 @@ + +.import "library.js" as Library + +function getter() { + return Library.getter() +} diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp index 5c1692f086..c95a5a5d25 100644 --- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp +++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp @@ -54,6 +54,8 @@ private slots: void workerScripts(); void trickyPaths(); + + void scriptImport(); }; // A wrapper around QQmlComponent to ensure the temporary reference counts @@ -416,6 +418,15 @@ void tst_qmlcachegen::trickyPaths() QCOMPARE(obj->property("success").toInt(), 42); } +void tst_qmlcachegen::scriptImport() +{ + QQmlEngine engine; + CleanlyLoadingComponent component(&engine, QUrl("qrc:///jsimport.qml")); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QTRY_COMPARE(obj->property("value").toInt(), 42); +} + QTEST_GUILESS_MAIN(tst_qmlcachegen) #include "tst_qmlcachegen.moc" diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index cd3486f95f..042908bf0c 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -179,6 +179,7 @@ public: bool acceptTouchEvents; bool acceptMouseEvents; + bool grabOnRelease = false; TouchEventData lastEvent; int mousePressCount; int mouseMoveCount; @@ -248,6 +249,10 @@ public: case QEvent::MouseButtonPress: mousePressCount = ++mousePressNum; break; + case QEvent::MouseButtonRelease: + if (grabOnRelease) + grabMouse(); + break; case QEvent::MouseMove: mouseMoveCount = ++mouseMoveNum; break; @@ -468,6 +473,7 @@ private slots: void testChildMouseEventFilter(); void testChildMouseEventFilter_data(); + void cleanupGrabsOnRelease(); private: QTouchDevice *touchDevice; @@ -3514,6 +3520,41 @@ void tst_qquickwindow::testChildMouseEventFilter() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, mousePos); } +void tst_qquickwindow::cleanupGrabsOnRelease() +{ + TestTouchItem::clearMouseEventCounters(); + + QQuickWindow *window = new QQuickWindow; + QScopedPointer<QQuickWindow> cleanup(window); + window->resize(250, 250); + window->setPosition(100, 100); + window->setTitle(QTest::currentTestFunction()); + window->show(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + TestTouchItem *parent = new TestTouchItem(window->contentItem()); + parent->setObjectName("parent"); + parent->setSize(QSizeF(150, 150)); + parent->acceptMouseEvents = true; + parent->grabOnRelease = true; + + TestTouchItem *child = new TestTouchItem(parent); + child->setObjectName("child"); + child->setSize(QSizeF(100, 100)); + child->acceptMouseEvents = true; + + QPoint pos(80, 80); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos); + // There is an explicit parent->grabMouse on release(!). This means grab changes from child + // to parent: + // This will emit two ungrab events: + // 1. One for the child (due to the explicit call to parent->grabMouse()) + // 2. One for the parent (since the mouse button was finally released) + QCOMPARE(child->mouseUngrabEventCount, 1); + QCOMPARE(parent->mouseUngrabEventCount, 1); +} QTEST_MAIN(tst_qquickwindow) diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index ed8b3c19a5..c308f12814 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -262,7 +262,7 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile } QQmlJS::Engine *engine = &irDocument.jsParserEngine; - QmlIR::ScriptDirectivesCollector directivesCollector(engine, &irDocument.jsGenerator); + QmlIR::ScriptDirectivesCollector directivesCollector(&irDocument); QQmlJS::Directives *oldDirs = engine->directives(); engine->setDirectives(&directivesCollector); |