diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-28 07:34:06 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-28 07:34:06 +0200 |
commit | f6ab93a9f96b163cb82f4a2c0971d4fd5cc81fb4 (patch) | |
tree | a4f77a581a2ac38ff1617d046c8c37abc741a117 /src | |
parent | 0ae01dec7aa0ffbb59e6e947bfa2e73ae030346a (diff) | |
parent | 8577f12bf4dfd9adfe8c5b85a3712bf1cc5ba0c3 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I0ae0a162e133cffd8fb1a2c6b70826e50f06facd
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 7 | ||||
-rw-r--r-- | src/qml/util/qqmlpropertymap.cpp | 4 | ||||
-rw-r--r-- | src/quick/handlers/qquickhoverhandler.cpp | 24 | ||||
-rw-r--r-- | src/quick/items/qquickgridview.cpp | 24 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 23 |
6 files changed, 79 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index f5c5c49f56..3002945945 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1778,6 +1778,13 @@ ReturnedValue ExecutionEngine::global() QQmlRefPointer<CompiledData::CompilationUnit> ExecutionEngine::compileModule(const QUrl &url) { + QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError; + if (const QV4::CompiledData::Unit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(url, &cacheError)) { + QQmlRefPointer<QV4::CompiledData::CompilationUnit> jsUnit; + jsUnit.adopt(new QV4::CompiledData::CompilationUnit(cachedUnit, url.fileName(), url.toString())); + return jsUnit; + } + QFile f(QQmlFile::urlToLocalFileOrQrc(url)); if (!f.open(QIODevice::ReadOnly)) { throwError(QStringLiteral("Could not open module %1 for reading").arg(url.toString())); diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index 3f78ca6b69..82f048d9d9 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -180,6 +180,10 @@ int QQmlPropertyMapMetaObject::createProperty(const char *name, const char *valu \note When deriving a class from QQmlPropertyMap, use the \l {QQmlPropertyMap::QQmlPropertyMap(DerivedType *derived, QObject *parent)} {protected two-argument constructor} which ensures that the class is correctly registered with the Qt \l {Meta-Object System}. + + \note The QMetaObject of a QQmlPropertyMap is dynamically generated and modified. + Operations on that meta object are not thread safe, so applications need to take + care to explicitly synchronize access to the meta object. */ /*! diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp index d7566f0cd8..a6325e084b 100644 --- a/src/quick/handlers/qquickhoverhandler.cpp +++ b/src/quick/handlers/qquickhoverhandler.cpp @@ -47,14 +47,24 @@ Q_LOGGING_CATEGORY(lcHoverHandler, "qt.quick.handler.hover") /*! \qmltype HoverHandler \instantiates QQuickHoverHandler + \inherits SinglePointHandler \inqmlmodule QtQuick \ingroup qtquick-input-handlers \brief Handler for mouse and tablet hover. - HoverHandler detects a hovering cursor. Since touchscreens don't generally - offer hover events, in practice it detects a hovering mouse or tablet stylus. + HoverHandler detects a hovering mouse or tablet stylus cursor. - \sa MouseArea + A binding to the \l hovered property is the easiest way to react when the + cursor enters or leaves the \l {PointerHandler::parent}{parent} Item. + The \l {SinglePointHandler::point}{point} property provides more detail, + including the cursor position. The + \l {PointerDeviceHandler::acceptedDevices}{acceptedDevices}, + \l {PointerDeviceHandler::acceptedPointerTypes}{acceptedPointerTypes}, + and \l {PointerDeviceHandler::acceptedModifiers}{acceptedModifiers} + properties can be used to narrow the behavior to detect hovering of + specific kinds of devices or while holding a modifier key. + + \sa MouseArea, PointHandler */ QQuickHoverHandler::QQuickHoverHandler(QQuickItem *parent) @@ -97,6 +107,14 @@ void QQuickHoverHandler::handleEventPoint(QQuickEventPoint *point) setPassiveGrab(point); } +/*! + \qmlproperty bool QtQuick::HoverHandler::hovered + \readonly + + Holds true whenever any pointing device cursor (mouse or tablet) is within + the bounds of the \c parent Item, extended by the + \l {PointerHandler::margin}{margin}, if any. +*/ void QQuickHoverHandler::setHovered(bool hovered) { if (m_hovered != hovered) { diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index fecfa5fd2d..e69e9cff46 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1761,7 +1761,7 @@ void QQuickGridView::setSnapMode(SnapMode mode) \list \li The view is first created - \li The view's \l model changes + \li The view's \l model changes in such a way that the visible delegates are completely replaced \li The view's \l model is \l {QAbstractItemModel::reset()}{reset}, if the model is a QAbstractItemModel subclass \endlist @@ -1779,6 +1779,28 @@ void QQuickGridView::setSnapMode(SnapMode mode) When the view is initialized, the view will create all the necessary items for the view, then animate them to their correct positions within the view over one second. + However when scrolling the view later, the populate transition does not + run, even though delegates are being instantiated as they become visible. + When the model changes in a way that new delegates become visible, the + \l add transition is the one that runs. So you should not depend on the + \c populate transition to initialize properties in the delegate, because it + does not apply to every delegate. If your animation sets the \c to value of + a property, the property should initially have the \c to value, and the + animation should set the \c from value in case it is animated: + + \code + GridView { + ... + delegate: Rectangle { + opacity: 1 // not necessary because it's the default; but don't set 0 + ... + } + populate: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 } + } + } + \endcode + For more details and examples on how to use view transitions, see the ViewTransition documentation. diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index ddd438e56d..77bcf2583c 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -465,7 +465,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qRegisterMetaType<QQuickHandlerPoint>(); // The rest of the 5.12 revisions +#if QT_CONFIG(quick_sprite) qmlRegisterType<QQuickAnimatedSprite, 12>("QtQuick", 2, 12, "AnimatedSprite"); +#endif qmlRegisterType<QQuickGradient, 12>(uri, 2, 12, "Gradient"); qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); qmlRegisterType<QQuickText, 12>(uri, 2, 12, "Text"); diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 146917c679..8b70ffd0d7 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2727,7 +2727,7 @@ void QQuickListView::setFooterPositioning(QQuickListView::FooterPositioning posi \list \li The view is first created - \li The view's \l model changes + \li The view's \l model changes in such a way that the visible delegates are completely replaced \li The view's \l model is \l {QAbstractItemModel::reset()}{reset}, if the model is a QAbstractItemModel subclass \endlist @@ -2745,6 +2745,27 @@ void QQuickListView::setFooterPositioning(QQuickListView::FooterPositioning posi When the view is initialized, the view will create all the necessary items for the view, then animate them to their correct positions within the view over one second. + However when scrolling the view later, the populate transition does not + run, even though delegates are being instantiated as they become visible. + When the model changes in a way that new delegates become visible, the + \l add transition is the one that runs. So you should not depend on the + \c populate transition to initialize properties in the delegate, because it + does not apply to every delegate. If your animation sets the \c to value of + a property, the property should initially have the \c to value, and the + animation should set the \c from value in case it is animated: + + \code + ListView { + ... + delegate: Rectangle { + opacity: 1 // not necessary because it's the default + } + populate: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 } + } + } + \endcode + For more details and examples on how to use view transitions, see the ViewTransition documentation. |