diff options
author | Liang Qi <liang.qi@qt.io> | 2016-12-14 19:01:23 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-12-14 19:01:23 +0100 |
commit | 0e80d28aa5892d6bbb4d0017b1bc9a33489f4176 (patch) | |
tree | 0db2e10c8776d172bccaeaa7ee1fab3934b93073 /src/imports | |
parent | ed32558d6280cae40578f735fd326327d571d993 (diff) | |
parent | 16c81bb0d493af00bc376784bcb7e03a4a037b04 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
src/qml/qml/qqmlimport.cpp
src/quick/items/context2d/qquickcontext2dtexture_p.h
tools/qmleasing/splineeditor.h
Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread.cpp | 16 | ||||
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread_p.h | 4 | ||||
-rw-r--r-- | src/imports/folderlistmodel/plugin.cpp | 2 | ||||
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 6 | ||||
-rw-r--r-- | src/imports/layouts/qquicklayout.cpp | 32 | ||||
-rw-r--r-- | src/imports/layouts/qquicklayout_p.h | 4 | ||||
-rw-r--r-- | src/imports/layouts/qquicklinearlayout.cpp | 54 | ||||
-rw-r--r-- | src/imports/layouts/qquicklinearlayout_p.h | 9 | ||||
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 6 | ||||
-rw-r--r-- | src/imports/testlib/SignalSpy.qml | 10 |
10 files changed, 75 insertions, 68 deletions
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index 0b62935f87..d3e256bb7e 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -46,7 +46,7 @@ FileInfoThread::FileInfoThread(QObject *parent) : QThread(parent), abort(false), -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher(0), #endif sortFlags(QDir::Name), @@ -61,11 +61,11 @@ FileInfoThread::FileInfoThread(QObject *parent) showOnlyReadable(false), caseSensitive(true) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); -#endif // !QT_NO_FILESYSTEMWATCHER +#endif // filesystemwatcher } FileInfoThread::~FileInfoThread() @@ -80,7 +80,7 @@ FileInfoThread::~FileInfoThread() void FileInfoThread::clear() { QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher->removePaths(watcher->files()); watcher->removePaths(watcher->directories()); #endif @@ -89,7 +89,7 @@ void FileInfoThread::clear() void FileInfoThread::removePath(const QString &path) { QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (!path.startsWith(QLatin1Char(':'))) watcher->removePath(path); #else @@ -103,7 +103,7 @@ void FileInfoThread::setPath(const QString &path) Q_ASSERT(!path.isEmpty()); QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (!path.startsWith(QLatin1Char(':'))) watcher->addPath(path); #endif @@ -120,7 +120,7 @@ void FileInfoThread::setRootPath(const QString &path) rootPath = path; } -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void FileInfoThread::dirChanged(const QString &directoryPath) { Q_UNUSED(directoryPath); @@ -204,7 +204,7 @@ void FileInfoThread::setCaseSensitive(bool on) condition.wakeAll(); } -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void FileInfoThread::updateFile(const QString &path) { Q_UNUSED(path); diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h index 56058fd6be..b505ece750 100644 --- a/src/imports/folderlistmodel/fileinfothread_p.h +++ b/src/imports/folderlistmodel/fileinfothread_p.h @@ -88,7 +88,7 @@ public: void setCaseSensitive(bool on); public Q_SLOTS: -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void dirChanged(const QString &directoryPath); void updateFile(const QString &path); #endif @@ -103,7 +103,7 @@ private: QWaitCondition condition; volatile bool abort; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QFileSystemWatcher *watcher; #endif QList<FileProperty> currentFileList; diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index affde1c3aa..ef719109bd 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -62,12 +62,10 @@ public: void registerTypes(const char *uri) Q_DECL_OVERRIDE { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel")); -#ifndef QT_NO_DIRMODEL qmlRegisterType<QQuickFolderListModel>(uri,1,0,"FolderListModel"); qmlRegisterType<QQuickFolderListModel>(uri,2,0,"FolderListModel"); qmlRegisterType<QQuickFolderListModel,1>(uri,2,1,"FolderListModel"); qmlRegisterType<QQuickFolderListModel,2>(uri,2,2,"FolderListModel"); -#endif } }; //![class decl] diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 1c94fddecf..fdcce9c685 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -447,9 +447,9 @@ void QQuickFolderListModel::setFolder(const QUrl &folder) /*! \qmlproperty url FolderListModel::rootFolder - When the rootFolder is set, then this folder will - be threated as the root in the file system, so that - you can only travers sub folders from this rootFolder. + When this property is set, the given folder will + be treated as the root in the file system, so that + you can only traverse subfolders within it. */ QUrl QQuickFolderListModel::rootFolder() const { diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp index 07ada75a5f..3786d21727 100644 --- a/src/imports/layouts/qquicklayout.cpp +++ b/src/imports/layouts/qquicklayout.cpp @@ -763,18 +763,14 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value) { if (change == ItemChildAddedChange) { QQuickItem *item = value.item; - qmlobject_connect(item, QQuickItem, SIGNAL(implicitWidthChanged()), this, QQuickLayout, SLOT(invalidateSenderItem())); - qmlobject_connect(item, QQuickItem, SIGNAL(implicitHeightChanged()), this, QQuickLayout, SLOT(invalidateSenderItem())); qmlobject_connect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem())); - QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::SiblingOrder); + QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility); if (isReady()) updateLayoutItems(); } else if (change == ItemChildRemovedChange) { QQuickItem *item = value.item; - qmlobject_disconnect(item, QQuickItem, SIGNAL(implicitWidthChanged()), this, QQuickLayout, SLOT(invalidateSenderItem())); - qmlobject_disconnect(item, QQuickItem, SIGNAL(implicitHeightChanged()), this, QQuickLayout, SLOT(invalidateSenderItem())); qmlobject_disconnect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem())); - QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder); + QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility); if (isReady()) updateLayoutItems(); } @@ -812,6 +808,30 @@ void QQuickLayout::itemSiblingOrderChanged(QQuickItem *item) updateLayoutItems(); } +void QQuickLayout::itemImplicitWidthChanged(QQuickItem *item) +{ + if (!isReady() || item->signalsBlocked()) + return; + invalidate(item); +} + +void QQuickLayout::itemImplicitHeightChanged(QQuickItem *item) +{ + if (!isReady() || item->signalsBlocked()) + return; + invalidate(item); +} + +void QQuickLayout::itemDestroyed(QQuickItem *item) +{ + Q_UNUSED(item); +} + +void QQuickLayout::itemVisibilityChanged(QQuickItem *item) +{ + Q_UNUSED(item); +} + void QQuickLayout::rearrange(const QSizeF &/*size*/) { m_dirty = false; diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h index c7f04c1fed..eece6f8658 100644 --- a/src/imports/layouts/qquicklayout_p.h +++ b/src/imports/layouts/qquicklayout_p.h @@ -99,6 +99,10 @@ public: /* QQuickItemChangeListener */ void itemSiblingOrderChanged(QQuickItem *item) Q_DECL_OVERRIDE; + void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE; + void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE; + void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE; + void itemVisibilityChanged(QQuickItem *item) Q_DECL_OVERRIDE; protected: void updatePolish() Q_DECL_OVERRIDE; diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index 7fad395a29..13fdd496c2 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -303,17 +303,13 @@ QQuickGridLayoutBase::~QQuickGridLayoutBase() { Q_D(QQuickGridLayoutBase); - /* Avoid messy deconstruction, should give: - * Faster deconstruction - * Less risk of signals reaching already deleted objects - */ + // Remove item listeners so we do not act on signalling unnecessarily + // (there is no point, as the layout will be torn down anyway). for (int i = 0; i < itemCount(); ++i) { QQuickItem *item = itemAt(i); - qmlobject_disconnect(item, QQuickItem, SIGNAL(destroyed()), this, QQuickGridLayoutBase, SLOT(onItemDestroyed())); - qmlobject_disconnect(item, QQuickItem, SIGNAL(visibleChanged()), this, QQuickGridLayoutBase, SLOT(onItemVisibleChanged())); - qmlobject_disconnect(item, QQuickItem, SIGNAL(implicitWidthChanged()), this, QQuickGridLayoutBase, SLOT(invalidateSenderItem())); - qmlobject_disconnect(item, QQuickItem, SIGNAL(implicitHeightChanged()), this, QQuickGridLayoutBase, SLOT(invalidateSenderItem())); + QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility); } + delete d->styleInfo; } @@ -436,23 +432,6 @@ int QQuickGridLayoutBase::itemCount() const return d->engine.itemCount(); } -void QQuickGridLayoutBase::itemChange(ItemChange change, const ItemChangeData &value) -{ - if (change == ItemChildAddedChange) { - quickLayoutDebug() << "ItemChildAddedChange"; - QQuickItem *item = value.item; - qmlobject_connect(item, QQuickItem, SIGNAL(destroyed()), this, QQuickGridLayoutBase, SLOT(onItemDestroyed())); - qmlobject_connect(item, QQuickItem, SIGNAL(visibleChanged()), this, QQuickGridLayoutBase, SLOT(onItemVisibleChanged())); - } else if (change == ItemChildRemovedChange) { - quickLayoutDebug() << "ItemChildRemovedChange"; - QQuickItem *item = value.item; - qmlobject_disconnect(item, QQuickItem, SIGNAL(destroyed()), this, QQuickGridLayoutBase, SLOT(onItemDestroyed())); - qmlobject_disconnect(item, QQuickItem, SIGNAL(visibleChanged()), this, QQuickGridLayoutBase, SLOT(onItemVisibleChanged())); - } - - QQuickLayout::itemChange(change, value); -} - void QQuickGridLayoutBase::removeGridItem(QGridLayoutItem *gridItem) { Q_D(QQuickGridLayoutBase); @@ -461,28 +440,29 @@ void QQuickGridLayoutBase::removeGridItem(QGridLayoutItem *gridItem) d->engine.removeRows(index, 1, d->orientation); } -void QQuickGridLayoutBase::onItemVisibleChanged() -{ - if (!isReady()) - return; - quickLayoutDebug() << "QQuickGridLayoutBase::onItemVisibleChanged"; - updateLayoutItems(); -} - -void QQuickGridLayoutBase::onItemDestroyed() +void QQuickGridLayoutBase::itemDestroyed(QQuickItem *item) { if (!isReady()) return; Q_D(QQuickGridLayoutBase); - quickLayoutDebug() << "QQuickGridLayoutBase::onItemDestroyed"; - QQuickItem *inDestruction = static_cast<QQuickItem *>(sender()); - if (QQuickGridLayoutItem *gridItem = d->engine.findLayoutItem(inDestruction)) { + quickLayoutDebug() << "QQuickGridLayoutBase::itemDestroyed"; + if (QQuickGridLayoutItem *gridItem = d->engine.findLayoutItem(item)) { removeGridItem(gridItem); delete gridItem; invalidate(); } } +void QQuickGridLayoutBase::itemVisibilityChanged(QQuickItem *item) +{ + Q_UNUSED(item); + + if (!isReady()) + return; + quickLayoutDebug() << "QQuickGridLayoutBase::itemVisibilityChanged"; + updateLayoutItems(); +} + void QQuickGridLayoutBase::rearrange(const QSizeF &size) { Q_D(QQuickGridLayoutBase); diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h index ca8b867824..b425df0fa4 100644 --- a/src/imports/layouts/qquicklinearlayout_p.h +++ b/src/imports/layouts/qquicklinearlayout_p.h @@ -77,6 +77,10 @@ public: Qt::LayoutDirection effectiveLayoutDirection() const; void setAlignment(QQuickItem *item, Qt::Alignment align) Q_DECL_OVERRIDE; + /* QQuickItemChangeListener */ + void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE; + void itemVisibilityChanged(QQuickItem *item) Q_DECL_OVERRIDE; + protected: void updateLayoutItems() Q_DECL_OVERRIDE; QQuickItem *itemAt(int index) const Q_DECL_OVERRIDE; @@ -84,15 +88,10 @@ protected: void rearrange(const QSizeF &size) Q_DECL_OVERRIDE; virtual void insertLayoutItems() {} - void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE; signals: Q_REVISION(1) void layoutDirectionChanged(); -protected slots: - void onItemVisibleChanged(); - void onItemDestroyed(); - private: void removeGridItem(QGridLayoutItem *gridItem); Q_DECLARE_PRIVATE(QQuickGridLayoutBase) diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index b8fd307215..ebffb07346 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -449,7 +449,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx) if (ok) { *w->d()->version = to_version; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(), scope.engine) + QLatin1String(".ini"), QSettings::IniFormat); ini.setValue(QLatin1String("Version"), to_version); #endif @@ -700,7 +700,7 @@ public: void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) QV4::Scope scope(args->v4engine()); if (scope.engine->qmlEngine()->offlineStoragePath().isEmpty()) V4THROW_SQL2(SQLEXCEPTION_DATABASE_ERR, QQmlEngine::tr("SQL: can't create database, offline storage is disabled.")); @@ -770,7 +770,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) } args->setReturnValue(db.asReturnedValue()); -#endif // QT_NO_SETTINGS +#endif // settings } static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml index 200fc725f7..8a8e844a21 100644 --- a/src/imports/testlib/SignalSpy.qml +++ b/src/imports/testlib/SignalSpy.qml @@ -230,8 +230,14 @@ Item { qtest_prevSignalName = "" } if (target != null && signalName != "") { - var handlerName = qtest_signalHandlerName(signalName) - var func = target[handlerName] + // Look for the signal name in the object + var func = target[signalName] + if (typeof func !== "function") { + // If it is not a function, try looking for signal handler + // i.e. (onSignal) this is needed for cases where there is a property + // and a signal with the same name, e.g. Mousearea.pressed + func = target[qtest_signalHandlerName(signalName)] + } if (func === undefined) { spy.qtest_valid = false console.log("Signal '" + signalName + "' not found") |