From 064f0d3d23097cb181166c3e966287490773f23c Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Fri, 9 Nov 2018 12:25:01 +0100 Subject: Fix leaking textures and animation resources by software backend QQuickStyleItem1::updatePaintNode assumes every instance of QSGNinePathNode (QSGSoftwareNinePatchNode for software backend) to own new texture object on setTexture. Instance of QQuickAnimationController is also assumed to be deleted by render loop on window destroy. Fixes: QTBUG-69290 Change-Id: Ibd22229108c986c1c115600280482cea01bf4160 Reviewed-by: Andy Nichols --- .../scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp | 7 ++++--- .../scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index 1463681fa3..68341ebb3e 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -144,10 +144,11 @@ void QSGSoftwareNinePatchNode::setTexture(QSGTexture *texture) QSGSoftwarePixmapTexture *pt = qobject_cast(texture); if (!pt) { qWarning() << "Image used with invalid texture format."; - return; + } else { + m_pixmap = pt->pixmap(); + markDirty(DirtyMaterial); } - m_pixmap = pt->pixmap(); - markDirty(DirtyMaterial); + delete texture; } void QSGSoftwareNinePatchNode::setBounds(const QRectF &bounds) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp index b400473128..f5a41410ee 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,8 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window) if (m_windows.size() == 0) { rc->invalidate(); } + + delete d->animationController; } void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose) -- cgit v1.2.3 From e746e55f2451a800744ccfcbc9f83fdc3a16337c Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Tue, 13 Nov 2018 13:38:15 +0100 Subject: Fix leaking resources by OpenVG scene graph backend Change-Id: I4e67c639d8343e39673ef5ea08bda7af033fb19f Reviewed-by: Andy Nichols --- src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp | 17 ++++++++++++----- src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h | 1 + src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp index e45b79706b..b5f6b39c60 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp @@ -174,7 +174,7 @@ void QSGOpenVGRectangleNode::render() } -QSGOpenVGImageNode::QSGOpenVGImageNode() +QSGOpenVGImageNode::QSGOpenVGImageNode() : m_texture(nullptr), m_owns(false) { // Set Dummy material and geometry to avoid asserts setMaterial((QSGMaterial*)1); @@ -184,9 +184,8 @@ QSGOpenVGImageNode::QSGOpenVGImageNode() QSGOpenVGImageNode::~QSGOpenVGImageNode() { - if (m_owns) { - m_texture->deleteLater(); - } + if (m_owns) + delete m_texture; } void QSGOpenVGImageNode::setRect(const QRectF &rect) @@ -212,6 +211,8 @@ QRectF QSGOpenVGImageNode::sourceRect() const void QSGOpenVGImageNode::setTexture(QSGTexture *texture) { + if (m_owns) + delete m_texture; m_texture = texture; markDirty(DirtyMaterial); } @@ -321,7 +322,7 @@ void QSGOpenVGImageNode::render() } -QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode() +QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode() : m_texture(nullptr) { // Set Dummy material and geometry to avoid asserts setMaterial((QSGMaterial*)1); @@ -329,8 +330,14 @@ QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode() } +QSGOpenVGNinePatchNode::~QSGOpenVGNinePatchNode() +{ + delete m_texture; +} + void QSGOpenVGNinePatchNode::setTexture(QSGTexture *texture) { + delete m_texture; m_texture = texture; markDirty(DirtyMaterial); } diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h index 8e12c27824..e1cd3063a1 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h +++ b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h @@ -118,6 +118,7 @@ class QSGOpenVGNinePatchNode : public QSGNinePatchNode, public QSGOpenVGRenderab { public: QSGOpenVGNinePatchNode(); + ~QSGOpenVGNinePatchNode(); void setTexture(QSGTexture *texture) override; void setBounds(const QRectF &bounds) override; diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp index 9493920100..c41dfd7400 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -94,6 +95,8 @@ void QSGOpenVGRenderLoop::windowDestroyed(QQuickWindow *window) } else if (vg && window == vg->window()) { vg->doneCurrent(); } + + delete d->animationController; } void QSGOpenVGRenderLoop::exposureChanged(QQuickWindow *window) -- cgit v1.2.3 From ae6f850ab50bfe07625df4f810c7bf975c224877 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 7 Nov 2018 10:38:09 +0100 Subject: Generate lookups into the global object more aggressively Since change 9333ea8649838d7e0400b0e94c8cbd4fa5d216b0, we lookup properties in the QML context object before the global object to have proper scoping rules for QML. Unfortunately this lead to a performance regression when using global properties such as Math in imported script files, as the lookup would always go through the qml context first. This can be fixed, as we know that the global object is frozen in qml mode, and the standard names of properties in the global object are illegal to use in QML. So simply check for those names in the code generator and create lookups into the global object for those. Change-Id: I4b2089178c9e5f9440abdfd834cf7d92c3c0e2c3 Fixes: QTBUG-71591 Reviewed-by: Erik Verbruggen --- src/qml/compiler/qqmlirbuilder.cpp | 10 ++---- src/qml/compiler/qqmlirbuilder_p.h | 1 - src/qml/compiler/qv4codegen.cpp | 70 ++++++++++++++++++++++++++++++++++++++ src/qml/compiler/qv4codegen_p.h | 6 ++++ src/qml/jsruntime/qv4script.cpp | 1 + 5 files changed, 80 insertions(+), 8 deletions(-) diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 9021fd0284..2421e8c1ea 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1835,8 +1835,9 @@ JSCodeGen::JSCodeGen(const QString &sourceCode, QV4::Compiler::JSUnitGenerator * , _scopeObject(nullptr) , _qmlContextSlot(-1) , _importedScriptsSlot(-1) - , m_globalNames(globalNames) { + m_globalNames = globalNames; + _module = jsModule; _fileNameIsUrl = true; } @@ -2306,15 +2307,10 @@ QV4::Compiler::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &n return Reference::fromQmlContextObject(base, data->coreIndex(), data->notifyIndex(), capturePolicy); } } - - Reference r = Reference::fromName(this, name); - if (m_globalNames.contains(name)) - r.global = true; - return r; #else Q_UNUSED(name) - return Reference(); #endif // V4_BOOTSTRAP + return Reference(); } #ifndef V4_BOOTSTRAP diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index d1e2b17bb7..3dde929cc4 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -640,7 +640,6 @@ private: QQmlPropertyCache *_scopeObject; int _qmlContextSlot; int _importedScriptsSlot; - QSet m_globalNames; }; struct Q_QML_PRIVATE_EXPORT IRLoader { diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 54aef16970..21fb03c1a4 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -102,6 +102,62 @@ Codegen::Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict) jsUnitGenerator->codeGeneratorName = QStringLiteral("moth"); } +const char *globalNames[] = { + "isNaN", + "parseFloat", + "String", + "EvalError", + "URIError", + "Math", + "encodeURIComponent", + "RangeError", + "eval", + "isFinite", + "ReferenceError", + "Infinity", + "Function", + "RegExp", + "Number", + "parseInt", + "Object", + "decodeURI", + "TypeError", + "Boolean", + "encodeURI", + "NaN", + "Error", + "decodeURIComponent", + "Date", + "Array", + "Symbol", + "escape", + "unescape", + "SyntaxError", + "undefined", + "JSON", + "ArrayBuffer", + "SharedArrayBuffer", + "DataView", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "WeakSet", + "Set", + "WeakMap", + "Map", + "Reflect", + "Proxy", + "Atomics", + "Promise", + nullptr +}; + void Codegen::generateFromProgram(const QString &fileName, const QString &finalUrl, const QString &sourceCode, @@ -118,6 +174,18 @@ void Codegen::generateFromProgram(const QString &fileName, _module->fileName = fileName; _module->finalUrl = finalUrl; + if (contextType == ContextType::ScriptImportedByQML) { + // the global object is frozen, so we know that members of it are + // pointing to the global object. This is important so that references + // to Math etc. do not go through the expensive path in the context wrapper + // that tries to see whether we have a matching type + // + // Since this can be called from the loader thread we can't get the list + // directly from the engine, so let's hardcode the most important ones here + for (const char **g = globalNames; *g != nullptr; ++g) + m_globalNames << QString::fromLatin1(*g); + } + ScanFunctions scan(this, sourceCode, contextType); scan(node); @@ -2350,6 +2418,8 @@ Codegen::Reference Codegen::referenceForName(const QString &name, bool isLhs, co Reference r = Reference::fromName(this, name); r.global = useFastLookups && (resolved.type == Context::ResolvedName::Global); + if (!r.global && m_globalNames.contains(name)) + r.global = true; return r; } diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index e6e7d2e9fb..7630a1f71d 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -708,6 +708,11 @@ public: return *_returnLabel; } + void setGlobalNames(const QSet& globalNames) { + m_globalNames = globalNames; + } + + protected: friend class ScanFunctions; friend struct ControlFlow; @@ -730,6 +735,7 @@ protected: bool inFormalParameterList = false; bool functionEndsWithReturn = false; bool _tailCallsAreAllowed = true; + QSet m_globalNames; ControlFlow *controlFlow = nullptr; diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 951675b468..3d8c037910 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -241,6 +241,7 @@ Script *Script::createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlCo QmlIR::Document::removeScriptPragmas(sourceCode); auto result = new QV4::Script(engine, qmlContext, sourceCode, originalUrl.toString()); + result->contextType = QV4::Compiler::ContextType::ScriptImportedByQML; result->parse(); return result; } -- cgit v1.2.3 From 78745e5e778665f3a015e9cae109e77974d7fbe4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 12 Nov 2018 09:27:33 +0100 Subject: masm: Don't call fclose(nullptr) and initialize statics Otherwise our disassembler crashes on QV4_SHOW_ASM. Change-Id: I63b20c0932452fe852773f91ebecaa7f31dd040d Reviewed-by: Erik Verbruggen (cherry picked from commit 89a1d4ff3f829635d80a90112f6b2d44cc274b1b) Reviewed-by: Lars Knoll --- src/3rdparty/masm/stubs/WTFStubs.cpp | 2 +- src/3rdparty/masm/wtf/FilePrintStream.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/masm/stubs/WTFStubs.cpp b/src/3rdparty/masm/stubs/WTFStubs.cpp index b26d10b3ab..f408b355f5 100644 --- a/src/3rdparty/masm/stubs/WTFStubs.cpp +++ b/src/3rdparty/masm/stubs/WTFStubs.cpp @@ -66,7 +66,7 @@ uint32_t cryptographicallyRandomNumber() return 0; } -static FilePrintStream* s_dataFile; +static FilePrintStream* s_dataFile = nullptr; void setDataFile(FilePrintStream *ps) { diff --git a/src/3rdparty/masm/wtf/FilePrintStream.cpp b/src/3rdparty/masm/wtf/FilePrintStream.cpp index a56b36526e..8ddf8487bd 100644 --- a/src/3rdparty/masm/wtf/FilePrintStream.cpp +++ b/src/3rdparty/masm/wtf/FilePrintStream.cpp @@ -39,7 +39,8 @@ FilePrintStream::~FilePrintStream() { if (m_adoptionMode == Borrow) return; - fclose(m_file); + if (m_file) + fclose(m_file); } std::unique_ptr FilePrintStream::open(const char* filename, const char* mode) -- cgit v1.2.3 From ec290770ff56791a62fde6f532e1b38e80f5b9bd Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Fri, 16 Nov 2018 14:43:48 +0100 Subject: Initialize Qt_AllocaWrapper allocation with zeroes YarrJIT generated ASM assumes the data to be zeroed. In the wrapper we allocate from heap where there can be random data. It needs to be initialized to zero. Task-number: QTBUG-71663 Change-Id: I67c04e7b6d4bf4b92124aedc4f7bcfdc1a43c833 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4alloca_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h index 1e9f83a90e..65c3e4d65a 100644 --- a/src/qml/jsruntime/qv4alloca_p.h +++ b/src/qml/jsruntime/qv4alloca_p.h @@ -89,7 +89,7 @@ public: Qt_AllocaWrapper() { m_data = 0; } ~Qt_AllocaWrapper() { free(m_data); } void *data() { return m_data; } - void allocate(int size) { m_data = malloc(size); } + void allocate(int size) { m_data = malloc(size); memset(m_data, 0, size); } private: void *m_data; }; -- cgit v1.2.3 From 64ee4968b46019b8e4cb7523a6e41833fc4cf665 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 19 Nov 2018 13:52:08 +0100 Subject: QML Lexer: Stop scanning template literals on closing '`' Fixes: QTBUG-71812 Change-Id: I93b99496a7572c0f5128c69b865bb2b4f87d29af Reviewed-by: Lars Knoll Reviewed-by: Erik Verbruggen --- src/qml/parser/qqmljslexer.cpp | 2 +- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp index b98bb8bac5..71885c533d 100644 --- a/src/qml/parser/qqmljslexer.cpp +++ b/src/qml/parser/qqmljslexer.cpp @@ -866,7 +866,7 @@ int Lexer::scanString(ScanStringMode mode) if (sequenceLength == 2) _tokenText += *_codePtr; scanChar(); - } else if (_char == mode) { + } else if (_char == quote) { scanChar(); if (_engine) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 71c4e03812..254a6bc878 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -360,6 +360,7 @@ private slots: void importLexicalVariables_data(); void importLexicalVariables(); void hugeObject(); + void templateStringTerminator(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -8858,6 +8859,14 @@ void tst_qqmlecmascript::hugeObject() QVERIFY(!v.isError()); } +void tst_qqmlecmascript::templateStringTerminator() +{ + QJSEngine engine; + const QJSValue value = engine.evaluate("let a = 123; let b = `x${a}\ny^`; b;"); + QVERIFY(!value.isError()); + QCOMPARE(value.toString(), QLatin1String("x123\ny^")); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" -- cgit v1.2.3 From e3c0bb7811407bad1f65ea55639a4b1d1d39be15 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Fri, 16 Nov 2018 09:22:25 +0200 Subject: Add changes file for Qt 5.11.3 Change-Id: Ieff361efbedf364469657cc0d1b917560dab1b8c Reviewed-by: Shawn Rutledge --- dist/changes-5.11.3 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dist/changes-5.11.3 diff --git a/dist/changes-5.11.3 b/dist/changes-5.11.3 new file mode 100644 index 0000000000..8701cdeed4 --- /dev/null +++ b/dist/changes-5.11.3 @@ -0,0 +1,58 @@ +Qt 5.11.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.11.0 through 5.11.2. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.11 series is binary compatible with the 5.10.x series. +Applications compiled for 5.10 will continue to run with 5.11. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.11.3 Changes * +**************************************************************************** + +**************************************************************************** +* QtQml * +**************************************************************************** + + - [QTBUG-69973] Fixed QML comma operator property lookup failure. + - [QTBUG-70350] Fixed allocation of multi-page executable memory for + INTEGRITY. + - [QTBUG-69996] Fixed undefined behavior in MASM on 64bit architectures. + - [QTBUG-70460] Fixed deadlock in qmlplugindump. + +**************************************************************************** +* QtQuick * +**************************************************************************** + + - Accessibility: The StaticText role for Text items is now only used if + there is no explicit role set. + - Scene Graph: Fixed Leaking of resources in the OpenVG backend. + - [QTBUG-69290] Fixed leaking of textures and animation resources in + software backend. + - [QTBUG-58924] Added a warning message for the case of too many tiles in + a BorderImage. + - [QTBUG-70898] Fixed a crash on nested delivery of mouse or touch presses. + - [QTBUG-64402] Fixed a crash in QQuickAnimatorProxyJob. + - [QTBUG-69059][QTBUG-61144] Fixed confusion about mouse grabbing when + delivering pointer events to a QQuickWindow. + - [QTBUG-59620] Prevented PathView's parent from stealing mouse grabs + during double-flick. + +**************************************************************************** +* Building * +**************************************************************************** + + - [QTBUG-70414] Disabled building of XmlListModel if the "qml-network" + feature is unavailable. + - Enabled building without the "filesystemwatcher" feature. -- cgit v1.2.3 From f8f0f0835a971a658f4ee2ae386e448338b1a7d7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 4 Dec 2018 12:27:23 +0100 Subject: TapHandler: ignore scroll events and native gestures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a 2-finger press (to emulate right click on a trackpad), the OS may also generate a QWheelEvent with ScrollBegin phase just in case scrolling starts. This must not prematurely deactivate the TapHandler. Also if a gesture or wheel event begins as the very first event after an application starts, ensure that subsequent mouse events are not mis-delivered as wheel or gesture events. Fixes: QTBUG-71955 Change-Id: Ic12e116483ab9ad37c4ac3b1d10ccb62e1349e0a Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquicktaphandler.cpp | 4 +++ src/quick/items/qquickwindow.cpp | 9 ++--- .../qquicktaphandler/data/rightTapHandler.qml | 41 ++++++++++++++++++++++ .../qquicktaphandler/tst_qquicktaphandler.cpp | 39 ++++++++++++++++++++ 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index e97722d6b7..d480d3b491 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -107,6 +107,10 @@ static bool dragOverThreshold(const QQuickEventPoint *point) bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) { + if (!point->pointerEvent()->asPointerMouseEvent() && + !point->pointerEvent()->asPointerTouchEvent() && + !point->pointerEvent()->asPointerTabletEvent() ) + return false; // If the user has not violated any constraint, it could be a tap. // Otherwise we want to give up the grab so that a competing handler // (e.g. DragHandler) gets a chance to take over. diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 83a1268d1d..dd5960e925 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2246,13 +2246,14 @@ QQuickPointerEvent *QQuickWindowPrivate::queryPointerEventInstance(QQuickPointer { // Search for a matching reusable event object. 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 device can generate native gestures (e.g. a trackpad), there might be multiple QQuickPointerEvents: + // QQuickPointerNativeGestureEvent, QQuickPointerScrollEvent, and QQuickPointerTouchEvent. + // Use eventType to disambiguate. #if QT_CONFIG(gestures) - if (eventType == QEvent::NativeGesture && !qobject_cast(e)) + if ((eventType == QEvent::NativeGesture) != bool(e->asPointerNativeGestureEvent())) continue; #endif - if (eventType == QEvent::Wheel && !qobject_cast(e)) + if ((eventType == QEvent::Wheel) != bool(e->asPointerScrollEvent())) continue; // Otherwise we assume there's only one event type per device. // More disambiguation tests might need to be added above if that changes later. diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml b/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml new file mode 100644 index 0000000000..aea01c154c --- /dev/null +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 + +Rectangle { + width: 320 + height: 240 + color: rightTap.pressed ? "tomato" : "beige" + TapHandler { + id: rightTap + objectName: "right button TapHandler" + longPressThreshold: 0.5 + acceptedButtons: Qt.RightButton + } +} diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp index 467c964001..ab6fa0dbe4 100644 --- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp @@ -69,6 +69,7 @@ private slots: void mouseLongPress(); void buttonsMultiTouch(); void componentUserBehavioralOverride(); + void rightLongPressIgnoreWheel(); private: void createView(QScopedPointer &window, const char *fileName); @@ -622,6 +623,44 @@ void tst_TapHandler::componentUserBehavioralOverride() QCOMPARE(userGrabChangedSpy.count(), 2); } +void tst_TapHandler::rightLongPressIgnoreWheel() +{ + QScopedPointer windowPtr; + createView(windowPtr, "rightTapHandler.qml"); + QQuickView * window = windowPtr.data(); + + QQuickTapHandler *tap = window->rootObject()->findChild(); + QVERIFY(tap); + QSignalSpy tappedSpy(tap, SIGNAL(tapped(QQuickEventPoint *))); + QSignalSpy longPressedSpy(tap, SIGNAL(longPressed())); + QPoint p1(100, 100); + + // Mouse wheel with ScrollBegin phase (because as soon as two fingers are touching + // the trackpad, it will send such an event: QTBUG-71955) + { + QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0), + Qt::NoButton, Qt::NoModifier, Qt::ScrollBegin, false, Qt::MouseEventNotSynthesized); + QGuiApplication::sendEvent(window, &wheelEvent); + } + + // Press + QTest::mousePress(window, Qt::RightButton, Qt::NoModifier, p1); + QTRY_COMPARE(tap->isPressed(), true); + + // Mouse wheel ScrollEnd phase + QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0), + Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd, false, Qt::MouseEventNotSynthesized); + QGuiApplication::sendEvent(window, &wheelEvent); + QTRY_COMPARE(longPressedSpy.count(), 1); + QCOMPARE(tap->isPressed(), true); + QCOMPARE(tappedSpy.count(), 0); + + // Release + QTest::mouseRelease(window, Qt::RightButton, Qt::NoModifier, p1, 500); + QTRY_COMPARE(tap->isPressed(), false); + QCOMPARE(tappedSpy.count(), 0); +} + QTEST_MAIN(tst_TapHandler) #include "tst_qquicktaphandler.moc" -- cgit v1.2.3 From 0b586e5b504f66c5ba2b690eda1c89e3e5dfdca3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 6 Dec 2018 11:21:31 +0100 Subject: Doc: fix QUICK_TEST_MAIN_WITH_SETUP function table Change-Id: I2dc0ba8ba99a1447e44c558843a162a40930b7b9 Reviewed-by: Rainer Keller --- src/qmltest/doc/src/qtquicktest-index.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qmltest/doc/src/qtquicktest-index.qdoc b/src/qmltest/doc/src/qtquicktest-index.qdoc index 15ea33d06a..48b41d4f0a 100644 --- a/src/qmltest/doc/src/qtquicktest-index.qdoc +++ b/src/qmltest/doc/src/qtquicktest-index.qdoc @@ -150,18 +150,19 @@ \header \li Name \li Purpose - \row \row \li void applicationAvailable() \li Called right after the QApplication object was instantiated. Use this function to setup everything that is not related to QML directly. + \row \li void qmlEngineAvailable(QQmlEngine*) \li Called when the QML engine is available. Any \l {QQmlEngine::addImportPath}{import paths}, \l {QQmlEngine::addPluginPath}{plugin paths}, and \l {QQmlFileSelector::setExtraSelectors}{extra file selectors} will have been set on the engine by this point. + \row \li void cleanupTestCase() \li Called right after the test execution has finished. Use this function to clean up before everything will start to be destructed. -- cgit v1.2.3 From c352ca4a3dc2e6e3a4c039589849cf502911ba95 Mon Sep 17 00:00:00 2001 From: Daniel Engelke Date: Wed, 28 Nov 2018 18:02:43 +0100 Subject: Fix missing strike out Added and tag aka strike out to QQuickStyledText. QQuickStyledText covers the essential text decorations, apart from strike out. In order to use it, one had to switch to RichText, which comes with its own overhead and limitations. for no longer accurate or no longer relevant content for removed content Fixes: QTBUG-72376 Change-Id: I3c191d91d57afcc48090facc49d643f8ad708fb4 Reviewed-by: Frederik Gladhorn Reviewed-by: Shawn Rutledge --- src/quick/items/qquicktext.cpp | 2 ++ src/quick/util/qquickstyledtext.cpp | 22 +++++++++++++++++++--- .../qquickstyledtext/tst_qquickstyledtext.cpp | 8 +++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 4d4540bc36..dd7fbccff5 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -2082,6 +2082,8 @@ void QQuickText::resetMaximumLineCount() \code - bold + - strike out (removed content) + - strike out (no longer accurate or no longer relevant content) - bold - italic
- new line diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index 762d49f2d2..5e1aaf121e 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -50,6 +50,8 @@ QQuickStyledText supports few tags: - bold + - strike out (removed content) + - strike out (no longer accurate or no longer relevant content) - bold - italic
- new line @@ -379,8 +381,16 @@ bool QQuickStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, format.setFontWeight(QFont::Bold); return true; } - } else if (tag == QLatin1String("strong")) { - format.setFontWeight(QFont::Bold); + } else if (char0 == QLatin1Char('s')) { + if (tagLength == 1) { + format.setFontStrikeOut(true); + return true; + } else if (tag == QLatin1String("strong")) { + format.setFontWeight(QFont::Bold); + return true; + } + } else if (tag == QLatin1String("del")) { + format.setFontStrikeOut(true); return true; } else if (tag == QLatin1String("ol")) { List listItem; @@ -511,7 +521,13 @@ bool QQuickStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &tex return true; } else if (tag == QLatin1String("font")) { return true; - } else if (tag == QLatin1String("strong")) { + } else if (char0 == QLatin1Char('s')) { + if (tagLength == 1) { + return true; + } else if (tag == QLatin1String("strong")) { + return true; + } + } else if (tag == QLatin1String("del")) { return true; } else if (tag == QLatin1String("ol")) { if (!listStack.isEmpty()) { diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 6ca5ad2653..88b0e95e0a 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -44,7 +44,8 @@ public: Bold = 0x01, Underline = 0x02, Italic = 0x04, - Anchor = 0x08 + Anchor = 0x08, + StrikeOut = 0x10 }; Format(int t, int s, int l) : type(t), start(s), length(l) {} @@ -92,6 +93,10 @@ void tst_qquickstyledtext::textOutput_data() QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; QTest::newRow("strong") << "strong" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)) << false; QTest::newRow("underline") << "underline" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; + QTest::newRow("strike out s") << "strike out" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false; + QTest::newRow("strike out del") << "strike out" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false; + QTest::newRow("strike out not s") << "this is not a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false; + QTest::newRow("strike out not del") << "this is not a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false; QTest::newRow("missing >") << "text") << "text") << "text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; @@ -178,6 +183,7 @@ void tst_qquickstyledtext::textOutput() QCOMPARE(layoutFormats.at(i).format.fontWeight(), int(QFont::Normal)); QVERIFY(layoutFormats.at(i).format.fontItalic() == bool(formats.at(i).type & Format::Italic)); QVERIFY(layoutFormats.at(i).format.fontUnderline() == bool(formats.at(i).type & Format::Underline)); + QVERIFY(layoutFormats.at(i).format.fontStrikeOut() == bool(formats.at(i).type & Format::StrikeOut)); } QCOMPARE(fontSizeModified, modifiesFontSize); } -- cgit v1.2.3 From e3446c8225acbaa6a613d6c62e8e2fc58e2b70b0 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Tue, 6 Nov 2018 13:55:57 +0200 Subject: Add qmllint in android builds as well Fixes: QTBUG-70669 Change-Id: Ie19494bdb785acdf368e14a4cdd7a141967d3248 Reviewed-by: Alex Blasche --- tools/tools.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools.pro b/tools/tools.pro index 3f5f23eb32..d3ec380717 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -3,6 +3,7 @@ QT_FOR_CONFIG += qml-private qtConfig(qml-devtools) { SUBDIRS += \ + qmllint \ qmlmin \ qmlimportscanner @@ -13,7 +14,6 @@ qtConfig(thread):!android|android_app { SUBDIRS += \ qml - qtConfig(qml-devtools): SUBDIRS += qmllint qtConfig(qml-profiler): SUBDIRS += qmlprofiler qtConfig(qml-preview): SUBDIRS += qmlpreview -- cgit v1.2.3 From 1d88e9919ff837d535f9bbde53613b6a6b96fcd8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 4 Dec 2018 14:06:59 +0100 Subject: QML: Fix registering and unregistering of context objects When we add a context object we need to include it into the list of contextObjects of its outer context, so that the outerContext member can be reset when the outer context disappears. On the flip side, we also need to remove it from this list when the object gets removed. We don't need to reset the inner context of an object when the outer context disappears, though. Fixes: QTBUG-72241 Change-Id: Ifd34650d852642a364df23b697d32e3961d0479b Reviewed-by: Mitch Curtis Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlcontext.cpp | 15 +++++++++------ src/qml/qml/qqmlcontext_p.h | 2 +- src/qml/qml/qqmlengine.cpp | 6 +++++- src/qml/qml/qqmlobjectcreator.cpp | 12 +++++++----- tests/auto/qml/qqmlcontext/data/Drawer.qml | 6 ++++++ .../qml/qqmlcontext/data/contextObjectHierarchy.qml | 6 ++++++ tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 19 +++++++++++++++++++ 7 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 tests/auto/qml/qqmlcontext/data/Drawer.qml create mode 100644 tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index cbf5a6e259..eca00ffb51 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -640,7 +640,6 @@ void QQmlContextData::destroy() QQmlData *co = contextObjects; contextObjects = contextObjects->nextContextObject; - co->context = nullptr; co->outerContext = nullptr; co->nextContextObject = nullptr; co->prevContextObject = nullptr; @@ -783,13 +782,17 @@ void QQmlContextData::refreshExpressions() } } -void QQmlContextData::addObject(QObject *o) +void QQmlContextData::addObject(QQmlData *data) { - QQmlData *data = QQmlData::get(o, true); - - Q_ASSERT(data->context == nullptr); + if (data->outerContext) { + if (data->nextContextObject) + data->nextContextObject->prevContextObject = data->prevContextObject; + if (data->prevContextObject) + *data->prevContextObject = data->nextContextObject; + else if (data->outerContext->contextObjects == data) + data->outerContext->contextObjects = data->nextContextObject; + } - data->context = this; data->outerContext = this; data->nextContextObject = contextObjects; diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index 290b7fc7ee..7e3cef8e1d 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -129,7 +129,7 @@ public: void setParent(QQmlContextData *, bool stronglyReferencedByParent = false); void refreshExpressions(); - void addObject(QObject *); + void addObject(QQmlData *data); QUrl resolvedUrl(const QUrl &); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index c400e9239b..6db43a50eb 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1518,7 +1518,9 @@ void QQmlEngine::setContextForObject(QObject *object, QQmlContext *context) } QQmlContextData *contextData = QQmlContextData::get(context); - contextData->addObject(object); + Q_ASSERT(data->context == nullptr); + data->context = contextData; + contextData->addObject(data); } /*! @@ -1882,6 +1884,8 @@ void QQmlData::destroyed(QObject *object) nextContextObject->prevContextObject = prevContextObject; if (prevContextObject) *prevContextObject = nextContextObject; + else if (outerContext && outerContext->contextObjects == this) + outerContext->contextObjects = nextContextObject; QQmlAbstractBinding *binding = bindings; while (binding) { diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index c181d791f5..68e2c2c928 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1230,13 +1230,15 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo QQmlContextData *c = ddata->context; while (c->linkedContext) c = c->linkedContext; c->linkedContext = context; - } else - context->addObject(instance); + } else { + ddata->context = context; + } ddata->ownContext = ddata->context; - } else if (!ddata->context) - context->addObject(instance); + } else if (!ddata->context) { + ddata->context = context; + } - ddata->outerContext = context; + context->addObject(ddata); if (parserStatus) { parserStatus->classBegin(); diff --git a/tests/auto/qml/qqmlcontext/data/Drawer.qml b/tests/auto/qml/qqmlcontext/data/Drawer.qml new file mode 100644 index 0000000000..b35d5c8d34 --- /dev/null +++ b/tests/auto/qml/qqmlcontext/data/Drawer.qml @@ -0,0 +1,6 @@ +import QtQuick 2.12 +import QtQuick.Window 2.11 + +Rectangle { + parent: Window.contentItem +} diff --git a/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml new file mode 100644 index 0000000000..91978d98a0 --- /dev/null +++ b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml @@ -0,0 +1,6 @@ +import QtQuick 2.6 +import QtQuick.Window 2.2 + +Window { + Drawer {} +} diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 5838193a6b..89640bc385 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -70,6 +70,7 @@ private slots: void contextLeak(); void outerContextObject(); + void contextObjectHierarchy(); private: QQmlEngine engine; @@ -873,6 +874,24 @@ void tst_qqmlcontext::outerContextObject() QTRY_VERIFY(iterations >= 100); } +void tst_qqmlcontext::contextObjectHierarchy() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("contextObjectHierarchy.qml")); + QVERIFY(component.isReady()); + QScopedPointer root(component.create()); + QVERIFY(!root.isNull()); + + for (const QObject *child : root->children()) { + QQmlData *d = QQmlData::get(child); + QVERIFY(d->outerContext != nullptr); + connect(root.data(), &QObject::destroyed, [&]() { + QCOMPARE(d->outerContext, nullptr); + }); + } +} + QTEST_MAIN(tst_qqmlcontext) #include "tst_qqmlcontext.moc" -- cgit v1.2.3 From e7eae05a3c45b239b5510cb566947c2334749b56 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 12 Dec 2018 15:56:30 +0100 Subject: Avoid memory leaks in QQmlComponent test Change-Id: I33f5f72bf90ba1ba6aef5668fab660421c722ae6 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp | 91 ++++++++++++---------- 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index efd5bb571b..7c7c7d3bd0 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -173,8 +173,8 @@ void tst_qqmlcomponent::qmlCreateWindow() QQmlEngine engine; QQmlComponent component(&engine); component.loadUrl(testFileUrl("createWindow.qml")); - QQuickWindow* window = qobject_cast(component.create()); - QVERIFY(window); + QScopedPointer window(qobject_cast(component.create())); + QVERIFY(!window.isNull()); } void tst_qqmlcomponent::qmlCreateObjectAutoParent_data() @@ -192,8 +192,8 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl(testFile)); - QQuickItem *root = qobject_cast(component.create()); - QVERIFY(root); + QScopedPointer root(qobject_cast(component.create())); + QVERIFY(!root.isNull()); QObject *qtobjectParent = root->property("qtobjectParent").value(); QQuickItem *itemParent = qobject_cast(root->property("itemParent").value()); QQuickWindow *windowParent = qobject_cast(root->property("windowParent").value()); @@ -251,45 +251,52 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createObjectWithScript.qml")); QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); - QObject *object = component.create(); - QVERIFY(object != nullptr); + QScopedPointer object(component.create()); + QVERIFY(!object.isNull()); - QObject *testObject1 = object->property("declarativerectangle").value(); - QVERIFY(testObject1); - QCOMPARE(testObject1->parent(), object); - QCOMPARE(testObject1->property("x").value(), 17); - QCOMPARE(testObject1->property("y").value(), 17); - QCOMPARE(testObject1->property("color").value(), QColor(255,255,255)); - QCOMPARE(QQmlProperty::read(testObject1,"border.width").toInt(), 3); - QCOMPARE(QQmlProperty::read(testObject1,"innerRect.border.width").toInt(), 20); - delete testObject1; - - QObject *testObject2 = object->property("declarativeitem").value(); - QVERIFY(testObject2); - QCOMPARE(testObject2->parent(), object); - //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2"); - QCOMPARE(testObject2->property("x").value(), 17); - QCOMPARE(testObject2->property("y").value(), 17); - QCOMPARE(testObject2->property("testBool").value(), true); - QCOMPARE(testObject2->property("testInt").value(), 17); - QCOMPARE(testObject2->property("testObject").value(), object); - delete testObject2; - - QObject *testBindingObj = object->property("bindingTestObject").value(); - QVERIFY(testBindingObj); - QCOMPARE(testBindingObj->parent(), object); - QCOMPARE(testBindingObj->property("testValue").value(), 300); - object->setProperty("width", 150); - QCOMPARE(testBindingObj->property("testValue").value(), 150 * 3); - delete testBindingObj; - - QObject *testBindingThisObj = object->property("bindingThisTestObject").value(); - QVERIFY(testBindingThisObj); - QCOMPARE(testBindingThisObj->parent(), object); - QCOMPARE(testBindingThisObj->property("testValue").value(), 900); - testBindingThisObj->setProperty("width", 200); - QCOMPARE(testBindingThisObj->property("testValue").value(), 200 * 3); - delete testBindingThisObj; + { + QScopedPointer testObject1(object->property("declarativerectangle") + .value()); + QVERIFY(testObject1); + QCOMPARE(testObject1->parent(), object.data()); + QCOMPARE(testObject1->property("x").value(), 17); + QCOMPARE(testObject1->property("y").value(), 17); + QCOMPARE(testObject1->property("color").value(), QColor(255,255,255)); + QCOMPARE(QQmlProperty::read(testObject1.data(),"border.width").toInt(), 3); + QCOMPARE(QQmlProperty::read(testObject1.data(),"innerRect.border.width").toInt(), 20); + } + + { + QScopedPointer testObject2(object->property("declarativeitem").value()); + QVERIFY(testObject2); + QCOMPARE(testObject2->parent(), object.data()); + //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2"); + QCOMPARE(testObject2->property("x").value(), 17); + QCOMPARE(testObject2->property("y").value(), 17); + QCOMPARE(testObject2->property("testBool").value(), true); + QCOMPARE(testObject2->property("testInt").value(), 17); + QCOMPARE(testObject2->property("testObject").value(), object.data()); + } + + { + QScopedPointer testBindingObj(object->property("bindingTestObject") + .value()); + QVERIFY(testBindingObj); + QCOMPARE(testBindingObj->parent(), object.data()); + QCOMPARE(testBindingObj->property("testValue").value(), 300); + object->setProperty("width", 150); + QCOMPARE(testBindingObj->property("testValue").value(), 150 * 3); + } + + { + QScopedPointer testBindingThisObj(object->property("bindingThisTestObject") + .value()); + QVERIFY(testBindingThisObj); + QCOMPARE(testBindingThisObj->parent(), object.data()); + QCOMPARE(testBindingThisObj->property("testValue").value(), 900); + testBindingThisObj->setProperty("width", 200); + QCOMPARE(testBindingThisObj->property("testValue").value(), 200 * 3); + } } void tst_qqmlcomponent::qmlCreateParentReference() -- cgit v1.2.3 From cb5e61c5f0b912c798791adcc3a35e6083294782 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 Dec 2018 22:09:11 -0800 Subject: Fix ICC warning about old-style scoping rules It's only been 20 years that the new style is the rule... qv4compileddata.cpp(206): error #823: reference is to variable "i" (declared at line 198) -- under old for-init scoping rules it would have been variable "i" (declared at line 204) Change-Id: I4ac1156702324f0fb814fffd156f80ecb6849ee8 Reviewed-by: Lars Knoll --- src/qml/compiler/qv4compileddata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index b8497937c1..e68a563a45 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -201,8 +201,8 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) // first locals const quint32_le *localsIndices = compiledBlock->localsTable(); - for (quint32 i = 0; i < compiledBlock->nLocals; ++i) - ic = ic->addMember(engine->identifierTable->asPropertyKey(runtimeStrings[localsIndices[i]]), Attr_NotConfigurable); + for (quint32 j = 0; j < compiledBlock->nLocals; ++j) + ic = ic->addMember(engine->identifierTable->asPropertyKey(runtimeStrings[localsIndices[j]]), Attr_NotConfigurable); runtimeBlocks[i] = ic->d(); } -- cgit v1.2.3 From cf5da3e8e235331c4929f236a1966bbd0cf28256 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 Dec 2018 22:10:57 -0800 Subject: Fix ICC change-of-sign warnings error #68: integer conversion resulted in a change of sign Change-Id: I4ac1156702324f0fb814fffd156f81056d117bcb Reviewed-by: Lars Knoll --- src/3rdparty/masm/yarr/YarrJIT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp index 9a9ab581e8..0655bb0a70 100644 --- a/src/3rdparty/masm/yarr/YarrJIT.cpp +++ b/src/3rdparty/masm/yarr/YarrJIT.cpp @@ -640,7 +640,7 @@ class YarrGenerator : private DefaultMacroAssembler { subPtr(Imm32(callFrameSizeInBytes), stackPointerRegister); if (callFrameSizeInBytes <= 128) { for (unsigned offset = 0; offset < callFrameSizeInBytes; offset += sizeof(intptr_t)) - storePtr(TrustedImmPtr(0), Address(regT0, -8 - offset)); + storePtr(TrustedImmPtr(0), Address(regT0, -8 - int(offset))); } else { Label zeroLoop = label(); subPtr(TrustedImm32(sizeof(intptr_t) * 2), regT0); -- cgit v1.2.3 From 1b79a40466ccb1ba52b596c69f3af607a1148b07 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 3 Dec 2018 11:18:52 +0100 Subject: Doc: velocity properties must be set to -1 when setting duration This is an important detail that was left out, causing confusion when a user tries to set e.g. highlightMoveDuration without setting highlightMoveVelocity to -1. Change-Id: Ida4042626fcc20105267a5d2a0babcb91eed1516 Reviewed-by: Michael Brasser --- src/quick/items/qquicklistview.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 908801ce1c..62cbfcef2b 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2456,7 +2456,18 @@ QString QQuickListView::currentSection() const The default value for the duration properties is -1, i.e. the highlight will take as much time as necessary to move at the set speed. - These properties have the same characteristics as a SmoothedAnimation. + These properties have the same characteristics as a SmoothedAnimation: + if both the velocity and duration are set, the animation will use + whichever gives the shorter duration. + + To set only one property, the other can be set to \c -1. For example, + if you only want to animate the duration and not velocity, use the + following code: + + \code + highlightMoveDuration: 1000 + highlightMoveVelocity: -1 + \endcode \sa highlightFollowsCurrentItem */ -- cgit v1.2.3 From 48eb8da7f4bde39e2f9d1a6eef4978d11bf67ca1 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Fri, 30 Nov 2018 14:18:20 +1000 Subject: nothread: do not delete reader thread object before it gets used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit exec is an empty function on nothread and returns right away, so the pixmap reader thread object gets deleted before it can download the url Task-number: QTBUG-72105 Change-Id: If205dbe12d0b5299b43a68e7d0d955a2b89b4af1 Reviewed-by: Edward Welbourne Reviewed-by: Morten Johan Sørvig --- src/quick/util/qquickpixmapcache.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 0dd2a88ca1..c1bf2160da 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -471,6 +471,10 @@ QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) eventLoopQuitHack->moveToThread(this); connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection); start(QThread::LowestPriority); +#if !QT_CONFIG(thread) + // call nonblocking run ourself, as nothread qthread does not + run(); +#endif } QQuickPixmapReader::~QQuickPixmapReader() @@ -948,8 +952,11 @@ void QQuickPixmapReader::run() processJobs(); exec(); +#if QT_CONFIG(thread) + // nothread exec is empty and returns delete threadObject; threadObject = nullptr; +#endif } class QQuickPixmapKey -- cgit v1.2.3 From f922ac81cfb9a405e24e7335b44698a6210a5fb4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 13 Dec 2018 23:00:49 +0100 Subject: Un-blacklist tst_touchmouse::hoverEnabled See if this is stable yet. Recent coin statistics seems to say it's been passing. Task-number: QTBUG-40856 Change-Id: I49372cc514971acf26ac9b9b9a86ea2eb46a9773 Reviewed-by: Shawn Rutledge --- tests/auto/quick/touchmouse/BLACKLIST | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/quick/touchmouse/BLACKLIST b/tests/auto/quick/touchmouse/BLACKLIST index e0d4bff131..b2ba52eca9 100644 --- a/tests/auto/quick/touchmouse/BLACKLIST +++ b/tests/auto/quick/touchmouse/BLACKLIST @@ -1,5 +1,2 @@ -# QTBUG-40856 hover regression on pointerhandler branch: TODO fix before merging to dev -[hoverEnabled] -* [buttonOnDelayedPressFlickable] windows gcc developer-build -- cgit v1.2.3 From e12e36f802759d61c02c94ee6432e79745dce59b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 13 Dec 2018 23:02:47 +0100 Subject: Un-blacklist qsequentialanimationgroupjob test Recent Coin statistics seem to tell us that it's been passing. Change-Id: I0d32531266d1642a3fe2b18c0956a3ac589f5ee2 Reviewed-by: Shawn Rutledge --- tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST b/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST deleted file mode 100644 index 2afe6074d7..0000000000 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[finishWithUncontrolledAnimation] -* -- cgit v1.2.3 From aad66998c379deba70aceda27c09d4680bbf10ff Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 21 Nov 2018 14:02:12 +0100 Subject: qmlscene: Make it explicit that QCA::installTranslator is static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1b123981a9dae359c27c96d4b7ae276af1c5e90f Reviewed-by: Jan Arve Sæther --- tools/qmlscene/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index c9e7dbadc9..c1399c38e5 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -546,15 +546,15 @@ int main(int argc, char ** argv) QLocale locale; QTranslator qtTranslator; if (qtTranslator.load(locale, QLatin1String("qt"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) - app->installTranslator(&qtTranslator); + QCoreApplication::installTranslator(&qtTranslator); QTranslator translator; if (translator.load(locale, QLatin1String("qmlscene"), QLatin1String("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) - app->installTranslator(&translator); + QCoreApplication::installTranslator(&translator); QTranslator qmlTranslator; if (!options.translationFile.isEmpty()) { if (qmlTranslator.load(options.translationFile)) { - app->installTranslator(&qmlTranslator); + QCoreApplication::installTranslator(&qmlTranslator); } else { fprintf(stderr, "Could not load the translation file \"%s\"\n", qPrintable(options.translationFile)); -- cgit v1.2.3 From c401ae278b4bb91c70c6d7df974a241d7c68855b Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 13 Dec 2018 12:41:49 +0100 Subject: QML: When destroying a context, clear any pointers to it The "context" pointer in QQmlData can either point to ownContext, or to outerContext. In the latter case we need to clear it when the outerContext is destroyed. Fixes: QTBUG-72527 Change-Id: Ifbf358d405d6cec9868f67184ef887d1b70c90bc Reviewed-by: Mitch Curtis Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index eca00ffb51..3710cee162 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -640,6 +640,8 @@ void QQmlContextData::destroy() QQmlData *co = contextObjects; contextObjects = contextObjects->nextContextObject; + if (co->context == this) + co->context = nullptr; co->outerContext = nullptr; co->nextContextObject = nullptr; co->prevContextObject = nullptr; -- cgit v1.2.3 From d6e560c356791d516856c38566104fbb2bb6c730 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 5 Dec 2018 13:33:31 +0100 Subject: When there are no points to grab, then we should return false If there are no points to grab then it should not indicate that it was able to grab points. Otherwise it can cause a handler to be active when it has not valid points to work with. This can happen if you do a pinch gesture on a DragHandler as the points are not valid by default then. Fixes: QTBUG-71972 Change-Id: Ib1c48e5a3777f4118944accfa2bc92edf0209884 Reviewed-by: Shawn Rutledge --- src/quick/handlers/qquickmultipointhandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 2f4e9d45e9..228c99bb12 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -309,6 +309,8 @@ void QQuickMultiPointHandler::acceptPoints(const QVector &po bool QQuickMultiPointHandler::grabPoints(QVector points) { + if (points.isEmpty()) + return false; bool allowed = true; for (QQuickEventPoint* point : points) { if (point->exclusiveGrabber() != this && !canGrab(point)) { -- cgit v1.2.3 From 3124b03276398f68dd8f3afe18866cfb6ec8a035 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 31 Jan 2018 20:05:38 +0100 Subject: stabilize and standardize tst_qquickwidget In tst_qquickwidget::enterLeave(), retain the changes from 9d2a929fa4dd0beae3c30fb08d4ed4df7368ea4f rather than the cherry-pick. Don't hard-code 5000ms timeout on qWaitForWindowExposed(): it's the default anyway. Task-number: QTBUG-64397 Change-Id: I67e4566c2c7f9e361a79e3a091436c3391f39786 Reviewed-by: Mitch Curtis Reviewed-by: Shawn Rutledge (cherry-picked from commit 239b8f6ee869dbe1f27ec4fa5d5247eff502c47b) Reviewed-by: Friedemann Kleint --- tests/auto/quickwidgets/qquickwidget/BLACKLIST | 2 -- .../quickwidgets/qquickwidget/tst_qquickwidget.cpp | 28 +++++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 tests/auto/quickwidgets/qquickwidget/BLACKLIST diff --git a/tests/auto/quickwidgets/qquickwidget/BLACKLIST b/tests/auto/quickwidgets/qquickwidget/BLACKLIST deleted file mode 100644 index 6594a22472..0000000000 --- a/tests/auto/quickwidgets/qquickwidget/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[enterLeave] -osx diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 24e55e3b3a..42dc766a13 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -160,7 +160,7 @@ void tst_qquickwidget::showHide() childView->setSource(testFileUrl("rectangle.qml")); window.show(); - QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(childView->quickWindow()->isVisible()); QVERIFY(childView->quickWindow()->visibility() != QWindow::Hidden); @@ -176,13 +176,13 @@ void tst_qquickwidget::reparentAfterShow() QQuickWidget *childView = new QQuickWidget(&window); childView->setSource(testFileUrl("rectangle.qml")); window.show(); - QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QScopedPointer toplevelView(new QQuickWidget); toplevelView->setParent(&window); toplevelView->setSource(testFileUrl("rectangle.qml")); toplevelView->show(); - QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window)); } void tst_qquickwidget::changeGeometry() @@ -193,7 +193,7 @@ void tst_qquickwidget::changeGeometry() childView->setSource(testFileUrl("rectangle.qml")); window.show(); - QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window)); childView->setGeometry(100,100,100,100); } @@ -373,7 +373,7 @@ void tst_qquickwidget::readback() view->setSource(testFileUrl("rectangle.qml")); view->show(); - QVERIFY(QTest::qWaitForWindowExposed(view.data(), 5000)); + QVERIFY(QTest::qWaitForWindowExposed(view.data())); QImage img = view->grabFramebuffer(); QVERIFY(!img.isNull()); @@ -409,7 +409,7 @@ void tst_qquickwidget::renderingSignals() QCOMPARE(afterRenderingSpy.size(), 0); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(&widget, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTRY_VERIFY(beforeRenderingSpy.size() > 0); QTRY_VERIFY(beforeSyncSpy.size() > 0); @@ -441,9 +441,9 @@ void tst_qquickwidget::reparentToNewWindow() QQuickWidget *qqw = new QQuickWidget(&window1); qqw->setSource(testFileUrl("rectangle.qml")); window1.show(); - QVERIFY(QTest::qWaitForWindowExposed(&window1, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window1)); window2.show(); - QVERIFY(QTest::qWaitForWindowExposed(&window2, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&window2)); QSignalSpy afterRenderingSpy(qqw->quickWindow(), &QQuickWindow::afterRendering); qqw->setParent(&window2); @@ -488,7 +488,7 @@ void tst_qquickwidget::keyEvents() KeyHandlingWidget widget; widget.setSource(testFileUrl("rectangle.qml")); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000)); + QVERIFY(QTest::qWaitForWindowExposed(widget.window())); // Note: send the event to the QWindow, not the QWidget, in order // to simulate the full event processing chain. @@ -516,7 +516,7 @@ void tst_qquickwidget::shortcuts() KeyHandlingWidget widget; widget.setSource(testFileUrl("rectangle.qml")); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000)); + QVERIFY(QTest::qWaitForWindowExposed(widget.window())); // Send to the widget, verify that the QQuickWindow sees it. @@ -534,14 +534,14 @@ void tst_qquickwidget::enterLeave() QQuickWidget view; view.setSource(testFileUrl("enterleave.qml")); - // Ensure it is not inside the window first + // Ensure the cursor is away from the window first const auto outside = m_availableGeometry.topLeft() + QPoint(50, 50); QCursor::setPos(outside); QTRY_VERIFY(QCursor::pos() == outside); view.move(m_availableGeometry.topLeft() + QPoint(100, 100)); view.show(); - QVERIFY(QTest::qWaitForWindowExposed(&view, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QQuickItem *rootItem = view.rootObject(); QVERIFY(rootItem); const QPoint frameOffset = view.geometry().topLeft() - view.frameGeometry().topLeft(); @@ -551,7 +551,7 @@ void tst_qquickwidget::enterLeave() QCursor::setPos(view.pos() + QPoint(50, 50) + frameOffset); QTRY_VERIFY(rootItem->property("hasMouse").toBool()); // Now check the leave - QCursor::setPos(view.pos() - QPoint(50, 50)); + QCursor::setPos(outside); QTRY_VERIFY(!rootItem->property("hasMouse").toBool()); } @@ -563,7 +563,7 @@ void tst_qquickwidget::mouseEventWindowPos() quick->setSource(testFileUrl("mouse.qml")); quick->move(50, 50); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(&widget, 5000)); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QQuickItem *rootItem = quick->rootObject(); QVERIFY(rootItem); -- cgit v1.2.3 From bffc040f8014b361992cd92671e559c1c2abd633 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 14 Dec 2018 10:20:06 +0100 Subject: Tests: Un-crash image comparison tests When (naively) running the tests with High-DPI scaling active, the test would assert on mismatching image sizes caused by the scaling. Add an error message parameter to QQuickVisualTestUtil::compareImages() for use with QVERIFY2, return false instead of asserting on format/size mismatches and adapt the usages. Remove duplicate code in tst_qquickwindow. Change-Id: I76564f4125798fa1e065a0202b686bc7f5ec5680 Reviewed-by: Mitch Curtis --- .../qquickborderimage/tst_qquickborderimage.cpp | 4 ++- tests/auto/quick/qquickshape/tst_qquickshape.cpp | 20 ++++++++--- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 42 ++-------------------- tests/auto/quick/scenegraph/tst_scenegraph.cpp | 10 ++++-- tests/auto/quick/shared/visualtestutil.cpp | 30 +++++++++------- tests/auto/quick/shared/visualtestutil.h | 2 +- 6 files changed, 48 insertions(+), 60 deletions(-) diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 02e89ba0a7..9292e1886a 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -596,7 +596,9 @@ void tst_qquickborderimage::borderImageMesh() window->setSource(testFileUrl("mesh.qml")); QImage mesh = window->grabWindow(); - QVERIFY(QQuickVisualTestUtil::compareImages(mesh, nonmesh)); + QString errorMessage; + QVERIFY2(QQuickVisualTestUtil::compareImages(mesh, nonmesh, &errorMessage), + qPrintable(errorMessage)); } #endif QTEST_MAIN(tst_qquickborderimage) diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index 3206129e72..61fb260612 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -233,7 +233,10 @@ void tst_QQuickShape::render() QImage refImg(testFileUrl("pathitem3.png").toLocalFile()); QVERIFY(!refImg.isNull()); - QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); + QString errorMessage; + const QImage actualImg = img.convertToFormat(refImg.format()); + QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage), + qPrintable(errorMessage)); } void tst_QQuickShape::renderWithMultipleSp() @@ -254,7 +257,10 @@ void tst_QQuickShape::renderWithMultipleSp() QImage refImg(testFileUrl("pathitem4.png").toLocalFile()); QVERIFY(!refImg.isNull()); - QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); + QString errorMessage; + const QImage actualImg = img.convertToFormat(refImg.format()); + QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage), + qPrintable(errorMessage)); } void tst_QQuickShape::radialGrad() @@ -275,7 +281,10 @@ void tst_QQuickShape::radialGrad() QImage refImg(testFileUrl("pathitem5.png").toLocalFile()); QVERIFY(!refImg.isNull()); - QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); + QString errorMessage; + const QImage actualImg = img.convertToFormat(refImg.format()); + QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage), + qPrintable(errorMessage)); } void tst_QQuickShape::conicalGrad() @@ -296,7 +305,10 @@ void tst_QQuickShape::conicalGrad() QImage refImg(testFileUrl("pathitem6.png").toLocalFile()); QVERIFY(!refImg.isNull()); - QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg)); + QString errorMessage; + const QImage actualImg = img.convertToFormat(refImg.format()); + QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage), + qPrintable(errorMessage)); } QTEST_MAIN(tst_QQuickShape) diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 578ae56cca..ab101dc1be 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1506,44 +1506,6 @@ void tst_qquickwindow::animationsWhileHidden() QTRY_VERIFY(window->isVisible()); } -// When running on native Nvidia graphics cards on linux, the -// distance field glyph pixels have a measurable, but not visible -// pixel error. Use a custom compare function to avoid -// -// This was GT-216 with the ubuntu "nvidia-319" driver package. -// llvmpipe does not show the same issue. -// -bool compareImages(const QImage &ia, const QImage &ib) -{ - if (ia.size() != ib.size()) - qDebug() << "images are of different size" << ia.size() << ib.size(); - Q_ASSERT(ia.size() == ib.size()); - Q_ASSERT(ia.format() == ib.format()); - - int w = ia.width(); - int h = ia.height(); - const int tolerance = 5; - for (int y=0; y tolerance) - return false; - if (qAbs(qRed(a) - qRed(b)) > tolerance) - return false; - if (qAbs(qRed(a) - qRed(b)) > tolerance) - return false; - } - } - return true; -} - void tst_qquickwindow::headless() { QQmlEngine engine; @@ -1597,7 +1559,9 @@ void tst_qquickwindow::headless() // Verify that the visual output is the same QImage newContent = window->grabWindow(); - QVERIFY(compareImages(newContent, originalContent)); + QString errorMessage; + QVERIFY2(QQuickVisualTestUtil::compareImages(newContent, originalContent, &errorMessage), + qPrintable(errorMessage)); } void tst_qquickwindow::noUpdateWhenNothingChanges() diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 2479450287..063358c795 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -264,6 +264,7 @@ void tst_SceneGraph::manyWindows() const int COUNT = 4; QImage baseLine; + QString errorMessage; for (int i=0; igrabWindow())); + QVERIFY2(compareImages(baseLine, last->grabWindow(), &errorMessage), + qPrintable(errorMessage)); // Wipe and recreate all qDeleteAll(views); @@ -297,7 +300,8 @@ void tst_SceneGraph::manyWindows() QQuickView *view = views.at(i); QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); - QVERIFY(compareImages(content, baseLine)); + QVERIFY2(compareImages(content, baseLine, &errorMessage), + qPrintable(errorMessage)); } } diff --git a/tests/auto/quick/shared/visualtestutil.cpp b/tests/auto/quick/shared/visualtestutil.cpp index eabfe5368b..de2cf2bd5b 100644 --- a/tests/auto/quick/shared/visualtestutil.cpp +++ b/tests/auto/quick/shared/visualtestutil.cpp @@ -66,12 +66,18 @@ void QQuickVisualTestUtil::dumpTree(QQuickItem *parent, int depth) // distance field glyph pixels have a measurable, but not visible // pixel error. This was GT-216 with the ubuntu "nvidia-319" driver package. // llvmpipe does not show the same issue. -bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib) + +bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib, QString *errorMessage) { - if (ia.size() != ib.size()) - qDebug() << "images are of different size" << ia.size() << ib.size(); - Q_ASSERT(ia.size() == ib.size()); - Q_ASSERT(ia.format() == ib.format()); + if (ia.size() != ib.size()) { + QDebug(errorMessage) << "Images are of different size:" << ia.size() << ib.size() + << "DPR:" << ia.devicePixelRatio() << ib.devicePixelRatio(); + return false; + } + if (ia.format() != ib.format()) { + QDebug(errorMessage) << "Images are of different formats:" << ia.format() << ib.format(); + return false; + } int w = ia.width(); int h = ia.height(); @@ -84,14 +90,14 @@ bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib) uint b = bs[x]; // No tolerance for error in the alpha. - if ((a & 0xff000000) != (b & 0xff000000)) - return false; - if (qAbs(qRed(a) - qRed(b)) > tolerance) - return false; - if (qAbs(qRed(a) - qRed(b)) > tolerance) - return false; - if (qAbs(qRed(a) - qRed(b)) > tolerance) + if ((a & 0xff000000) != (b & 0xff000000) + || qAbs(qRed(a) - qRed(b)) > tolerance + || qAbs(qRed(a) - qRed(b)) > tolerance + || qAbs(qRed(a) - qRed(b)) > tolerance) { + QDebug(errorMessage) << "Mismatch at:" << x << y << ':' + << hex << showbase << a << b; return false; + } } } return true; diff --git a/tests/auto/quick/shared/visualtestutil.h b/tests/auto/quick/shared/visualtestutil.h index 2daf86cd83..1cdbaf838b 100644 --- a/tests/auto/quick/shared/visualtestutil.h +++ b/tests/auto/quick/shared/visualtestutil.h @@ -97,7 +97,7 @@ namespace QQuickVisualTestUtil return items; } - bool compareImages(const QImage &ia, const QImage &ib); + bool compareImages(const QImage &ia, const QImage &ib, QString *errorMessage); } #define QQUICK_VERIFY_POLISH(item) \ -- cgit v1.2.3 From 75ebbd0b354739150e10da7216b44e2dde2c2b14 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 20 Dec 2018 14:08:12 +0100 Subject: Quote stringified generic variants on JSON.stringify A string representation of those is unlikely to be actual JSON, and even if it is, we don't want to use it as such. Fixes: QTBUG-72674 Change-Id: I6815366a0176d9725ff4840d3fc545792ce00535 Reviewed-by: Simon Hausmann Reviewed-by: Robin Burchell --- src/qml/jsruntime/qv4jsonobject.cpp | 2 +- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 0c5436a0d6..936c032fad 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -739,7 +739,7 @@ QString Stringify::Str(const QString &key, const Value &v) } if (const QV4::VariantObject *v = value->as()) { - return v->d()->data().toString(); + return quote(v->d()->data().toString()); } o = value->asReturnedValue(); diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 254a6bc878..085cd5ffd0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -8464,7 +8464,8 @@ void tst_qqmlecmascript::stringify_qtbug_50592() QScopedPointer obj(component.create()); QVERIFY(obj != nullptr); - QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png")); + QCOMPARE(obj->property("source").toString(), + QString::fromLatin1("\"http://example.org/some_nonexistant_image.png\"")); } // Tests for the JS-only instanceof. Tests for the QML extensions for -- cgit v1.2.3 From c57681bc376d1d912d23b044c48932fa8f7816d7 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 20 Dec 2018 00:10:50 +0100 Subject: qquickpixmapcache: Fix invalidation of m_cache while iterating it Releasing items from the cache modifies m_cache, which we cannot do with a range-for. Fixes: QTBUG-65077 Change-Id: I2efcf6a03b03982a54bb1aacff43c55c45782eaa Reviewed-by: Simon Hausmann --- src/quick/util/qquickpixmapcache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index c1bf2160da..dc8bed8125 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -1026,7 +1026,8 @@ QQuickPixmapStore::~QQuickPixmapStore() m_timerId = -2; // unreference all (leaked) pixmaps - for (auto *pixmap : qAsConst(m_cache)) { + const auto cache = m_cache; // NOTE: intentional copy (QTBUG-65077); releasing items from the cache modifies m_cache. + for (auto *pixmap : cache) { int currRefCount = pixmap->refCount; if (currRefCount) { #ifndef QT_NO_DEBUG -- cgit v1.2.3 From 0e33ba51166dd68a26c56d85a1155c4849d59e4a Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 11 Dec 2018 12:13:49 +0100 Subject: Doc: Fix link issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I738b9da5335afb048d2eda2edf2be5095a91d7e5 Reviewed-by: Topi Reiniö --- src/qml/doc/qtqml.qdocconf | 2 +- src/qml/doc/src/qmllanguageref/syntax/signals.qdoc | 4 ++-- src/qml/types/qqmldelegatemodel.cpp | 2 +- src/quick/doc/qtquick.qdocconf | 2 +- src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc | 4 +--- src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc | 2 +- src/quick/doc/src/examples.qdoc | 2 -- src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc | 1 - src/quick/doc/src/qmltypereference.qdoc | 2 +- src/quick/handlers/qquickdraghandler.cpp | 2 +- src/quick/handlers/qquickhandlerpoint.cpp | 2 -- src/quick/handlers/qquickpointhandler.cpp | 2 +- 12 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 40acc7c13f..ba4155c08b 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -33,7 +33,7 @@ qhp.QtQml.subprojects.qmltypes.sortPages = true tagfile = ../../../doc/qtqml/qtqml.tags -depends += qtcore qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets +depends += qtcore qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets qtxmlpatterns qtquickcontrols headerdirs += .. \ ../../imports/models diff --git a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc index f0ad2b7767..b643f18154 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc @@ -52,8 +52,8 @@ object, the object definition should declare a signal handler named letter capitalized. The signal handler should contain the JavaScript code to be executed when the signal handler is invoked. -For example, the \l [QtQuick.Controls2]{Button} type from the -\l{Qt Quick Controls 2}{Qt Quick Controls} module has a \c clicked signal, which +For example, the \l [QtQuickControls]{Button} type from the +\l{Qt Quick Controls} module has a \c clicked signal, which is emitted whenever the button is clicked. In this case, the signal handler for receiving this signal should be \c onClicked. In the example below, whenever the button is clicked, the \c onClicked handler is invoked, applying a random diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 8a0d60a092..57bbf7465d 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -350,7 +350,7 @@ void QQmlDelegateModel::componentComplete() {QAbstractItemModel} subclass or a simple list. Models can also be created directly in QML, using a \l{ListModel} or - \l{XmlListModel}. + \l{QtQuick.XmlListModel::XmlListModel}{XmlListModel}. \sa {qml-data-models}{Data Models} */ diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 8c69eba6a6..21a44a2fab 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -37,7 +37,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtqml qtqmltest qtgui qtlinguist qtquickcontrols qtquickcontrols2 qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql +depends += qtcore qtqml qtqmltest qtgui qtlinguist qtquickcontrols1 qtquickcontrols qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects qtsql qtxmlpatterns headerdirs += ..\ ../../quickwidgets diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc index a849a30b4e..e4d837112f 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc @@ -331,9 +331,7 @@ signal after saving the changes. Unlike the C++ item views such as QListView or QTableView, the \c setData() method must be explicitly invoked from QML delegates whenever appropriate. This is done -by simply assigning a new value to the corresponding model property. For example, -on the \l[QML]{TextField::}{editingFinished}() or \l[QML]{TextField::}{accepted}() -signal of \l[QtQuickControls]{TextField}. +by simply assigning a new value to the corresponding model property. \qml ListView { diff --git a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc index 0c6aaecf42..04dbf1cf20 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc @@ -226,7 +226,7 @@ To visualize data, bind the view's \c model property to a model and the \section2 XML Model XmlListModel allows construction of a model from an XML data source. The roles - are specified via the \l XmlRole type. The type needs to be imported. + are specified via the \l [QML]{XmlRole} type. The type needs to be imported. \code import QtQuick.XmlListModel 2.0 diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc index 39fc7f27eb..77475e9812 100644 --- a/src/quick/doc/src/examples.qdoc +++ b/src/quick/doc/src/examples.qdoc @@ -77,9 +77,7 @@ steps such as use cases and introductory material. For more information about Qt \b{Development Environment} \list \li \l{Qt Creator: Creating Qt Quick Projects}{Creating Qt Quick Projects} - \li \l{Qt Creator: Using Qt Quick Designer}{Using Qt Quick Designer} \li \l{Qt Creator: Creating Components}{Creating Components} - \li \l{Qt Creator: Creating Screens}{Creating Screens} \li \l{Qt Creator: Exporting Designs from Graphics Software}{Exporting Designs from Graphics Software} \li \l{Qt Creator: Using QML Modules with Plugins}{Using QML Modules with Plugins} \endlist diff --git a/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc index 5f00abc193..0669ec06c8 100644 --- a/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc +++ b/src/quick/doc/src/guidelines/qtquick-toolsnutilities.qdoc @@ -108,6 +108,5 @@ integrating 3rd party tools such as QmlLive and GammaRay. \section2 Related Information \list \li \l{Qt Creator Manual} -\li \l{Qt Creator: Integrating 3rd Party Tools} \endlist */ diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index ddf90f88d9..04682c9f33 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -49,7 +49,7 @@ information about the concepts which are central to \c QtQuick. Qt Quick includes several submodules which contain additional types. \list - \li \l{Qt Quick XmlListModel QML Types}{XML List Model} - contains types + \li \l{Qt Quick XmlListModel QML Types}{Xml List Model} - contains types for creating models from XML data \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule containing a JavaScript interface for an SQLite database diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp index aa66c16007..48f0599284 100644 --- a/src/quick/handlers/qquickdraghandler.cpp +++ b/src/quick/handlers/qquickdraghandler.cpp @@ -82,7 +82,7 @@ Q_LOGGING_CATEGORY(lcDragHandler, "qt.quick.handler.drag") and thus can be used to adjust some other feature independently of the usual pinch behavior: for example adjust a tilt transformation, or adjust some other numeric value, if the \c target is set to null. But if the - \l target is an Item, \l centroid is the point at which the drag begins and + \c target is an Item, \c centroid is the point at which the drag begins and to which the \c target will be moved (subject to constraints). At this time, drag-and-drop is not yet supported. diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp index 6a106b5464..de21537f27 100644 --- a/src/quick/handlers/qquickhandlerpoint.cpp +++ b/src/quick/handlers/qquickhandlerpoint.cpp @@ -282,8 +282,6 @@ void QQuickHandlerPoint::reset(const QVector &points) This property holds the keyboard modifiers that were pressed at the time the event occurred. - - \sa MouseArea::modifiers */ /*! diff --git a/src/quick/handlers/qquickpointhandler.cpp b/src/quick/handlers/qquickpointhandler.cpp index 3bc1c06a1a..6d6ba07f5c 100644 --- a/src/quick/handlers/qquickpointhandler.cpp +++ b/src/quick/handlers/qquickpointhandler.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE occurs within the bounds of the \l {PointerHandler::parent}, and no sibling PointHandler within the same \l {PointerHandler::parent} has yet acquired a passive grab on that point, and if the other - constraints such as \l {SinglePointHandler::acceptedButtons}, + constraints such as \l[QML]{SinglePointHandler::acceptedButtons}, \l {PointerDeviceHandler::acceptedDevices} etc. are satisfied, it's eligible, and the PointHandler then acquires a passive grab. In this way, the \l {PointerHandler::parent} acts like an exclusive -- cgit v1.2.3 From c327c43be82c6a2827df1f493ca4e3487a0fc9c3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 3 Jan 2019 10:36:44 +0100 Subject: Tests: Don't capture stack value by reference We can actually not capture d at all there, as some of the items get deleted before the root object is deleted. Therefore, we need to iterate the children again on receiving the destroyed() signal. Change-Id: Iab7ebc3c731438a21b243284de7515530232828f Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 89640bc385..cb4bee0d3a 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -883,13 +883,13 @@ void tst_qqmlcontext::contextObjectHierarchy() QScopedPointer root(component.create()); QVERIFY(!root.isNull()); - for (const QObject *child : root->children()) { - QQmlData *d = QQmlData::get(child); - QVERIFY(d->outerContext != nullptr); - connect(root.data(), &QObject::destroyed, [&]() { - QCOMPARE(d->outerContext, nullptr); - }); - } + for (const QObject *child : root->children()) + QVERIFY(QQmlData::get(child)->outerContext != nullptr); + + connect(root.data(), &QObject::destroyed, [&root]() { + for (const QObject *child : root->children()) + QCOMPARE(QQmlData::get(child)->outerContext, nullptr); + }); } QTEST_MAIN(tst_qqmlcontext) -- cgit v1.2.3 From 5ed082ea4ce3580134a9a0c83e6fdb81a6231c8e Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 7 Jan 2019 09:29:09 +0200 Subject: Bump version Change-Id: I3d5ad9a1f10ccd992d86365dbc7ad9c8ff0b2036 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 81caa27c53..34660b3c4d 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += warning_clean -MODULE_VERSION = 5.12.0 +MODULE_VERSION = 5.12.1 -- cgit v1.2.3