aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-01 01:00:48 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-07-01 10:29:06 +0200
commite6c6cc8fde26bd0b9d37a1812593f17df0b4159a (patch)
tree6aae6724e24a1e051d271e5f67baab5acc358313
parent16289f35eb08a9b9a6d56ea8dec549b1f17e4daf (diff)
parent3ecec55e534214aced70ccab7cc929cfb57738a2 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/imports/imports.pro src/qml/qml/qqmlmetatype.cpp Change-Id: I308436caf55402cb2246cb591c6ac8f83e1febf8
-rw-r--r--dist/changes-5.13.098
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp58
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h3
-rw-r--r--src/imports/imports.pro4
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc13
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp10
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp14
-rw-r--r--src/qml/qml/qqml.cpp20
-rw-r--r--src/qml/qml/qqmlmetatype.cpp8
-rw-r--r--src/qml/qml/qqmlmetatype_p.h4
-rw-r--r--src/qml/qml/qqmlprivate.h1
-rw-r--r--src/quick/items/qquickitemview.cpp28
-rw-r--r--src/quick/items/qquickitemview_p_p.h2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/getThis.qml60
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
-rw-r--r--tests/auto/qml/qqmlenginecleanup/CustomModuleImport/CustomModule.pro13
-rw-r--r--tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml41
-rw-r--r--tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp60
-rw-r--r--tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.qrc5
-rw-r--r--tests/auto/qml/qqmlenginecleanup/CustomModuleImport/qmldir3
-rw-r--r--tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro11
-rw-r--r--tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp18
-rw-r--r--tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.pro9
-rw-r--r--tests/auto/quick/qquickanimations/data/fastFlickingBug.qml114
-rw-r--r--tests/auto/quick/qquickanimations/qquickanimations.pro1
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp30
-rw-r--r--tests/auto/quick/qquicklistview/BLACKLIST3
-rw-r--r--tests/auto/quick/qquicklistview/data/footer2.qml33
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp16
-rw-r--r--tools/qmlcachegen/generateloader.cpp7
-rw-r--r--tools/qmlscene/main.cpp44
31 files changed, 678 insertions, 65 deletions
diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0
new file mode 100644
index 0000000000..67c5d90e16
--- /dev/null
+++ b/dist/changes-5.13.0
@@ -0,0 +1,98 @@
+Qt 5.13 introduces many new features and improvements as well as bugfixes
+over the 5.12.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+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.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-68278] The Canvas requestAnimationFrame callback now gets passed a
+ millisecond timestamp instead of seconds.
+
+****************************************************************************
+* QtQml *
+****************************************************************************
+
+ - Nested arrays are not flattened anymore when printed through console.log()
+ and friends.
+ - [QTBUG-72098] Assigning JavaScript null to incompatibly typed properties
+ generates a compile warning now. In future versions of Qt this will
+ become an error.
+ - [QTBUG-60057] QVariant's debug stream operator is now used in console.log()
+ and friends. This often includes more information than before, and
+ works better for custom types.
+ - [QTBUG-74068] Qt.include() is deprecated in favor of ECMAScript modules.
+ - [QTBUG-60338] Added support for QSequentialIterable in QML, meaning
+ that the engine understands many sequential value types (such as lists
+ of Q_GADGETS) and is able to convert them to JS arrays.
+ - [QTBUG-66504] QmlDebug has new features to improve integration with
+ external tools and IDEs.
+ - [QTBUG-50061] Global exception handlers are now called reliably by
+ unwinding JIT-generated code via a function table.
+ - [QTBUG-72294] Fixed a function table error on WinRT.
+ - [QTBUG-72430] Added the QTQUICK_COMPILER_RETAINED_RESOURCES option to
+ retain sources when generating QML cache files.
+ - [QTBUG-72930] A Component can no longer be assigned to properties of other types.
+ - [QTBUG-71838] LocalStorage now returns the new database version
+ from changeVersion() without reopening the connection.
+
+ - qml:
+ * [QTBUG-70826][QTBUG-74662] The QML Runtime tool now has an updated
+ application icon and a default window icon. QtQuick applications can
+ still use QWindow::setIcon() to override the window icon.
+
+ - qmlscene:
+ * [QDS-589] qmlscene now supports file selectors.
+
+****************************************************************************
+* QtQuick *
+****************************************************************************
+
+ - Item Views:
+ * Added itemAtIndex() to GridView, ListView and PathView to fetch a visible
+ delegate by index.
+
+ - TableView:
+ * Added support for hiding rows and columns by setting their size to 0 from
+ the columnsWidthProvider/rowHeightProvider.
+
+ - Text:
+ * [QTBUG-32525][QTBUG-70748] Inline images in a QTextDocumentLayout are
+ now displayed in Text and friends.
+ * [QTBUG-68711] Fixed Keys.onShortcutOverride for TextEdit
+ * [QTBUG-50587] Fixed persistentSelection for readonly TextEdit
+ * [QTBUG-72736] Text wrapping no longer breaks on the last line if right
+ elide is enabled
+
+ - Window:
+ * [QTBUG-67903] Added the Window.transientParent property. QtQuick normally
+ guesses the transient parent relationship from the nesting of declarations,
+ but now you can override this "magic" by setting it explicitly.
+ * [QTBUG-73929] Fixed a race condition when closing windows.
+
+****************************************************************************
+* QtQuickTest *
+****************************************************************************
+
+ - [QTBUG-71224] Added QQuickTest::qWaitForItemPolished() for verifying that
+ updatePolish() was called on an item.
+ - [QTBUG-71224] Added qIsPolishScheduled() function to allow checking if
+ updatePolish() has been called on an item since the last call to its
+ polish() function. This is useful to verify that a polish has been
+ scheduled.
+ - Added TestCase.isPolishScheduled() function to allow checking whether
+ updatePolish() has been called on an item since the last call to its polish()
+ function. This is useful to verify that a polish has been scheduled.
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index a006f659c9..a93edd3b1b 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -39,6 +39,8 @@
#include "fileinfothread_p.h"
#include <qdiriterator.h>
+#include <qpointer.h>
+#include <qtimer.h>
#include <QDebug>
@@ -46,6 +48,7 @@
FileInfoThread::FileInfoThread(QObject *parent)
: QThread(parent),
abort(false),
+ scanPending(false),
#if QT_CONFIG(filesystemwatcher)
watcher(nullptr),
#endif
@@ -109,7 +112,7 @@ void FileInfoThread::setPath(const QString &path)
#endif
currentPath = path;
needUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setRootPath(const QString &path)
@@ -126,7 +129,7 @@ void FileInfoThread::dirChanged(const QString &directoryPath)
Q_UNUSED(directoryPath);
QMutexLocker locker(&mutex);
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
#endif
@@ -136,7 +139,7 @@ void FileInfoThread::setSortFlags(QDir::SortFlags flags)
sortFlags = flags;
sortUpdate = true;
needUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setNameFilters(const QStringList & filters)
@@ -144,7 +147,7 @@ void FileInfoThread::setNameFilters(const QStringList & filters)
QMutexLocker locker(&mutex);
nameFilters = filters;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowFiles(bool show)
@@ -152,7 +155,7 @@ void FileInfoThread::setShowFiles(bool show)
QMutexLocker locker(&mutex);
showFiles = show;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowDirs(bool showFolders)
@@ -160,7 +163,7 @@ void FileInfoThread::setShowDirs(bool showFolders)
QMutexLocker locker(&mutex);
showDirs = showFolders;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowDirsFirst(bool show)
@@ -168,7 +171,7 @@ void FileInfoThread::setShowDirsFirst(bool show)
QMutexLocker locker(&mutex);
showDirsFirst = show;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowDotAndDotDot(bool on)
@@ -177,7 +180,7 @@ void FileInfoThread::setShowDotAndDotDot(bool on)
showDotAndDotDot = on;
folderUpdate = true;
needUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowHidden(bool on)
@@ -186,7 +189,7 @@ void FileInfoThread::setShowHidden(bool on)
showHidden = on;
folderUpdate = true;
needUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setShowOnlyReadable(bool on)
@@ -194,7 +197,7 @@ void FileInfoThread::setShowOnlyReadable(bool on)
QMutexLocker locker(&mutex);
showOnlyReadable = on;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
void FileInfoThread::setCaseSensitive(bool on)
@@ -202,7 +205,7 @@ void FileInfoThread::setCaseSensitive(bool on)
QMutexLocker locker(&mutex);
caseSensitive = on;
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
#if QT_CONFIG(filesystemwatcher)
@@ -211,7 +214,7 @@ void FileInfoThread::updateFile(const QString &path)
Q_UNUSED(path);
QMutexLocker locker(&mutex);
folderUpdate = true;
- condition.wakeAll();
+ initiateScan();
}
#endif
@@ -242,6 +245,37 @@ void FileInfoThread::run()
}
}
+void FileInfoThread::runOnce()
+{
+ if (scanPending)
+ return;
+ scanPending = true;
+ QPointer<FileInfoThread> guardedThis(this);
+
+ auto getFileInfosAsync = [guardedThis](){
+ if (!guardedThis)
+ return;
+ guardedThis->scanPending = false;
+ if (guardedThis->currentPath.isEmpty()) {
+ emit guardedThis->statusChanged(QQuickFolderListModel::Null);
+ return;
+ }
+ emit guardedThis->statusChanged(QQuickFolderListModel::Loading);
+ guardedThis->getFileInfos(guardedThis->currentPath);
+ emit guardedThis->statusChanged(QQuickFolderListModel::Ready);
+ };
+
+ QTimer::singleShot(0, getFileInfosAsync);
+}
+
+void FileInfoThread::initiateScan()
+{
+#if QT_CONFIG(thread)
+ condition.wakeAll();
+#else
+ runOnce();
+#endif
+}
void FileInfoThread::getFileInfos(const QString &path)
{
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index 438dea6faa..923cb29e03 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -99,6 +99,8 @@ public Q_SLOTS:
protected:
void run() override;
+ void runOnce();
+ void initiateScan();
void getFileInfos(const QString &path);
void findChangeRange(const QList<FileProperty> &list, int &fromIndex, int &toIndex);
@@ -106,6 +108,7 @@ private:
QMutex mutex;
QWaitCondition condition;
volatile bool abort;
+ bool scanPending;
#if QT_CONFIG(filesystemwatcher)
QFileSystemWatcher *watcher;
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 6b31dfc65d..2ed839a6e0 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -5,10 +5,10 @@ SUBDIRS += \
builtins \
qtqml \
models \
- labsmodels
+ labsmodels \
+ folderlistmodel
qtConfig(qml-worker-script): SUBDIRS += workerscript
-qtConfig(thread): SUBDIRS += folderlistmodel
qtHaveModule(sql): SUBDIRS += localstorage
qtConfig(settings): SUBDIRS += settings
qtConfig(statemachine): SUBDIRS += statemachine
diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
index 15e8e4c52c..c4ecaf367c 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
@@ -548,7 +548,7 @@ Therefore, if you create an alias to an object referenced via id with extra
properties declared inline, the extra properties won't be accessible through
the alias:
-\code
+\qml
// MyItem.qml
Item {
property alias inner: innerItem
@@ -558,23 +558,23 @@ Item {
property int extraProperty
}
}
-\code
+\endqml
You cannot initialize \a inner.extraProperty from outside of this component, as
inner is only an \a Item:
-\code
+\qml
// main.qml
MyItem {
inner.extraProperty: 5 // fails
}
-\code
+\endqml
However, if you extract the inner object into a separate component with a
dedicated .qml file, you can instantiate that component instead and have all
its properties available through the alias:
-\code
+\qml
// MainItem.qml
Item {
// Now you can access inner.extraProperty, as inner is now an ExtraItem
@@ -589,8 +589,7 @@ Item {
Item {
property int extraProperty
}
-\code
-
+\endqml
\section3 Default Properties
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index 7b885a9e9e..c832bff051 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -538,7 +538,6 @@ ReturnedValue QQmlContextWrapper::lookupIdObject(Lookup *l, ExecutionEngine *eng
ReturnedValue QQmlContextWrapper::lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
{
- Q_UNUSED(base)
Scope scope(engine);
Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
if (!qmlContext)
@@ -559,12 +558,15 @@ ReturnedValue QQmlContextWrapper::lookupScopeObjectProperty(Lookup *l, Execution
};
ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, scopeObject));
+
+ if (base)
+ *base = obj;
+
return QObjectWrapper::lookupGetterImpl(l, engine, obj, /*useOriginalProperty*/ true, revertLookup);
}
ReturnedValue QQmlContextWrapper::lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
{
- Q_UNUSED(base)
Scope scope(engine);
Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
if (!qmlContext)
@@ -589,6 +591,10 @@ ReturnedValue QQmlContextWrapper::lookupContextObjectProperty(Lookup *l, Executi
};
ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, contextObject));
+
+ if (base)
+ *base = obj;
+
return QObjectWrapper::lookupGetterImpl(l, engine, obj, /*useOriginalProperty*/ true, revertLookup);
}
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index 2ef1dc7e93..e961ed3d0d 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -104,14 +104,18 @@ QQmlThreadPrivate::MainObject::MainObject(QQmlThreadPrivate *p)
// Trigger mainEvent in main thread. Must be called from thread.
void QQmlThreadPrivate::triggerMainEvent()
{
+#if QT_CONFIG(thread)
Q_ASSERT(q->isThisThread());
+#endif
QCoreApplication::postEvent(&m_mainObject, new QEvent(QEvent::User));
}
// Trigger even in thread. Must be called from main thread.
void QQmlThreadPrivate::triggerThreadEvent()
{
+#if QT_CONFIG(thread)
Q_ASSERT(!q->isThisThread());
+#endif
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
@@ -353,6 +357,12 @@ void QQmlThread::internalCallMethodInThread(Message *message)
void QQmlThread::internalCallMethodInMain(Message *message)
{
+#if !QT_CONFIG(thread)
+ message->call(this);
+ delete message;
+ return;
+#endif
+
Q_ASSERT(isThisThread());
d->lock();
@@ -397,7 +407,9 @@ void QQmlThread::internalPostMethodToThread(Message *message)
void QQmlThread::internalPostMethodToMain(Message *message)
{
+#if QT_CONFIG(thread)
Q_ASSERT(isThisThread());
+#endif
d->lock();
bool wasEmpty = d->mainList.isEmpty();
d->mainList.append(message);
@@ -408,7 +420,9 @@ void QQmlThread::internalPostMethodToMain(Message *message)
void QQmlThread::waitForNextMessage()
{
+#if QT_CONFIG(thread)
Q_ASSERT(!isThisThread());
+#endif
d->lock();
Q_ASSERT(d->m_mainThreadWaiting == false);
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index b63ac72da9..613816e3f7 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -111,4 +111,24 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data)
return dtype.index();
}
+void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data)
+{
+ switch (type) {
+ case AutoParentRegistration:
+ QQmlMetaType::unregisterAutoParentFunction(reinterpret_cast<AutoParentFunction>(data));
+ break;
+ case QmlUnitCacheHookRegistration:
+ QQmlMetaType::removeCachedUnitLookupFunction(
+ reinterpret_cast<QmlUnitCacheLookupFunction>(data));
+ break;
+ case TypeRegistration:
+ case InterfaceRegistration:
+ case SingletonRegistration:
+ case CompositeRegistration:
+ case CompositeSingletonRegistration:
+ QQmlMetaType::unregisterType(data);
+ break;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 558b5d53c1..67fdf8847b 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -285,7 +285,7 @@ void QQmlMetaType::clearTypeRegistrations()
data->undeletableTypes.clear();
}
-int QQmlMetaType::registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent)
+int QQmlMetaType::registerAutoParentFunction(const QQmlPrivate::RegisterAutoParent &autoparent)
{
QQmlMetaTypeDataPtr data;
@@ -294,6 +294,12 @@ int QQmlMetaType::registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &au
return data->parentFunctions.count() - 1;
}
+void QQmlMetaType::unregisterAutoParentFunction(const QQmlPrivate::AutoParentFunction &function)
+{
+ QQmlMetaTypeDataPtr data;
+ data->parentFunctions.removeOne(function);
+}
+
QQmlType QQmlMetaType::registerInterface(const QQmlPrivate::RegisterInterface &type)
{
if (type.version > 0)
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 911e519cf2..c2535a7fd5 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -176,7 +176,9 @@ public:
}
}
- static int registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent);
+ static int registerAutoParentFunction(const QQmlPrivate::RegisterAutoParent &autoparent);
+ static void unregisterAutoParentFunction(const QQmlPrivate::AutoParentFunction &function);
+
static int registerUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRegistration);
static void clearTypeRegistrations();
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index a07736c6fc..eff78195d9 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -321,6 +321,7 @@ namespace QQmlPrivate
};
int Q_QML_EXPORT qmlregister(RegistrationType, void *);
+ void Q_QML_EXPORT qmlunregister(RegistrationType, quintptr);
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index c20f778a8f..95f1229b92 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1724,8 +1724,14 @@ void QQuickItemViewPrivate::refill()
void QQuickItemViewPrivate::refill(qreal from, qreal to)
{
Q_Q(QQuickItemView);
- if (!isValid() || !q->isComponentComplete())
+ if (!model || !model->isValid() || !q->isComponentComplete())
return;
+ if (!model->count()) {
+ updateHeader();
+ updateFooter();
+ updateViewport();
+ return;
+ }
do {
bufferPause.stop();
@@ -1881,15 +1887,21 @@ void QQuickItemViewPrivate::layout()
prepareVisibleItemTransitions();
- for (QList<FxViewItem*>::Iterator it = releasePendingTransition.begin();
- it != releasePendingTransition.end(); ) {
- FxViewItem *item = *it;
- if (prepareNonVisibleItemTransition(item, viewBounds)) {
- ++it;
- } else {
- releaseItem(item);
+ for (auto it = releasePendingTransition.begin(); it != releasePendingTransition.end(); ) {
+ auto old_count = releasePendingTransition.count();
+ auto success = prepareNonVisibleItemTransition(*it, viewBounds);
+ // prepareNonVisibleItemTransition() may invalidate iterators while in fast flicking
+ // invisible animating items are kicked in or out the viewPort
+ // use old_count to test if the abrupt erasure occurs
+ if (old_count > releasePendingTransition.count()) {
+ continue;
+ }
+ if (!success) {
+ releaseItem(*it);
it = releasePendingTransition.erase(it);
+ continue;
}
+ ++it;
}
for (int i=0; i<visibleItems.count(); i++)
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 860605991b..ef674f0fc7 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -287,7 +287,7 @@ public:
: item(i), moveKey(k) {}
};
QQuickItemViewTransitioner *transitioner;
- QList<FxViewItem *> releasePendingTransition;
+ QVector<FxViewItem *> releasePendingTransition;
mutable qreal minExtent;
mutable qreal maxExtent;
diff --git a/tests/auto/qml/qqmlecmascript/data/getThis.qml b/tests/auto/qml/qqmlecmascript/data/getThis.qml
new file mode 100644
index 0000000000..cd617ee3c0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/getThis.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQml 2.12
+
+QtObject {
+ id: root
+ property QtObject self;
+
+ property Timer timer: Timer {
+ running: true
+ interval: 1
+ onTriggered: {
+ root.assignThis();
+ root.self = null;
+ root.assignThis();
+ }
+ }
+
+ function getThis() {
+ return this;
+ }
+
+ function assignThis() {
+ self = getThis();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 5b73ffbe1d..d9b9c91365 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -370,6 +370,7 @@ private slots:
void undefinedPropertiesInObjectWrapper();
void hugeRegexpQuantifiers();
void singletonTypeWrapperLookup();
+ void getThisObject();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -9057,6 +9058,17 @@ void tst_qqmlecmascript::singletonTypeWrapperLookup()
QCOMPARE(test->property("secondLookup").toInt(), singleton2->testVar);
}
+void tst_qqmlecmascript::getThisObject()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("getThis.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> test(component.create());
+ QVERIFY(!test.isNull());
+
+ QTRY_COMPARE(qvariant_cast<QObject *>(test->property("self")), test.data());
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/CustomModule.pro b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/CustomModule.pro
new file mode 100644
index 0000000000..3366ddc165
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/CustomModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+TARGET = CustomModule
+QT += quick qml
+
+CONFIG += qtquickcompiler
+SOURCES += moduleplugin.cpp
+RESOURCES += moduleplugin.qrc
+
+DESTDIR = ../CustomModule
+
+IMPORT_FILES = qmldir
+
+include (../../../shared/imports.pri)
diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml
new file mode 100644
index 0000000000..ed154e3aa9
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/ModuleType.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQml 2.12
+
+QtObject {
+ objectName: "moduleType"
+}
diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp
new file mode 100644
index 0000000000..048250c730
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class ModulePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ ModulePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) {}
+ void registerTypes(const char *uri) override;
+};
+
+void ModulePlugin::registerTypes(const char *uri)
+{
+ qmlRegisterModule(uri, 1, 0);
+ qmlRegisterType(QUrl("qrc:/ModuleType.qml"), uri, 1, 0, "ModuleType");
+}
+
+QT_END_NAMESPACE
+
+#include "moduleplugin.moc"
diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.qrc b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.qrc
new file mode 100644
index 0000000000..c8f7dea691
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/moduleplugin.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>ModuleType.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/qmldir b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/qmldir
new file mode 100644
index 0000000000..f421ba44dc
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/CustomModuleImport/qmldir
@@ -0,0 +1,3 @@
+module CustomModule
+plugin CustomModule
+classname ModulePlugin
diff --git a/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro b/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro
index 90508609a8..34c49a5c0e 100644
--- a/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro
+++ b/tests/auto/qml/qqmlenginecleanup/qqmlenginecleanup.pro
@@ -1,9 +1,2 @@
-CONFIG += testcase
-TARGET = tst_qqmlenginecleanup
-macx:CONFIG -= app_bundle
-
-include (../../shared/util.pri)
-
-SOURCES += tst_qqmlenginecleanup.cpp
-
-QT += testlib qml qml-private
+TEMPLATE = subdirs
+SUBDIRS += tst_qqmlenginecleanup.pro CustomModuleImport/CustomModule.pro
diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
index b9cede6d13..690db30838 100644
--- a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
+++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
@@ -44,6 +44,7 @@ public:
private slots:
void test_qmlClearTypeRegistrations();
void test_valueTypeProviderModule(); // QTBUG-43004
+ void test_customModuleCleanup();
};
// A wrapper around QQmlComponent to ensure the temporary reference counts
@@ -168,6 +169,23 @@ void tst_qqmlenginecleanup::test_valueTypeProviderModule()
QVERIFY(noDangling);
}
+void tst_qqmlenginecleanup::test_customModuleCleanup()
+{
+ for (int i = 0; i < 5; ++i) {
+ qmlClearTypeRegistrations();
+
+ QQmlEngine engine;
+ engine.addImportPath(QT_TESTCASE_BUILDDIR);
+
+ QQmlComponent component(&engine);
+ component.setData("import CustomModule 1.0\nModuleType {}", QUrl());
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+ }
+}
+
QTEST_MAIN(tst_qqmlenginecleanup)
#include "tst_qqmlenginecleanup.moc"
diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.pro b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.pro
new file mode 100644
index 0000000000..90508609a8
--- /dev/null
+++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TARGET = tst_qqmlenginecleanup
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+
+SOURCES += tst_qqmlenginecleanup.cpp
+
+QT += testlib qml qml-private
diff --git a/tests/auto/quick/qquickanimations/data/fastFlickingBug.qml b/tests/auto/quick/qquickanimations/data/fastFlickingBug.qml
new file mode 100644
index 0000000000..b2649a801b
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/fastFlickingBug.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Window 2.11
+
+Window {
+ id: root
+ property alias timer : timer
+ property alias listView : listView
+ property alias theModel: theModel
+ property variant ops: [{'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39},
+ {'op': 'add', 'count': 30}, {'op': 'add', 'count': 60}, {'op': 'rem', 'count': 40}, {'op': 'rem', 'count': 10}, {'op': 'rem', 'count': 39}]
+ property int opIndex : 0
+ width: 400
+ height: 600
+
+ ListModel {
+ id: theModel
+ }
+
+ Timer {
+ id: timer
+ interval: 100
+ running: false
+ repeat: true
+ onTriggered: {
+ if (opIndex >= ops.length) {
+ timer.stop()
+ return
+ }
+ let op = ops[opIndex]
+ for (var i = 0; i < op.count; ++i) {
+ if (op.op === "add")
+ theModel.append({"name": "opIndex " + opIndex})
+ else
+ theModel.remove(0, 1);
+ }
+ opIndex = opIndex + 1
+ }
+ }
+
+ ListView {
+ id: listView
+ anchors.fill: parent
+ spacing: 4
+ model: theModel
+ header: Text {
+ text: "YAnimator"
+ }
+ add: Transition {
+ NumberAnimation { property: "scale"; from: 0; to: 1; duration: 200 }
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
+ }
+ displaced: Transition {
+ YAnimator { duration: 500 }
+ NumberAnimation { property: "opacity"; to: 1.0; duration: 1000 }
+ NumberAnimation { property: "scale"; to: 1.0; duration: 1000 }
+ }
+ remove: Transition {
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ NumberAnimation { property: "scale"; to: 0; duration: 200 }
+ }
+ delegate: Rectangle {
+ width: 200
+ height: 20
+ color:"red"
+ Text {
+ anchors.centerIn: parent
+ text: name
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro
index d3c5f30dcf..94f694181d 100644
--- a/tests/auto/quick/qquickanimations/qquickanimations.pro
+++ b/tests/auto/quick/qquickanimations/qquickanimations.pro
@@ -27,6 +27,7 @@ OTHER_FILES += \
data/dotproperty.qml \
data/Double.qml \
data/doubleRegistrationBug.qml \
+ data/fastFlickingBug.qml \
data/looping.qml \
data/mixedtype1.qml \
data/mixedtype2.qml \
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index f5faa14265..48f779a490 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -40,6 +40,7 @@
#include <QtQuick/private/qquickanimatorjob_p.h>
#include <QtQuick/private/qquickpathinterpolator_p.h>
#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicklistview_p.h>
#include <QEasingCurve>
#include <limits.h>
@@ -110,6 +111,7 @@ private slots:
void finished();
void replacingTransitions();
void animationJobSelfDestruction();
+ void fastFlickingBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1744,6 +1746,34 @@ void tst_qquickanimations::animationJobSelfDestruction()
QTest::qWait(1000);
}
+void tst_qquickanimations::fastFlickingBug()
+{
+ // Don't crash
+ QQmlEngine engine;
+ engine.clearComponentCache();
+ QQmlComponent c(&engine, testFileUrl("fastFlickingBug.qml"));
+ QScopedPointer<QQuickWindow> win(qobject_cast<QQuickWindow*>(c.create()));
+ if (!c.errors().isEmpty())
+ qDebug() << c.errorString();
+ QVERIFY(win);
+ win->setTitle(QTest::currentTestFunction());
+ win->show();
+ QVERIFY(QTest::qWaitForWindowExposed(win.data()));
+ auto timer = win->property("timer").value<QQmlTimer*>();
+ QVERIFY(timer);
+ QCOMPARE(timer->isRunning(), false);
+ auto listView = win->property("listView").value<QQuickFlickable*>();
+ QVERIFY(listView);
+ timer->start();
+ // flick listView up and down quickly in the middle of a slow transition
+ for (int sign = 1; timer->isRunning(); sign *= -1) {
+ listView->flick(0, sign * 4000);
+ qApp->processEvents();
+ QTest::qWait(53);
+ qApp->processEvents();
+ }
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"
diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST
index 6598323e22..1f3736328a 100644
--- a/tests/auto/quick/qquicklistview/BLACKLIST
+++ b/tests/auto/quick/qquicklistview/BLACKLIST
@@ -7,5 +7,8 @@ opensuse-42.1
[contentHeightWithDelayRemove]
osx-10.12
#QTBUG-75960
+#QTBUG-76652
[currentIndex]
osx-10.12
+opensuse-leap
+ubuntu-18.04
diff --git a/tests/auto/quick/qquicklistview/data/footer2.qml b/tests/auto/quick/qquicklistview/data/footer2.qml
new file mode 100644
index 0000000000..bba74d89f7
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/footer2.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ Timer {
+ running: true
+ repeat: false
+ interval: 100
+ onTriggered: {
+ list.model -= 3;
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ model: 3
+ delegate: Rectangle {
+ color: "red"
+ width: 240
+ height: 10
+ }
+ footer: Rectangle {
+ color: "blue"
+ width: 240
+ height: 10
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 7d5ad1b604..f14a6e75f6 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -153,6 +153,7 @@ private slots:
void headerChangesViewport();
void footer();
void footer_data();
+ void footer2();
void extents();
void extents_data();
void resetModel_headerFooter();
@@ -4139,6 +4140,21 @@ void tst_QQuickListView::footer_data()
<< QPointF(0, -(30 * 20) - 10);
}
+void tst_QQuickListView::footer2() // QTBUG-31677
+{
+ QQuickView *window = getView();
+ window->setSource(testFileUrl("footer2.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != nullptr);
+
+ QQuickItem *footer = listview->footerItem();
+ QVERIFY(footer != nullptr);
+ QTRY_COMPARE(footer->y(), 0.0);
+}
+
class LVAccessor : public QQuickListView
{
public:
diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp
index 5b8fc34455..4fbbb27afb 100644
--- a/tools/qmlcachegen/generateloader.cpp
+++ b/tools/qmlcachegen/generateloader.cpp
@@ -365,6 +365,7 @@ bool generateLoader(const QStringList &compiledFiles, const QStringList &sortedR
stream << "struct Registry {\n";
stream << " Registry();\n";
+ stream << " ~Registry();\n";
stream << " QHash<QString, const QQmlPrivate::CachedQmlUnit*> resourcePathToCachedUnit;\n";
stream << " static const QQmlPrivate::CachedQmlUnit *lookupCachedUnit(const QUrl &url);\n";
stream << "};\n\n";
@@ -387,7 +388,11 @@ bool generateLoader(const QStringList &compiledFiles, const QStringList &sortedR
if (!resourceRegisterCall.isEmpty())
stream << resourceRegisterCall;
- stream << "}\n";
+ stream << "}\n\n";
+ stream << "Registry::~Registry() {\n";
+ stream << " QQmlPrivate::qmlunregister(QQmlPrivate::QmlUnitCacheHookRegistration, quintptr(&lookupCachedUnit));\n";
+ stream << "}\n\n";
+
stream << "const QQmlPrivate::CachedQmlUnit *Registry::lookupCachedUnit(const QUrl &url) {\n";
stream << " if (url.scheme() != QLatin1String(\"qrc\"))\n";
stream << " return nullptr;\n";
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 312b180df5..d3b8b9ba99 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -481,6 +481,12 @@ int main(int argc, char ** argv)
options.applicationAttributes.append(Qt::AA_EnableHighDpiScaling);
} else if (!qstrcmp(arg, "--no-scaling")) {
options.applicationAttributes.append(Qt::AA_DisableHighDpiScaling);
+ } else if (!qstrcmp(arg, "--transparent")) {
+ options.transparent = true;
+ } else if (!qstrcmp(arg, "--multisample")) {
+ options.multisample = true;
+ } else if (!qstrcmp(arg, "--core-profile")) {
+ options.coreProfile = true;
} else if (!qstrcmp(arg, "--apptype")) {
if (++i >= argc)
usage();
@@ -489,6 +495,23 @@ int main(int argc, char ** argv)
}
}
+ if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE"))
+ options.coreProfile = true;
+
+ // Set default surface format before creating the window
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setStencilBufferSize(8);
+ surfaceFormat.setDepthBufferSize(24);
+ if (options.multisample)
+ surfaceFormat.setSamples(16);
+ if (options.transparent)
+ surfaceFormat.setAlphaBufferSize(8);
+ if (options.coreProfile) {
+ surfaceFormat.setVersion(4, 1);
+ surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
+ }
+ QSurfaceFormat::setDefaultFormat(surfaceFormat);
+
for (Qt::ApplicationAttribute a : qAsConst(options.applicationAttributes))
QCoreApplication::setAttribute(a);
QScopedPointer<QGuiApplication> app;
@@ -503,9 +526,6 @@ int main(int argc, char ** argv)
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE"))
- options.coreProfile = true;
-
const QStringList arguments = QCoreApplication::arguments();
for (int i = 1, size = arguments.size(); i < size; ++i) {
if (!arguments.at(i).startsWith(QLatin1Char('-'))) {
@@ -516,8 +536,6 @@ int main(int argc, char ** argv)
options.maximized = true;
else if (lowerArgument == QLatin1String("--fullscreen"))
options.fullscreen = true;
- else if (lowerArgument == QLatin1String("--transparent"))
- options.transparent = true;
else if (lowerArgument == QLatin1String("--clip"))
options.clip = true;
else if (lowerArgument == QLatin1String("--no-version-detection"))
@@ -530,10 +548,6 @@ int main(int argc, char ** argv)
options.translationFile = QLatin1String(argv[++i]);
else if (lowerArgument == QLatin1String("--resize-to-root"))
options.resizeViewToRootItem = true;
- else if (lowerArgument == QLatin1String("--multisample"))
- options.multisample = true;
- else if (lowerArgument == QLatin1String("--core-profile"))
- options.coreProfile = true;
else if (lowerArgument == QLatin1String("--verbose"))
options.verbose = true;
else if (lowerArgument == QLatin1String("-i") && i + 1 < size)
@@ -627,18 +641,6 @@ int main(int argc, char ** argv)
return -1;
}
- // Set default surface format before creating the window
- QSurfaceFormat surfaceFormat;
- if (options.multisample)
- surfaceFormat.setSamples(16);
- if (options.transparent)
- surfaceFormat.setAlphaBufferSize(8);
- if (options.coreProfile) {
- surfaceFormat.setVersion(4, 1);
- surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
- }
- QSurfaceFormat::setDefaultFormat(surfaceFormat);
-
QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(topLevel));
if (window) {
engine.setIncubationController(window->incubationController());