aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-08 01:01:22 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-08 01:01:22 +0100
commit5ad4faf773b9b21680f703d345bbbe08cb029772 (patch)
treed16c5065bcb48aa992278cd10431a5d6467b7a24
parent80f9634f7e3a1c31cda0c804d811c532aeee103b (diff)
parent014e7a91f20eb01bac3ec99cea5c76053ae4b59e (diff)
Merge remote-tracking branch 'origin/5.13' into dev
-rw-r--r--src/imports/testlib/main.cpp1
-rw-r--r--src/qml/configure.json2
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml2
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.mjs (renamed from src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js)4
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/script.mjs (renamed from src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js)2
-rw-r--r--src/qml/doc/src/javascript/imports.qdoc65
-rw-r--r--src/qml/qml/qqmlengine.cpp4
-rw-r--r--src/qmltest/quicktestresult_p.h4
-rw-r--r--src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml2
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugprocess.cpp2
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp24
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp8
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp2
-rw-r--r--tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp117
15 files changed, 146 insertions, 95 deletions
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index af15a44012..c625c87db7 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -149,6 +149,7 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtTest"));
qmlRegisterType<QuickTestResult, 0>(uri,1,0,"TestResult");
qmlRegisterType<QuickTestResult, 1>(uri,1,1,"TestResult");
+ qmlRegisterType<QuickTestResult, 13>(uri,1,13,"TestResult");
qmlRegisterType<QuickTestEvent>(uri,1,0,"TestEvent");
qmlRegisterType<QuickTestEvent>(uri,1,2,"TestEvent");
qmlRegisterType<QuickTestUtil>(uri,1,0,"TestUtil");
diff --git a/src/qml/configure.json b/src/qml/configure.json
index 55bc1a7c4d..c35f5be06b 100644
--- a/src/qml/configure.json
+++ b/src/qml/configure.json
@@ -44,7 +44,7 @@
"label": "QML tracing JIT support",
"purpose": "Provides a JIT that uses trace information generated by the interpreter.",
"section": "QML",
- "output": [ "publicFeature" ],
+ "output": [ "privateFeature" ],
"autoDetect": false
},
"qml-debug": {
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml b/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
index 5339fcddce..e2104f8740 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
@@ -49,7 +49,7 @@
****************************************************************************/
//![0]
import QtQuick 2.0
-import "script.js" as MyScript
+import "script.mjs" as MyScript
Item {
width: 100; height: 100
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js b/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.mjs
index f2e31265e3..d0a09b68ad 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.mjs
@@ -48,8 +48,8 @@
**
****************************************************************************/
//![0]
-// factorial.js
-function factorial(a) {
+// factorial.mjs
+export function factorial(a) {
a = parseInt(a);
if (a <= 0)
return 1;
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js b/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.mjs
index c44b39abda..ef7688693d 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.mjs
@@ -49,7 +49,7 @@
****************************************************************************/
//![0]
// script.js
-Qt.include("factorial.js")
+import { factorial } from "factorial.mjs"
function showCalculations(value) {
console.log(
diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc
index 7da2cd22fe..974f2e154f 100644
--- a/src/qml/doc/src/javascript/imports.qdoc
+++ b/src/qml/doc/src/javascript/imports.qdoc
@@ -99,9 +99,44 @@ A JavaScript resource may import another in the following fashion:
\endcode
For example:
\code
-.import "factorial.js" as MathFunctions
+import * as MathFunctions from "factorial.mjs";
\endcode
+The latter is standard ECMAScript syntax for importing ECMAScript modules, and
+only works from within ECMAScript modules as denoted by the \c mjs file
+extension. The former is an extension to JavaScript provided by the \c QML
+engine and will work also with non-modules.
+
+When a JavaScript file is imported this way, it is imported with a qualifier.
+The functions in that file are then accessible from the importing script via the
+qualifier (that is, as \tt{Qualifier.functionName(params)}).
+
+Sometimes it is desirable to have the functions made available in the importing
+context without needing to qualify them. In this case ECMAScript modules and the
+JavaScript \c import statement should be used without the \c as qualifier.
+
+For example, the QML code below left calls \c showCalculations() in \c script.mjs,
+which in turn can call \c factorial() in \c factorial.mjs, as it has included
+\c factorial.mjs using \c import.
+
+\table
+\row
+\li {1,2} \snippet qml/integrating-javascript/includejs/app.qml 0
+\li \snippet qml/integrating-javascript/includejs/script.mjs 0
+\row
+\li \snippet qml/integrating-javascript/includejs/factorial.mjs 0
+\endtable
+
+The \l{QtQml::Qt::include()} {Qt.include()} function includes one JavaScript
+file from another without using ECMAScript modules and without qualifying the
+import. It makes all functions and variables from the other file available in
+the current file's namespace, but ignores all pragmas and imports defined in
+that file. This is not a good idea as a function call should never modify the
+caller's context.
+
+\l{QtQml::Qt::include()} {Qt.include()} is deprecated and should be avoided. It
+will be removed in a future version of Qt.
+
\section2 Importing a QML Module from a JavaScript Resource
A JavaScript resource may import a QML module in the following fashion:
@@ -119,32 +154,4 @@ via a singleton type; see qmlRegisterSingletonType() for more information.
\note The .import syntax doesn't work for scripts used in the \l {WorkerScript}
-\section1 Including a JavaScript Resource from Another JavaScript Resource
-
-When a JavaScript file is imported, it must be imported with a qualifier. The
-functions in that file are then accessible from the importing script via the
-qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is
-desirable to have the functions made available in the importing context without
-needing to qualify them, and in this circumstance the \l{QtQml::Qt::include()}
-{Qt.include()} function may be used to include one JavaScript file from another.
-This copies all functions from the other file into the current file's
-namespace, but ignores all pragmas and imports defined in that file.
-
-For example, the QML code below left calls \c showCalculations() in \c script.js,
-which in turn can call \c factorial() in \c factorial.js, as it has included
-\c factorial.js using \l {QtQml::Qt::include()}{Qt.include()}.
-
-\table
-\row
-\li {1,2} \snippet qml/integrating-javascript/includejs/app.qml 0
-\li \snippet qml/integrating-javascript/includejs/script.js 0
-\row
-\li \snippet qml/integrating-javascript/includejs/factorial.js 0
-\endtable
-
-Notice that calling \l {QtQml::Qt::include()}{Qt.include()} copies all functions
-from \c factorial.js into the \c MyScript namespace, which means the QML
-component can also access \c factorial() directly as \c MyScript.factorial().
-
-
*/
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 5841a480fc..0a26ed89cc 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -661,6 +661,10 @@ The following functions are also on the Qt object.
/*!
\qmlmethod object Qt::include(string url, jsobject callback)
+\deprecated
+
+This method should not be used. Use ECMAScript modules instead and the native
+JavaScript \c import and \c export statements instead.
Includes another JavaScript file. This method can only be used from within JavaScript files,
and not regular QML files.
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index 0659919a39..3643826e5d 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -160,8 +160,8 @@ public Q_SLOTS:
Q_REVISION(1) QObject *findChild(QObject *parent, const QString &objectName);
- bool isPolishScheduled(QQuickItem *item) const;
- bool waitForItemPolished(QQuickItem *item, int timeout);
+ Q_REVISION(13) bool isPolishScheduled(QQuickItem *item) const;
+ Q_REVISION(13) bool waitForItemPolished(QQuickItem *item, int timeout);
public:
// Helper functions for the C++ main() shell.
diff --git a/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml b/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml
index c33f2b2782..dcdd28da80 100644
--- a/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml
+++ b/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml
@@ -61,7 +61,7 @@ Item {
Text {
color: handler.active ? "darkgreen" : "black"
- text: handler.centroid.centroid.x.toFixed(1) + "," + handler.centroid.position.y.toFixed(1)
+ text: handler.centroid.position.x.toFixed(1) + "," + handler.centroid.position.y.toFixed(1)
x: handler.centroid.position.x - width / 2
y: handler.centroid.position.y - height
}
diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
index 6f74edf863..956e97e7ba 100644
--- a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp
@@ -46,7 +46,7 @@ QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
this, &QQmlDebugProcess::processAppOutput);
connect(&m_process, &QProcess::errorOccurred,
this, &QQmlDebugProcess::processError);
- connect(&m_process, QOverload<int>::of(&QProcess::finished),
+ connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, [this]() {
m_timer.stop();
m_eventLoop.quit();
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 76328bb405..fb9c7b0152 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -3154,7 +3154,7 @@ void tst_QJSEngine::dateRoundtripJSQtJS()
#ifdef Q_OS_WIN
QSKIP("This test fails on Windows due to a bug in QDateTime.");
#endif
- uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ qint64 secs = QDateTime(QDate(2009, 1, 1)).toUTC().toSecsSinceEpoch();
QJSEngine eng;
for (int i = 0; i < 8000; ++i) {
QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0));
@@ -3187,7 +3187,7 @@ void tst_QJSEngine::dateConversionJSQt()
#ifdef Q_OS_WIN
QSKIP("This test fails on Windows due to a bug in QDateTime.");
#endif
- uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ qint64 secs = QDateTime(QDate(2009, 1, 1)).toUTC().toSecsSinceEpoch();
QJSEngine eng;
for (int i = 0; i < 8000; ++i) {
QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0));
@@ -3678,7 +3678,7 @@ void tst_QJSEngine::translateScript()
QJSEngine engine;
TranslationScope tranScope(":/translations/translatable_la");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QCOMPARE(engine.evaluate(expression, fileName).toString(), expectedTranslation);
}
@@ -3687,7 +3687,7 @@ void tst_QJSEngine::translateScript_crossScript()
{
QJSEngine engine;
TranslationScope tranScope(":/translations/translatable_la");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QString fileName = QString::fromLatin1("translatable.js");
QString fileName2 = QString::fromLatin1("translatable2.js");
@@ -3709,7 +3709,7 @@ void tst_QJSEngine::translateScript_trNoOp()
{
QJSEngine engine;
TranslationScope tranScope(":/translations/translatable_la");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QVERIFY(engine.evaluate("QT_TR_NOOP()").isUndefined());
QCOMPARE(engine.evaluate("QT_TR_NOOP('One')").toString(), QString::fromLatin1("One"));
@@ -3723,7 +3723,7 @@ void tst_QJSEngine::translateScript_callQsTrFromCpp()
{
QJSEngine engine;
TranslationScope tranScope(":/translations/translatable_la");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
// There is no context, but it shouldn't crash
QCOMPARE(engine.globalObject().property("qsTr").call(QJSValueList() << "One").toString(), QString::fromLatin1("One"));
@@ -3756,7 +3756,7 @@ void tst_QJSEngine::translateWithInvalidArgs()
QFETCH(QString, expression);
QFETCH(QString, expectedError);
QJSEngine engine;
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QJSValue result = engine.evaluate(expression);
QVERIFY(result.isError());
QCOMPARE(result.toString(), expectedError);
@@ -3792,7 +3792,7 @@ void tst_QJSEngine::translationContext()
TranslationScope tranScope(":/translations/translatable_la");
QJSEngine engine;
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QFETCH(QString, path);
QFETCH(QString, text);
@@ -3807,7 +3807,7 @@ void tst_QJSEngine::translateScriptIdBased()
QJSEngine engine;
TranslationScope tranScope(":/translations/idtranslatable_la");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QString fileName = QString::fromLatin1("idtranslatable.js");
@@ -3889,7 +3889,7 @@ void tst_QJSEngine::translateScriptUnicode()
QJSEngine engine;
TranslationScope tranScope(":/translations/translatable-unicode");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QCOMPARE(engine.evaluate(expression, fileName).toString(), expectedTranslation);
}
@@ -3919,7 +3919,7 @@ void tst_QJSEngine::translateScriptUnicodeIdBased()
QJSEngine engine;
TranslationScope tranScope(":/translations/idtranslatable-unicode");
- engine.installTranslatorFunctions();
+ engine.installExtensions(QJSEngine::TranslationExtension);
QCOMPARE(engine.evaluate(expression).toString(), expectedTranslation);
}
@@ -3927,7 +3927,7 @@ void tst_QJSEngine::translateScriptUnicodeIdBased()
void tst_QJSEngine::translateFromBuiltinCallback()
{
QJSEngine eng;
- eng.installTranslatorFunctions();
+ eng.installExtensions(QJSEngine::TranslationExtension);
// Callback has no translation context.
eng.evaluate("function foo() { qsTr('foo'); }");
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 8d89df31db..4547a74470 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1502,7 +1502,7 @@ public:
}
break;
case Qt::OffsetFromUTC:
- m_offset = m_datetime.utcOffset() / 60;
+ m_offset = m_datetime.offsetFromUtc() / 60;
m_timespec = QString("%1%2:%3").arg(m_offset < 0 ? '-' : '+')
.arg(abs(m_offset) / 60)
.arg(abs(m_offset) % 60);
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 63bca255c2..dd73acc815 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -517,22 +517,22 @@ void tst_qqmlecmascript::exportDate_data()
QTest::newRow("UTC late") << testFileUrl("exportDate.4.qml") << QDateTime(date, late, Qt::UTC);
{
QDateTime dt(date, early, Qt::OffsetFromUTC);
- dt.setUtcOffset(offset);
+ dt.setOffsetFromUtc(offset);
QTest::newRow("+11:30 early") << testFileUrl("exportDate.5.qml") << dt;
}
{
QDateTime dt(date, late, Qt::OffsetFromUTC);
- dt.setUtcOffset(offset);
+ dt.setOffsetFromUtc(offset);
QTest::newRow("+11:30 late") << testFileUrl("exportDate.6.qml") << dt;
}
{
QDateTime dt(date, early, Qt::OffsetFromUTC);
- dt.setUtcOffset(-offset);
+ dt.setOffsetFromUtc(-offset);
QTest::newRow("-11:30 early") << testFileUrl("exportDate.7.qml") << dt;
}
{
QDateTime dt(date, late, Qt::OffsetFromUTC);
- dt.setUtcOffset(-offset);
+ dt.setOffsetFromUtc(-offset);
QTest::newRow("-11:30 late") << testFileUrl("exportDate.8.qml") << dt;
}
}
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 0f095774e8..961506372a 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -1207,7 +1207,7 @@ void tst_qquickanimations::easingProperties()
QVERIFY(animObject != nullptr);
QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline);
- QList<QPointF> points = animObject->easing().cubicBezierSpline();
+ QVector<QPointF> points = animObject->easing().toCubicSpline();
QCOMPARE(points.count(), 3);
QCOMPARE(points.at(0), QPointF(0.5, 0.2));
QCOMPARE(points.at(1), QPointF(0.13, 0.65));
diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
index 3c7159782c..cf01cc927b 100644
--- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
+++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
@@ -188,14 +188,16 @@ void tst_QQuickDropArea::containsDrag_external()
const qreal dpr = window.devicePixelRatio();
const QPoint nativePos1 = QPoint(50, 50) * dpr;
const QPoint nativePos2 = QPoint(150, 50) * dpr;
- QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, nativePos1, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, nativePos1, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
@@ -203,13 +205,15 @@ void tst_QQuickDropArea::containsDrag_external()
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
- QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
@@ -217,13 +221,15 @@ void tst_QQuickDropArea::containsDrag_external()
evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
- QWindowSystemInterface::handleDrop(&window, &data, nativePos2, Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, nativePos2, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
}
void tst_QQuickDropArea::keys_internal()
@@ -358,80 +364,96 @@ void tst_QQuickDropArea::keys_external()
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
evaluate<void>(dropArea, "keys = \"text/x-blue\"");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-blue");
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-blue");
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
evaluate<void>(dropArea, "keys = \"text/x-red\"");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red");
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red");
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
evaluate<void>(dropArea, "keys = \"text/x-green\"");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-green");
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-green");
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
evaluate<void>(dropArea, "keys = [\"text/x-red\", \"text/x-green\"]");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red" << "text/x-green");
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red" << "text/x-green");
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
data.removeFormat("text/x-red");
data.removeFormat("text/x-blue");
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
evaluate<void>(dropArea, "keys = []");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList());
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList());
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList());
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
data.setData("text/x-red", "red");
data.setData("text/x-blue", "blue");
QCOMPARE(dropArea->property("keys").toStringList(), QStringList());
QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList());
evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
- QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
}
void tst_QQuickDropArea::source_internal()
@@ -587,7 +609,8 @@ void tst_QQuickDropArea::position_external()
QMimeData data;
const qreal dpr = window.devicePixelRatio();
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50) * dpr, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50) * dpr, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(50));
@@ -598,7 +621,8 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50) * dpr, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50) * dpr, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(40));
@@ -609,7 +633,8 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(75));
@@ -619,7 +644,8 @@ void tst_QQuickDropArea::position_external()
QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(75));
QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(25));
- QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
}
void tst_QQuickDropArea::drop_internal()
@@ -930,7 +956,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
//Same as in the first case, dropArea2 already contains a drag, dropArea1 will get the event
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
@@ -939,7 +966,8 @@ void tst_QQuickDropArea::simultaneousDrags()
QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
@@ -947,7 +975,8 @@ void tst_QQuickDropArea::simultaneousDrags()
QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 2);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
@@ -965,7 +994,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
@@ -976,7 +1006,8 @@ void tst_QQuickDropArea::simultaneousDrags()
// external then internal.
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
@@ -1010,7 +1041,8 @@ void tst_QQuickDropArea::simultaneousDrags()
QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 2);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
@@ -1106,7 +1138,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
@@ -1116,7 +1149,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
@@ -1126,7 +1160,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
@@ -1146,7 +1181,8 @@ void tst_QQuickDropArea::simultaneousDrags()
evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
- QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
@@ -1154,7 +1190,8 @@ void tst_QQuickDropArea::simultaneousDrags()
QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
- QWindowSystemInterface::handleDrop(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
}
void tst_QQuickDropArea::dropStuff()
@@ -1179,8 +1216,10 @@ void tst_QQuickDropArea::dropStuff()
QCOMPARE(evaluate<QVariant>(dropArea, "array"), QVariant());
- QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
- QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction,
+ Qt::MouseButtons(), Qt::KeyboardModifiers());
QCOMPARE(evaluate<int>(dropArea, "array.byteLength"), 3);
QCOMPARE(evaluate<QByteArray>(dropArea, "array"), QByteArray("red"));
}