diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-20 16:25:19 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-20 16:25:19 +0200 |
commit | f9efc67bb83c6afcc2290fdb80ef2c0c48cc1570 (patch) | |
tree | 52c8985fc0e2e64073d013826e79a5f63fdc5e93 | |
parent | af0d8632d8895373287bdf8f917272a0fa1820e0 (diff) | |
parent | ecc092fa5519e77a47ef560f0137b4cd5f417c5e (diff) |
Merge remote-tracking branch 'origin/5.13.0' into 5.13
Change-Id: I55353d8cee5420e0c9f59c3b3a387b461f1abf99
-rw-r--r-- | dist/changes-5.13.0 | 98 | ||||
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread.cpp | 58 | ||||
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread_p.h | 3 | ||||
-rw-r--r-- | src/imports/imports.pro | 2 | ||||
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 14 |
5 files changed, 162 insertions, 13 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 24e93fec1c..54e52b1103 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -6,7 +6,7 @@ SUBDIRS += \ models \ labsmodels -qtConfig(thread): SUBDIRS += folderlistmodel +SUBDIRS += folderlistmodel qtHaveModule(sql): SUBDIRS += localstorage qtConfig(settings): SUBDIRS += settings qtConfig(statemachine): SUBDIRS += statemachine 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); |