diff options
author | Tarja Sundqvist <[email protected]> | 2024-06-06 07:06:25 +0300 |
---|---|---|
committer | Tarja Sundqvist <[email protected]> | 2024-06-06 07:06:25 +0300 |
commit | a1b4a68d1165115779ac925f43847a5735671917 (patch) | |
tree | f6f0ceefd145a6c1ae154f1c686b9e4474e1ae4f | |
parent | 9919f58fce6329a233ca885188d0aba5f484e546 (diff) | |
parent | cd38b4eafa3b0cf637be55ad85a94d4849b85d97 (diff) |
Merge tag 'v6.2.9-lts' into tqtc/lts-6.2-opensourcev6.2.9-lts-lgpl
Qt 6.2.9-lts release
Conflicts solved:
dependencies.yaml
Change-Id: If2cf4ac99b3e70b6a875b00cc4c3e7766b361a08
119 files changed, 2582 insertions, 1083 deletions
diff --git a/.cmake.conf b/.cmake.conf index e62fae5ef9..beccb22d04 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,2 +1,2 @@ -set(QT_REPO_MODULE_VERSION "6.2.8") +set(QT_REPO_MODULE_VERSION "6.2.9") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "") diff --git a/.qmake.conf b/.qmake.conf index 3745dab334..1763149193 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -5,4 +5,4 @@ DEFINES += QT_NO_JAVA_STYLE_ITERATORS QQC2_SOURCE_TREE = $$PWD -MODULE_VERSION = 6.2.8 +MODULE_VERSION = 6.2.9 diff --git a/dependencies.yaml b/dependencies.yaml index 913c9cc4ed..aae176b1e8 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../tqtc-qtbase: - ref: 4c1c38dede55565afa846685b3e19cf8f1cfed0c + ref: f131837a9fcc83dcfb70a0a91b1baacb6ccf14a2 required: true ../tqtc-qtimageformats: - ref: 32cb114cc13943bd91a5a12f1bfa0b8cb55c7057 + ref: a9b81ef5a5e38002fc45ce3aa24756b660cd1f70 required: false ../tqtc-qtshadertools: - ref: 754297822b244b98494e5ab09ca024a2e7acb54a + ref: c0efa3c44c056e1307e25ad8f3dd6db6f19ef135 required: false ../tqtc-qtsvg: - ref: 77d01e492bafaa842bce76201f3df014c80a0c92 + ref: 21a1c892e0cabdd9161d87efa815145ddc3f7f70 required: false diff --git a/src/3rdparty/masm/wtf/Platform.h b/src/3rdparty/masm/wtf/Platform.h index 29decfadcf..5c83dec2b9 100644 --- a/src/3rdparty/masm/wtf/Platform.h +++ b/src/3rdparty/masm/wtf/Platform.h @@ -224,6 +224,7 @@ || defined(__ARM_ARCH_6K__) \ || defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6KZ__) \ || defined(__ARM_ARCH_6T2__) \ || defined(__ARMV6__) #define WTF_ARM_ARCH_VERSION 6 diff --git a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp index 33206e5fe6..b86ddfe397 100644 --- a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp @@ -563,15 +563,14 @@ void QQuickFolderListModel::componentComplete() /*! \qmlproperty enumeration FolderListModel::sortField - The \a sortField property contains field to use for sorting. sortField - may be one of: - \list - \li Unsorted - no sorting is applied. - \li Name - sort by filename - \li Time - sort by time modified - \li Size - sort by file size - \li Type - sort by file type (extension) - \endlist + The \a sortField property contains the field to use for sorting. + \c sortField may be one of: + + \value Unsorted no sorting is applied + \value Name sort by filename + \value Time sort by time modified + \value Size sort by file size + \value Type sort by file type (extension) \sa sortReversed */ @@ -821,11 +820,10 @@ void QQuickFolderListModel::setCaseSensitive(bool on) \since 5.11 This property holds the status of folder reading. It can be one of: - \list - \li FolderListModel.Null - no \a folder has been set - \li FolderListModel.Ready - the folder has been loaded - \li FolderListModel.Loading - the folder is currently being loaded - \endlist + + \value FolderListModel.Null no \a folder has been set + \value FolderListModel.Ready the folder has been loaded + \value FolderListModel.Loading the folder is currently being loaded Use this status to provide an update or respond to the status change in some way. For example, you could: diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index 750c0446c8..75e710cdb3 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -687,13 +687,12 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) For fine-grained control, see sizeTable and opacityTable. Acceptable values are - \list - \li ImageParticle.None: Particles just appear and disappear. - \li ImageParticle.Fade: Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end. - \li ImageParticle.Scale: Particles scale in from 0 size at the start of their life, and scale back to 0 at the end. - \endlist - Default value is Fade. + \value ImageParticle.None Particles just appear and disappear. + \value ImageParticle.Fade Particles fade in from 0 opacity at the start of their life, and fade out to 0 at the end. + \value ImageParticle.Scale Particles scale in from 0 size at the start of their life, and scale back to 0 at the end. + + The default value is \c ImageParticle.Fade. */ /*! \qmlproperty bool QtQuick.Particles::ImageParticle::spritesInterpolate diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h index 7c3dab98c2..fc7f6f5fb3 100644 --- a/src/qml/qml/qqmlbinding_p.h +++ b/src/qml/qml/qqmlbinding_p.h @@ -115,6 +115,10 @@ public: }; QVariant evaluate(); + bool evaluate(void *result, QMetaType type) + { + return QQmlJavaScriptExpression::evaluate(&result, &type, 0); + } void expressionChanged() override; @@ -150,10 +154,6 @@ protected: QQmlPropertyData::WriteFlags flags); QV4::ReturnedValue evaluate(bool *isUndefined); - bool evaluate(void *result, QMetaType type) - { - return QQmlJavaScriptExpression::evaluate(&result, &type, 0); - } private: inline bool updatingFlag() const; diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 80f8c88973..6261e8b510 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -381,7 +381,12 @@ bool QQmlComponentPrivate::setInitialProperty(QObject *component, const QString& QQmlProperty prop = QQmlComponentPrivate::removePropertyFromRequired(component, name, requiredProperties()); QQmlPropertyPrivate *privProp = QQmlPropertyPrivate::get(prop); const bool isValid = prop.isValid(); - if (!isValid || !privProp->writeValueProperty(value, {})) { + if (isValid && privProp->writeValueProperty(value, {})) { + if (prop.isBindable()) { + if (QQmlObjectCreator *creator = state.creator.data()) + creator->removePendingBinding(prop.object(), prop.index()); + } + } else { QQmlError error{}; error.setUrl(url); if (isValid) @@ -391,8 +396,9 @@ bool QQmlComponentPrivate::setInitialProperty(QObject *component, const QString& QQmlMetaType::prettyTypeName(component))); state.errors.push_back(error); return false; - } else - return true; + } + + return true; } /*! @@ -436,13 +442,11 @@ QQmlComponent::~QQmlComponent() This property holds the status of component loading. The status can be one of the following: - \list - \li \c{Component.Null} - no data is available for the component - \li \c{Component.Ready} - the component has been loaded, and can be used to create instances. - \li \c{Component.Loading} - the component is currently being loaded - \li \c{Component.Error} - an error occurred while loading the component. + \value Component.Null no data is available for the component + \value Component.Ready the component has been loaded, and can be used to create instances. + \value Component.Loading the component is currently being loaded + \value Component.Error an error occurred while loading the component. Calling \l errorString() will provide a human-readable description of any errors. - \endlist */ /*! @@ -1394,7 +1398,10 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent) */ -void QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, const QV4::Value &v, RequiredProperties &requiredProperties, QObject *createdComponent) +void QQmlComponentPrivate::setInitialProperties( + QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, + const QV4::Value &v, RequiredProperties &requiredProperties, QObject *createdComponent, + QQmlObjectCreator *creator) { QV4::Scope scope(engine); QV4::ScopedObject object(scope); @@ -1434,7 +1441,8 @@ void QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine *engine, QV qmlWarning(createdComponent, error); continue; } - name = engine->newString(properties.last()); + const QString lastProperty = properties.last(); + name = engine->newString(lastProperty); object->put(name, val); if (engine->hasException) { qmlWarning(createdComponent, engine->catchExceptionAsQmlError()); @@ -1442,6 +1450,26 @@ void QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine *engine, QV } else if (isTopLevelProperty) { auto prop = removePropertyFromRequired(createdComponent, name->toQString(), requiredProperties); } + if (!creator) + continue; + + if (QV4::QObjectWrapper *wrapper = object->as<QV4::QObjectWrapper>()) { + if (QObject *o = wrapper->object()) { + if (QQmlData *ddata = QQmlData::get(o)) { + if (const QQmlPropertyData *propData = ddata->propertyCache->property( + lastProperty, o, ddata->outerContext)) { + if (propData->isBindable()) + creator->removePendingBinding(o, propData->coreIndex()); + } + } else { + const QMetaObject *meta = o->metaObject(); + Q_ASSERT(meta); + const int index = meta->indexOfProperty(lastProperty.toUtf8()); + if (index != -1 && meta->property(index).isBindable()) + creator->removePendingBinding(o, index); + } + } + } } engine->hasException = false; @@ -1522,7 +1550,8 @@ void QQmlComponent::createObject(QQmlV4Function *args) if (!valuemap->isUndefined()) { QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->qmlContext()); - QQmlComponentPrivate::setInitialProperties(v4, qmlContext, object, valuemap, d->requiredProperties(), rv); + QQmlComponentPrivate::setInitialProperties( + v4, qmlContext, object, valuemap, d->requiredProperties(), rv, d->state.creator.data()); } if (!d->requiredProperties().empty()) { QList<QQmlError> errors; @@ -1672,8 +1701,11 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::QmlContext QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(v4engine, toCreate)); Q_ASSERT(object->as<QV4::Object>()); - if (!valuemap.isUndefined()) - setInitialProperties(v4engine, qmlContext, object, valuemap, requiredProperties, toCreate); + if (!valuemap.isUndefined()) { + setInitialProperties( + v4engine, qmlContext, object, valuemap, requiredProperties, + toCreate, state.creator.data()); + } } QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4) @@ -1772,7 +1804,9 @@ void QV4::QmlIncubatorObject::setInitialState(QObject *o, RequiredProperties &re QV4::Scope scope(v4); QV4::ScopedObject obj(scope, QV4::QObjectWrapper::wrap(v4, o)); QV4::Scoped<QV4::QmlContext> qmlCtxt(scope, d()->qmlContext); - QQmlComponentPrivate::setInitialProperties(v4, qmlCtxt, obj, d()->valuemap, requiredProperties, o); + QQmlComponentPrivate::setInitialProperties( + v4, qmlCtxt, obj, d()->valuemap, requiredProperties, o, + QQmlIncubatorPrivate::get(d()->incubator)->creator.data()); } } diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index abc0de7438..85acf2705d 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -87,7 +87,10 @@ public: QObject *beginCreate(QQmlRefPointer<QQmlContextData>); void completeCreate(); void initializeObjectWithInitialProperties(QV4::QmlContext *qmlContext, const QV4::Value &valuemap, QObject *toCreate, RequiredProperties &requiredProperties); - static void setInitialProperties(QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, const QV4::Value &v, RequiredProperties &requiredProperties, QObject *createdComponent); + static void setInitialProperties( + QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, + const QV4::Value &v, RequiredProperties &requiredProperties, QObject *createdComponent, + QQmlObjectCreator *creator); static QQmlError unsetRequiredPropertyToQQmlError(const RequiredPropertyInfo &unsetRequiredProperty); virtual void incubateObject( diff --git a/src/qml/qml/qqmldatablob.cpp b/src/qml/qml/qqmldatablob.cpp index f0dc0d77d3..cabfd6b904 100644 --- a/src/qml/qml/qqmldatablob.cpp +++ b/src/qml/qml/qqmldatablob.cpp @@ -73,16 +73,14 @@ The QQmlTypeLoader invokes callbacks on the QQmlDataBlob as data becomes availab This enum describes the status of the data blob. -\list -\li Null The blob has not yet been loaded by a QQmlTypeLoader -\li Loading The blob is loading network data. The QQmlDataBlob::setData() callback has not yet been - invoked or has not yet returned. -\li WaitingForDependencies The blob is waiting for dependencies to be done before continuing. - This status only occurs after the QQmlDataBlob::setData() callback has been made, and when the - blob has outstanding dependencies. -\li Complete The blob's data has been loaded and all dependencies are done. -\li Error An error has been set on this blob. -\endlist +\value Null The blob has not yet been loaded by a QQmlTypeLoader +\value Loading The blob is loading network data. The QQmlDataBlob::setData() callback has + not yet been invoked or has not yet returned. +\value WaitingForDependencies The blob is waiting for dependencies to be done before continuing. + This status only occurs after the QQmlDataBlob::setData() callback has been made, + and when the blob has outstanding dependencies. +\value Complete The blob's data has been loaded and all dependencies are done. +\value Error An error has been set on this blob. */ /*! @@ -90,11 +88,9 @@ This enum describes the status of the data blob. This enum describes the type of the data blob. -\list -\li QmlFile This is a QQmlTypeData -\li JavaScriptFile This is a QQmlScriptData -\li QmldirFile This is a QQmlQmldirData -\endlist +\value QmlFile This is a QQmlTypeData +\value JavaScriptFile This is a QQmlScriptData +\value QmldirFile This is a QQmlQmldirData */ /*! diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 1794a27a9d..826ecfd1ea 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -821,19 +821,17 @@ V4_DEFINE_EXTENSION(QV4LocaleDataDeletable, localeV4Data); can use the following enumeration values to specify the formatting of the string representation for a Date object. - \list - \li Locale.LongFormat The long version of day and month names; for - example, returning "January" as a month name. - \li Locale.ShortFormat The short version of day and month names; for - example, returning "Jan" as a month name. - \li Locale.NarrowFormat A special version of day and month names for - use when space is limited; for example, returning "J" as a month - name. Note that the narrow format might contain the same text for - different months and days or it can even be an empty string if the - locale doesn't support narrow names, so you should avoid using it - for date formatting. Also, for the system locale this format is - the same as ShortFormat. - \endlist + \value Locale.LongFormat The long version of day and month names; for + example, returning "January" as a month name. + \value Locale.ShortFormat The short version of day and month names; for + example, returning "Jan" as a month name. + \value Locale.NarrowFormat A special version of day and month names for + use when space is limited; for example, returning "J" as a month + name. Note that the narrow format might contain the same text for + different months and days or it can even be an empty string if the + locale doesn't support narrow names, so you should avoid using it + for date formatting. Also, for the system locale this format is + the same as ShortFormat. Additionally the double-to-string and string-to-double conversion functions are @@ -1055,15 +1053,13 @@ ReturnedValue QQmlLocale::method_localeCompare(const QV4::FunctionObject *b, con Holds the first day of the week according to the current locale. - \list - \li Locale.Sunday = 0 - \li Locale.Monday = 1 - \li Locale.Tuesday = 2 - \li Locale.Wednesday = 3 - \li Locale.Thursday = 4 - \li Locale.Friday = 5 - \li Locale.Saturday = 6 - \endlist + \value Locale.Sunday 0 + \value Locale.Monday 1 + \value Locale.Tuesday 2 + \value Locale.Wednesday 3 + \value Locale.Thursday 4 + \value Locale.Friday 5 + \value Locale.Saturday 6 \note that these values match the JS Date API which is different from the Qt C++ API where Qt::Sunday = 7. @@ -1094,10 +1090,9 @@ ReturnedValue QQmlLocale::method_localeCompare(const QV4::FunctionObject *b, con \qmlproperty enumeration QtQml::Locale::textDirection Holds the text direction of the language: - \list - \li Qt.LeftToRight - \li Qt.RightToLeft - \endlist + + \value Qt.LeftToRight Text normally begins at the left side. + \value Qt.RightToLeft Text normally begins at the right side. */ /*! @@ -1116,11 +1111,11 @@ ReturnedValue QQmlLocale::method_localeCompare(const QV4::FunctionObject *b, con \qmlmethod string QtQml::Locale::currencySymbol(format) Returns the currency symbol for the specified \a format: - \list - \li Locale.CurrencyIsoCode a ISO-4217 code of the currency. - \li Locale.CurrencySymbol a currency symbol. - \li Locale.CurrencyDisplayName a user readable name of the currency. - \endlist + + \value Locale.CurrencyIsoCode a ISO-4217 code of the currency. + \value Locale.CurrencySymbol a currency symbol. + \value Locale.CurrencyDisplayName a user readable name of the currency. + \sa Number::toLocaleCurrencyString() */ @@ -1147,16 +1142,13 @@ ReturnedValue QQmlLocale::method_localeCompare(const QV4::FunctionObject *b, con This property defines which units are used for measurement. - \list - \li Locale.MetricSystem This value indicates metric units, such as meters, - centimeters and millimeters. - \li Locale.ImperialUSSystem This value indicates imperial units, such as - inches and miles as they are used in the United States. - \li Locale.ImperialUKSystem This value indicates imperial units, such as - inches and miles as they are used in the United Kingdom. - \li Locale.ImperialSystem Provided for compatibility. The same as - Locale.ImperialUSSystem. - \endlist + \value Locale.MetricSystem This value indicates metric units, such as meters, + centimeters and millimeters. + \value Locale.ImperialUSSystem This value indicates imperial units, such as + inches and miles as they are used in the United States. + \value Locale.ImperialUKSystem This value indicates imperial units, such as + inches and miles as they are used in the United Kingdom. + \value Locale.ImperialSystem Provided for compatibility. The same as Locale.ImperialUSSystem. */ QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 0a96bb0af8..fc629bc060 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -904,11 +904,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *bindingProper if (_ddata->hasBindingBit(bindingProperty->coreIndex()) && allowedToRemoveBinding) { QQmlPropertyPrivate::removeBinding(_bindingTarget, QQmlPropertyIndex(bindingProperty->coreIndex())); } else if (bindingProperty->isBindable() && allowedToRemoveBinding) { - QList<DeferredQPropertyBinding> &pendingBindings = sharedState.data()->allQPropertyBindings; - auto it = std::remove_if(pendingBindings.begin(), pendingBindings.end(), [&](const DeferredQPropertyBinding &deferred) { - return deferred.properyIndex == bindingProperty->coreIndex() && deferred.target == _bindingTarget; - }); - pendingBindings.erase(it, pendingBindings.end()); + removePendingBinding(_bindingTarget, bindingProperty->coreIndex()); } if (bindingType == QV4::CompiledData::Binding::Type_Script || binding->isTranslationBinding()) { diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index 4e788e88d4..26db10a11f 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -152,6 +152,16 @@ public: RequiredProperties &requiredProperties() {return sharedState->requiredProperties;} bool componentHadRequiredProperties() const {return sharedState->hadRequiredProperties;} + void removePendingBinding(QObject *target, int propertyIndex) + { + QList<DeferredQPropertyBinding> &pendingBindings = sharedState.data()->allQPropertyBindings; + auto it = std::remove_if(pendingBindings.begin(), pendingBindings.end(), + [&](const DeferredQPropertyBinding &deferred) { + return deferred.properyIndex == propertyIndex && deferred.target == target; + }); + pendingBindings.erase(it, pendingBindings.end()); + } + private: QQmlObjectCreator(QQmlRefPointer<QQmlContextData> contextData, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index 17e3e88f9b..3fe7f12a82 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -357,14 +357,13 @@ void QQmlBind::setDelayed(bool delayed) be restored when the binding is disabled. The possible values are: - \list - \li Binding.RestoreNone The original value is not restored at all - \li Binding.RestoreBinding The original value is restored if it was another - binding. In that case the old binding is in effect again. - \li Binding.RestoreValue The original value is restored if it was a plain - value rather than a binding. - \li Binding.RestoreBindingOrValue The original value is always restored. - \endlist + + \value Binding.RestoreNone The original value is not restored at all + \value Binding.RestoreBinding The original value is restored if it was another binding. + In that case the old binding is in effect again. + \value Binding.RestoreValue The original value is restored if it was a plain + value rather than a binding. + \value Binding.RestoreBindingOrValue The original value is always restored. The default value is \c Binding.RestoreBindingOrValue. diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index f127885e98..377a4c1e6f 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -399,8 +399,8 @@ void QQmlDelegateModelPrivate::connectToAbstractItemModel() q, QQmlDelegateModel, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>))); qmlobject_connect(aim, QAbstractItemModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), q, QQmlDelegateModel, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int))); - qmlobject_connect(aim, QAbstractItemModel, SIGNAL(modelReset()), - q, QQmlDelegateModel, SLOT(_q_modelReset())); + + QObject::connect(aim, &QAbstractItemModel::modelAboutToBeReset, q, &QQmlDelegateModel::_q_modelAboutToBeReset); qmlobject_connect(aim, QAbstractItemModel, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), q, QQmlDelegateModel, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); } @@ -429,8 +429,7 @@ void QQmlDelegateModelPrivate::disconnectFromAbstractItemModel() q, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>))); QObject::disconnect(aim, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), q, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int))); - QObject::disconnect(aim, SIGNAL(modelReset()), - q, SLOT(_q_modelReset())); + QObject::disconnect(aim, &QAbstractItemModel::modelAboutToBeReset, q, &QQmlDelegateModel::_q_modelAboutToBeReset); QObject::disconnect(aim, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), q, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); } @@ -1879,14 +1878,41 @@ void QQmlDelegateModelPrivate::emitChanges() for (int i = 1; i < m_groupCount; ++i) QQmlDelegateModelGroupPrivate::get(m_groups[i])->emitModelUpdated(reset); - auto cacheCopy = m_cache; // deliberate; emitChanges may alter m_cache - for (QQmlDelegateModelItem *cacheItem : qAsConst(cacheCopy)) { - if (cacheItem->attached) - cacheItem->attached->emitChanges(); + // emitChanges may alter m_cache and delete items + QVarLengthArray<QPointer<QQmlDelegateModelAttached>> attachedObjects; + attachedObjects.reserve(m_cache.length()); + for (const QQmlDelegateModelItem *cacheItem : std::as_const(m_cache)) + attachedObjects.append(cacheItem->attached); + + for (const QPointer<QQmlDelegateModelAttached> &attached : std::as_const(attachedObjects)) { + if (attached && attached->m_cacheItem) + attached->emitChanges(); } } -void QQmlDelegateModel::_q_modelReset() +void QQmlDelegateModel::_q_modelAboutToBeReset() +{ + auto aim = static_cast<QAbstractItemModel *>(sender()); + auto oldRoleNames = aim->roleNames(); + // this relies on the fact that modelAboutToBeReset must be followed + // by a modelReset signal before any further modelAboutToBeReset can occur + QObject::connect(aim, &QAbstractItemModel::modelReset, this, [&, oldRoleNames](){ + auto aim = static_cast<QAbstractItemModel *>(sender()); + if (oldRoleNames == aim->roleNames()) { + // if the rolenames stayed the same (most common case), then we don't have + // to throw away all the setup that we did + handleModelReset(); + } else { + // If they did change, we give up and just start from scratch via setMode + setModel(QVariant::fromValue(model())); + // but we still have to call handleModelReset, otherwise views will + // not refresh + handleModelReset(); + } + }, Qt::SingleShotConnection); +} + +void QQmlDelegateModel::handleModelReset() { Q_D(QQmlDelegateModel); if (!d->m_delegate) @@ -2051,7 +2077,7 @@ void QQmlDelegateModel::_q_layoutChanged(const QList<QPersistentModelIndex> &par // Ignored } else { // We don't know what's going on, so reset the model - _q_modelReset(); + handleModelReset(); } } @@ -2704,20 +2730,24 @@ void QQmlDelegateModelAttached::emitChanges() m_previousGroups = m_cacheItem->groups; int indexChanges = 0; - for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i) { + const int groupCount = m_cacheItem->metaType->groupCount; + for (int i = 1; i < groupCount; ++i) { if (m_previousIndex[i] != m_currentIndex[i]) { m_previousIndex[i] = m_currentIndex[i]; indexChanges |= (1 << i); } } + // Don't access m_cacheItem anymore once we've started sending signals. + // We don't own it and someone might delete it. + int notifierId = 0; const QMetaObject *meta = metaObject(); - for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { + for (int i = 1; i < groupCount; ++i, ++notifierId) { if (groupChanges & (1 << i)) QMetaObject::activate(this, meta, notifierId, nullptr); } - for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { + for (int i = 1; i < groupCount; ++i, ++notifierId) { if (indexChanges & (1 << i)) QMetaObject::activate(this, meta, notifierId, nullptr); } diff --git a/src/qmlmodels/qqmldelegatemodel_p.h b/src/qmlmodels/qqmldelegatemodel_p.h index 2ce02c4aa5..1ad5c5145c 100644 --- a/src/qmlmodels/qqmldelegatemodel_p.h +++ b/src/qmlmodels/qqmldelegatemodel_p.h @@ -150,7 +150,7 @@ private Q_SLOTS: void _q_itemsInserted(int index, int count); void _q_itemsRemoved(int index, int count); void _q_itemsMoved(int from, int to, int count); - void _q_modelReset(); + void _q_modelAboutToBeReset(); void _q_rowsInserted(const QModelIndex &,int,int); void _q_columnsInserted(const QModelIndex &, int, int); void _q_columnsRemoved(const QModelIndex &, int, int); @@ -162,6 +162,7 @@ private Q_SLOTS: void _q_layoutChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint); private: + void handleModelReset(); bool isDescendantOf(const QPersistentModelIndex &desc, const QList<QPersistentModelIndex> &parents) const; Q_DISABLE_COPY(QQmlDelegateModel) diff --git a/src/qmlmodels/qqmltableinstancemodel.cpp b/src/qmlmodels/qqmltableinstancemodel.cpp index 5b058481ab..13a07ecc6d 100644 --- a/src/qmlmodels/qqmltableinstancemodel.cpp +++ b/src/qmlmodels/qqmltableinstancemodel.cpp @@ -461,8 +461,10 @@ void QQmlTableInstanceModel::setModel(const QVariant &model) if (auto const aim = abstractItemModel()) disconnect(aim, &QAbstractItemModel::dataChanged, this, &QQmlTableInstanceModel::dataChangedCallback); m_adaptorModel.setModel(model, this); - if (auto const aim = abstractItemModel()) + if (auto const aim = abstractItemModel()) { connect(aim, &QAbstractItemModel::dataChanged, this, &QQmlTableInstanceModel::dataChangedCallback); + connect(aim, &QAbstractItemModel::modelAboutToBeReset, this, &QQmlTableInstanceModel::modelAboutToBeResetCallback); + } } void QQmlTableInstanceModel::dataChangedCallback(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles) @@ -480,6 +482,21 @@ void QQmlTableInstanceModel::dataChangedCallback(const QModelIndex &begin, const } } +void QQmlTableInstanceModel::modelAboutToBeResetCallback() +{ + // When the model is reset, we can no longer rely on any of the data it has + // provided us so far. Normally it's enough for the view to recreate all the + // delegate items in that case, except if the model roles has changed as well + // (since those are cached by QQmlAdaptorModel / Accessors). For the latter case, we + // simply set the model once more in the delegate model to rebuild everything. + auto const aim = abstractItemModel(); + auto oldRoleNames = aim->roleNames(); + QObject::connect(aim, &QAbstractItemModel::modelReset, this, [this, aim, oldRoleNames](){ + if (oldRoleNames != aim->roleNames()) + setModel(model()); + }, Qt::SingleShotConnection); +} + QQmlComponent *QQmlTableInstanceModel::delegate() const { return m_delegate; diff --git a/src/qmlmodels/qqmltableinstancemodel_p.h b/src/qmlmodels/qqmltableinstancemodel_p.h index 18421bae38..6ae899ed21 100644 --- a/src/qmlmodels/qqmltableinstancemodel_p.h +++ b/src/qmlmodels/qqmltableinstancemodel_p.h @@ -151,6 +151,7 @@ private: void destroyModelItem(QQmlDelegateModelItem *modelItem, DestructionMode mode); void dataChangedCallback(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles); + void modelAboutToBeResetCallback(); static bool isDoneIncubating(QQmlDelegateModelItem *modelItem); static void deleteModelItemLater(QQmlDelegateModelItem *modelItem); diff --git a/src/qmlxmllistmodel/qqmlxmllistmodel.cpp b/src/qmlxmllistmodel/qqmlxmllistmodel.cpp index cf324c5740..d1f4052a9a 100644 --- a/src/qmlxmllistmodel/qqmlxmllistmodel.cpp +++ b/src/qmlxmllistmodel/qqmlxmllistmodel.cpp @@ -583,14 +583,12 @@ int QQmlXmlListModel::nextQueryId() \qmlproperty enumeration QtQml.XmlListModel::XmlListModel::status Specifies the model loading status, which can be one of the following: - \list - \li XmlListModel.Null - No XML data has been set for this model. - \li XmlListModel.Ready - The XML data has been loaded into the model. - \li XmlListModel.Loading - The model is in the process of reading and - loading XML data. - \li XmlListModel.Error - An error occurred while the model was loading. See - \l errorString() for details about the error. - \endlist + \value XmlListModel.Null No XML data has been set for this model. + \value XmlListModel.Ready The XML data has been loaded into the model. + \value XmlListModel.Loading The model is in the process of reading and + loading XML data. + \value XmlListModel.Error An error occurred while the model was loading. See + \l errorString() for details about the error. \sa progress */ diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index 9a4ce960f1..ed681273fa 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -488,7 +488,7 @@ QAccessible::Role QAccessibleQuickItem::role() const QAccessible::Role role = QAccessible::NoRole; if (item()) - role = QQuickItemPrivate::get(item())->accessibleRole(); + role = QQuickItemPrivate::get(item())->effectiveAccessibleRole(); if (role == QAccessible::NoRole) { if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(item()))) role = QAccessible::StaticText; diff --git a/src/quick/doc/images/declarative-scalegrid.png b/src/quick/doc/images/declarative-scalegrid.png Binary files differindex 32d8712568..69ad06f834 100644 --- a/src/quick/doc/images/declarative-scalegrid.png +++ b/src/quick/doc/images/declarative-scalegrid.png diff --git a/src/quick/doc/images/qml-borderimage-rounded.png b/src/quick/doc/images/qml-borderimage-rounded.png Binary files differnew file mode 100644 index 0000000000..562fc277bb --- /dev/null +++ b/src/quick/doc/images/qml-borderimage-rounded.png diff --git a/src/quick/doc/images/qml-borderimage-scaled.png b/src/quick/doc/images/qml-borderimage-scaled.png Binary files differindex e42891ecc7..230e8a010e 100644 --- a/src/quick/doc/images/qml-borderimage-scaled.png +++ b/src/quick/doc/images/qml-borderimage-scaled.png diff --git a/src/quick/doc/images/qml-borderimage-tiled.png b/src/quick/doc/images/qml-borderimage-tiled.png Binary files differindex e27d9601c4..f7523e8e94 100644 --- a/src/quick/doc/images/qml-borderimage-tiled.png +++ b/src/quick/doc/images/qml-borderimage-tiled.png diff --git a/src/quick/doc/snippets/qml/borderimage/borderimage-rounded.qml b/src/quick/doc/snippets/qml/borderimage/borderimage-rounded.qml new file mode 100644 index 0000000000..8e78ce28b0 --- /dev/null +++ b/src/quick/doc/snippets/qml/borderimage/borderimage-rounded.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + id: page + color: "white" + width: 182; height: 164 + +//! [tiled border image] +BorderImage { + anchors { fill: parent; margins: 6 } + border { left: 30; top: 30; right: 30; bottom: 30 } + horizontalTileMode: BorderImage.Round + verticalTileMode: BorderImage.Round + source: "pics/borderframe.png" +} +//! [tiled border image] + + Rectangle { + anchors.fill: parent + anchors.margins: 5 + color: "transparent" + border.color: "gray" + + Rectangle { + x: 30; y: 0 + width: 1; height: parent.height + color: "gray" + + Text { + text: "1" + font.pixelSize: 9 + color: "red" + anchors.right: parent.right + anchors.rightMargin: 1 + y: 20 + } + + Text { + text: "4" + font.pixelSize: 9 + color: "red" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 1 + } + + Text { + text: "7" + font.pixelSize: 9 + color: "red" + y: parent.height - 30 + anchors.right: parent.right + anchors.rightMargin: 1 + } + } + + Rectangle { + x: parent.width - 30; y: 0 + width: 1; height: parent.height + color: "gray" + + Text { + text: "3" + font.pixelSize: 9 + color: "red" + x: 1 + y: 20 + } + + Text { + text: "6" + font.pixelSize: 9 + color: "red" + x: 1 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + text: "9" + font.pixelSize: 9 + color: "red" + x: 1 + y: parent.height - 30 + } + } + + Text { + text: "5" + font.pixelSize: 9 + color: "red" + anchors.centerIn: parent + } + + Rectangle { + x: 0; y: 30 + width: parent.width; height: 1 + color: "gray" + + Text { + text: "2" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + y: -10 + } + } + + Rectangle { + x: 0; y: parent.height - 30 + width: parent.width; height: 1 + color: "gray" + + Text { + text: "8" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + } + } + } +} diff --git a/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml b/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml index c59afb629c..e713087ef5 100644 --- a/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml +++ b/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml @@ -53,11 +53,12 @@ import QtQuick 2.0 Rectangle { id: page color: "white" - width: 180; height: 180 + width: 182; height: 182 + border.color: "gray" //! [scaled border image] BorderImage { - width: 180; height: 180 + anchors { fill: parent; margins: 1 } border { left: 30; top: 30; right: 30; bottom: 30 } horizontalTileMode: BorderImage.Stretch verticalTileMode: BorderImage.Stretch @@ -67,25 +68,98 @@ BorderImage { Rectangle { x: 30; y: 0 - width: 1; height: 180 + width: 1; height: parent.height color: "gray" + + Text { + text: "1" + font.pixelSize: 9 + color: "red" + anchors.right: parent.right + anchors.rightMargin: 1 + y: 20 + } + + Text { + text: "4" + font.pixelSize: 9 + color: "red" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 1 + } + + Text { + text: "7" + font.pixelSize: 9 + color: "red" + y: parent.height - 30 + anchors.right: parent.right + anchors.rightMargin: 1 + } } Rectangle { - x: 150; y: 0 - width: 1; height: 180 + x: parent.width - 30; y: 0 + width: 1; height: parent.height color: "gray" + + Text { + text: "3" + font.pixelSize: 9 + color: "red" + x: 1 + y: 20 + } + + Text { + text: "6" + font.pixelSize: 9 + color: "red" + x: 1 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + text: "9" + font.pixelSize: 9 + color: "red" + x: 1 + y: parent.height - 30 + } + } + + Text { + text: "5" + font.pixelSize: 9 + color: "red" + anchors.centerIn: parent } Rectangle { x: 0; y: 30 - width: 180; height: 1 + width: parent.width; height: 1 color: "gray" + + Text { + text: "2" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + y: -10 + } } Rectangle { - x: 0; y: 150 - width: 180; height: 1 + x: 0; y: parent.height - 30 + width: parent.width; height: 1 color: "gray" + + Text { + text: "8" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + } } } diff --git a/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml b/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml index 6f6c676b53..5601b35933 100644 --- a/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml +++ b/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml @@ -53,11 +53,12 @@ import QtQuick 2.0 Rectangle { id: page color: "white" - width: 180; height: 180 + width: 182; height: 182 + border.color: "gray" //! [tiled border image] BorderImage { - width: 180; height: 180 + anchors { fill: parent; margins: 1 } border { left: 30; top: 30; right: 30; bottom: 30 } horizontalTileMode: BorderImage.Repeat verticalTileMode: BorderImage.Repeat @@ -67,25 +68,98 @@ BorderImage { Rectangle { x: 30; y: 0 - width: 1; height: 180 + width: 1; height: parent.height color: "gray" + + Text { + text: "1" + font.pixelSize: 9 + color: "red" + anchors.right: parent.right + anchors.rightMargin: 1 + y: 20 + } + + Text { + text: "4" + font.pixelSize: 9 + color: "red" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 1 + } + + Text { + text: "7" + font.pixelSize: 9 + color: "red" + y: parent.height - 30 + anchors.right: parent.right + anchors.rightMargin: 1 + } } Rectangle { - x: 150; y: 0 - width: 1; height: 180 + x: parent.width - 30; y: 0 + width: 1; height: parent.height color: "gray" + + Text { + text: "3" + font.pixelSize: 9 + color: "red" + x: 1 + y: 20 + } + + Text { + text: "6" + font.pixelSize: 9 + color: "red" + x: 1 + anchors.verticalCenter: parent.verticalCenter + } + + Text { + text: "9" + font.pixelSize: 9 + color: "red" + x: 1 + y: parent.height - 30 + } + } + + Text { + text: "5" + font.pixelSize: 9 + color: "red" + anchors.centerIn: parent } Rectangle { x: 0; y: 30 - width: 180; height: 1 + width: parent.width; height: 1 color: "gray" + + Text { + text: "2" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + y: -10 + } } Rectangle { - x: 0; y: 150 - width: 180; height: 1 + x: 0; y: parent.height - 30 + width: parent.width; height: 1 color: "gray" + + Text { + text: "8" + font.pixelSize: 9 + color: "red" + anchors.horizontalCenter: parent.horizontalCenter + } } } diff --git a/src/quick/doc/snippets/qml/borderimage/normal-image.qml b/src/quick/doc/snippets/qml/borderimage/normal-image.qml index 16938bc8e4..f75ccd09fd 100644 --- a/src/quick/doc/snippets/qml/borderimage/normal-image.qml +++ b/src/quick/doc/snippets/qml/borderimage/normal-image.qml @@ -53,35 +53,43 @@ import QtQuick 2.0 Rectangle { id: page color: "white" - width: 120; height: 120 + width: 182; height: 182 //! [normal image] Image { source: "pics/borderframe.png" + anchors.centerIn: parent } //! [normal image] Rectangle { - x: 30; y: 0 - width: 1; height: 120 - color: "gray" - } + width: 120; height: 120 + color: "transparent" + border.color: "gray" + anchors.centerIn: parent - Rectangle { - x: 90; y: 0 - width: 1; height: 120 - color: "gray" - } + Rectangle { + x: 30; y: 0 + width: 1; height: 120 + color: "gray" + } - Rectangle { - x: 0; y: 30 - width: 200; height: 1 - color: "gray" - } + Rectangle { + x: 90; y: 0 + width: 1; height: 120 + color: "gray" + } - Rectangle { - x: 0; y: 90 - width: 200; height: 1 - color: "gray" + Rectangle { + x: 0; y: 30 + width: 120; height: 1 + color: "gray" + } + + Rectangle { + x: 0; y: 90 + width: 120; height: 1 + color: "gray" + } } } diff --git a/src/quick/doc/snippets/qml/borderimage/pics/borderframe.png b/src/quick/doc/snippets/qml/borderimage/pics/borderframe.png Binary files differnew file mode 100644 index 0000000000..97a9452d5c --- /dev/null +++ b/src/quick/doc/snippets/qml/borderimage/pics/borderframe.png diff --git a/src/quick/doc/snippets/qml/borderimage/pics/borderframe.svg b/src/quick/doc/snippets/qml/borderimage/pics/borderframe.svg new file mode 100644 index 0000000000..1f6c1f2901 --- /dev/null +++ b/src/quick/doc/snippets/qml/borderimage/pics/borderframe.svg @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="120.00004" + height="120.00018" + id="svg2" + sodipodi:version="0.32" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="borderframe.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + version="1.1" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : -406.18091 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : -406.18091 : 1" + inkscape:persp3d-origin="372.04724 : -581.57461 : 1" + id="perspective10" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.8998663" + inkscape:cx="239.22736" + inkscape:cy="198.43502" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + inkscape:window-width="2688" + inkscape:window-height="1698" + inkscape:window-x="4020" + inkscape:window-y="204" + inkscape:showpageshadow="0" + inkscape:pagecheckerboard="1" + inkscape:deskcolor="#d1d1d1" + inkscape:window-maximized="0"> + <inkscape:grid + type="xygrid" + id="grid2383" + visible="true" + enabled="true" + spacingx="1" + spacingy="1" + originx="-93.000067" + originy="-75.362307" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-93.000067,-75.362307)"> + <path + style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.88977;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 105.75595,88.1182 c 0,-11.811047 11.81103,-11.811047 11.81103,0 h 23.62207 L 153.00008,76.307153 164.81112,88.1182 h 23.62206 c 0,-11.811047 11.81104,-11.811047 11.81104,0 11.81104,0 11.81104,11.811049 0,11.811049 v 23.622101 l 11.81104,11.81105 -11.81104,11.81105 v 23.62209 c 11.81104,0 11.81104,11.81105 0,11.81105 0,11.81105 -11.81104,11.81105 -11.81104,0 h -23.62206 l -11.81104,11.81105 -11.81103,-11.81105 h -23.62207 c 0,11.81105 -11.81103,11.81105 -11.81103,0 -11.811037,0 -11.811037,-11.81105 0,-11.81105 V 147.17345 L 93.944913,135.3624 105.75595,123.55135 V 99.929249 c -11.811037,0 -11.811037,-11.811049 0,-11.811049 z" + id="rect2387" + sodipodi:nodetypes="ccccccccccccccccccccccccc" /> + <path + sodipodi:nodetypes="ccccccccccccccccccccccccc" + id="path3160" + d="m 110.48036,92.84263 c 0,-10.629942 0,-9.448848 4.72442,-1e-5 l 27.16537,1e-5 10.62993,-10.629942 10.62993,10.629942 27.16538,-1e-5 c 4.72441,-9.448838 4.72441,-10.629932 4.72441,1e-5 10.62993,0 9.44883,-1e-5 0,4.724411 v 27.165419 l 10.62993,10.62995 -10.62993,10.62994 v 27.1654 c 9.44883,4.72442 10.62993,4.72443 0,4.72443 0,10.62995 0,9.44883 -4.72441,-1e-5 l -27.16538,1e-5 -10.62993,10.62995 -10.62993,-10.62995 -27.16537,-1e-5 c -4.72442,9.44884 -4.72442,10.62996 -4.72442,1e-5 -10.629933,0 -9.44883,-1e-5 0,-4.72443 v -27.1654 L 99.850427,135.36241 110.48036,124.73246 V 97.567041 c -9.44883,-4.724421 -10.629933,-4.724411 0,-4.724411 z" + style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.77954;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </g> +</svg> diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index e47a137330..b2be043115 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -189,68 +189,32 @@ available when you import \c QtQuick. Font weighting is classified on a scale from 0 to 99, where a weight of 0 is ultralight, and 99 is extremely black. The following values are supported: - \table - \row - \li \c Font.Thin - \li 0 - \row - \li \c Font.ExtraLight - \li 12 - \row - \li \c Font.Light - \li 25 - \row - \li \c Font.Normal - \li 50 - \row - \li \c Font.Medium - \li 57 - \row - \li \c Font.DemiBold - \li 63 - \row - \li \c Font.Bold - \li 75 - \row - \li \c Font.ExtraBold - \li 81 - \row - \li \c Font.Black - \li 87 - \endtable + \value Font.Thin 0 + \value Font.ExtraLight 12 + \value Font.Light 25 + \value Font.Normal 50 + \value Font.Medium 57 + \value Font.DemiBold 63 + \value Font.Bold 75 + \value Font.ExtraBold 81 + \value Font.Black 87 Capitalization supports the following values: - \table - \row - \li \c Font.MixedCase - \li No capitalization change is applied. - \row - \li \c Font.AllUppercase - \li Alters the text to be rendered in all uppercase type. - \row - \li \c Font.AllLowercase - \li Alters the text to be rendered in all lowercase type. - \row - \li \c Font.SmallCaps - \li Alters the text to be rendered in small-caps type. - \row - \li \c Font.Capitalize - \li Alters the text to be rendered with the first character of each word as an uppercase character. - \endtable + \value Font.MixedCase No capitalization change is applied. + \value Font.AllUppercase Alters the text to be rendered in all uppercase type. + \value Font.AllLowercase Alters the text to be rendered in all lowercase type. + \value Font.SmallCaps Alters the text to be rendered in small-caps type. + \value Font.Capitalize Alters the text to be rendered with the first character of each word as an uppercase character. Setting the hinting preference only has an effect when using the "NativeRendering" render type. The property supports the following values: - \list - \value Font.PreferDefaultHinting - Use the default hinting level for the target platform. - \value Font.PreferNoHinting - If possible, render text without hinting the outlines - of the glyphs. - \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, - but align glyphs to the pixel grid in the vertical direction. - \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and - vertical directions. - \endlist + \value Font.PreferDefaultHinting Use the default hinting level for the target platform. + \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs. + \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting, + but align glyphs to the pixel grid in the vertical direction. + \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions. \sa {QML Basic Types} */ diff --git a/src/quick/handlers/qquickpointerdevicehandler.cpp b/src/quick/handlers/qquickpointerdevicehandler.cpp index 9fe214824f..69080b2027 100644 --- a/src/quick/handlers/qquickpointerdevicehandler.cpp +++ b/src/quick/handlers/qquickpointerdevicehandler.cpp @@ -185,7 +185,7 @@ void QQuickPointerDeviceHandler::setAcceptedDevices(QPointingDevice::DeviceTypes Rectangle { id: rect TapHandler { - acceptedPointerTypes: PointerDevice.GenericPointer | PointerDevice.Finger | PointerDevice.Pen + acceptedPointerTypes: PointerDevice.Generic | PointerDevice.Finger | PointerDevice.Pen onTapped: console.log("clicked") } TapHandler { diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 89fafbe44d..4b85e1b101 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -480,9 +480,8 @@ void QQuickCanvasItem::setCanvasWindow(const QRectF& rect) \qmlproperty enumeration QtQuick::Canvas::renderTarget Holds the current canvas render target. - \list - \li Canvas.Image - render to an in memory image buffer. - \endlist + \value Canvas.Image Render to an in-memory image buffer. + \value Canvas.FramebufferObject As of Qt 6.0, this value is ignored. This hint is supplied along with renderStrategy to the graphics context to determine the method of rendering. A renderStrategy, renderTarget or a @@ -516,11 +515,9 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target) \qmlproperty enumeration QtQuick::Canvas::renderStrategy Holds the current canvas rendering strategy. - \list - \li Canvas.Immediate - context will perform graphics commands immediately in the main UI thread. - \li Canvas.Threaded - context will defer graphics commands to a private rendering thread. - \li Canvas.Cooperative - context will defer graphics commands to the applications global render thread. - \endlist + \value Canvas.Immediate context will perform graphics commands immediately in the main UI thread. + \value Canvas.Threaded context will defer graphics commands to a private rendering thread. + \value Canvas.Cooperative context will defer graphics commands to the applications global render thread. This hint is supplied along with renderTarget to the graphics context to determine the method of rendering. A renderStrategy, renderTarget or a diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 32546c5299..7503e3ada9 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -1325,29 +1325,81 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(const QV4::Function /*! \qmlproperty string QtQuick::Context2D::globalCompositeOperation - Holds the current the current composition operation, from the list below: - \list - \li source-atop - A atop B. Display the source image wherever both images are opaque. - Display the destination image wherever the destination image is opaque but the source image is transparent. - Display transparency elsewhere. - \li source-in - A in B. Display the source image wherever both the source image and destination image are opaque. - Display transparency elsewhere. - \li source-out - A out B. Display the source image wherever the source image is opaque and the destination image is transparent. - Display transparency elsewhere. - \li source-over - (default) A over B. Display the source image wherever the source image is opaque. - Display the destination image elsewhere. - \li destination-atop - B atop A. Same as source-atop but using the destination image instead of the source image and vice versa. - \li destination-in - B in A. Same as source-in but using the destination image instead of the source image and vice versa. - \li destination-out - B out A. Same as source-out but using the destination image instead of the source image and vice versa. - \li destination-over - B over A. Same as source-over but using the destination image instead of the source image and vice versa. - \li lighter - A plus B. Display the sum of the source image and destination image, with color values approaching 255 (100%) as a limit. - \li copy - A (B is ignored). Display the source image instead of the destination image. - \li xor - A xor B. Exclusive OR of the source image and destination image. - \endlist - - Additionally, this property also accepts the compositon modes listed in QPainter::CompositionMode. According to the W3C standard, these - extension composition modes are provided as "vendorName-operationName" syntax, for example: QPainter::CompositionMode_Exclusion is provided as - "qt-exclusion". + Holds the current the current composition operation. Allowed operations are: + + \value "source-atop" + QPainter::CompositionMode_SourceAtop + A atop B. Display the source image wherever both images are opaque. + Display the destination image wherever the destination image is opaque + but the source image is transparent. Display transparency elsewhere. + \value "source-in" + QPainter::CompositionMode_SourceIn + A in B. Display the source image wherever both the source image and + destination image are opaque. Display transparency elsewhere. + \value "source-out" + QPainter::CompositionMode_SourceOut + A out B. Display the source image wherever the source image is opaque + and the destination image is transparent. Display transparency elsewhere. + \value "source-over" + QPainter::CompositionMode_SourceOver (default) + A over B. Display the source image wherever the source image is opaque. + Display the destination image elsewhere. + \value "destination-atop" + QPainter::CompositionMode_DestinationAtop + B atop A. Same as \c source-atop but using the destination image instead + of the source image and vice versa. + \value "destination-in" + QPainter::CompositionMode_DestinationIn + B in A. Same as \c source-in but using the destination image instead of + the source image and vice versa. + \value "destination-out" + QPainter::CompositionMode_DestinationOut + B out A. Same as \c source-out but using the destination image instead + of the source image and vice versa. + \value "destination-over" + QPainter::CompositionMode_DestinationOver + B over A. Same as \c source-over but using the destination image + instead of the source image and vice versa. + \value "lighter" + QPainter::CompositionMode_Plus + A plus B. Display the sum of the source image and destination image, + with color values approaching \c 255 (100%) as a limit. + \value "copy" + QPainter::CompositionMode_Source + A (B is ignored). Display the source image instead of the destination image. + \value "xor" + QPainter::CompositionMode_Xor + A xor B. Exclusive OR of the source image and destination image. + \value "qt-clear" + QPainter::CompositionMode_Clear + \value "qt-destination" + QPainter::CompositionMode_Destination + \value "qt-multiply" + QPainter::CompositionMode_Multiply + \value "qt-screen" + QPainter::CompositionMode_Screen + \value "qt-overlay" + QPainter::CompositionMode_Overlay + \value "qt-darken" + QPainter::CompositionMode_Darken + \value "qt-lighten" + QPainter::CompositionMode_Lighten + \value "qt-color-dodge" + QPainter::CompositionMode_ColorDodge + \value "qt-color-burn" + QPainter::CompositionMode_ColorBurn + \value "qt-hard-light" + QPainter::CompositionMode_HardLight + \value "qt-soft-light" + QPainter::CompositionMode_SoftLight + \value "qt-difference" + QPainter::CompositionMode_Difference + \value "qt-exclusion" + QPainter::CompositionMode_Exclusion + + In compliance with the W3C standard, the extended composition modes beyond + the required modes are provided as "vendorName-operationName" syntax, for + example: QPainter::CompositionMode_Exclusion is provided as "qt-exclusion". */ QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { @@ -1458,18 +1510,19 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(const QV4::FunctionOb } RETURN_UNDEFINED(); } + /*! \qmlproperty enumeration QtQuick::Context2D::fillRule - Holds the current fill rule used for filling shapes. The following fill rules are supported: - \list - \li Qt.OddEvenFill - \li Qt.WindingFill - \endlist - Note: Unlike the QPainterPath, the Canvas API uses the winding fill as the default fill rule. - The fillRule property is part of the context rendering state. + Holds the current fill rule used for filling shapes. The following fill rules are supported: - \sa fillStyle - */ + \value Qt.OddEvenFill Qt::OddEvenFill + \value Qt.WindingFill (default) Qt::WindingFill + + \note Unlike QPainterPath, the Canvas API uses the winding fill as the default fill rule. + The fillRule property is part of the context rendering state. + + \sa fillStyle +*/ QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(b); @@ -1723,48 +1776,49 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(cons } /*! - \qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode) - This is a overload function. - Returns a CanvasPattern object that uses the given \a color and \a patternMode. - The valid pattern modes are: - \list - \li Qt.SolidPattern - \li Qt.Dense1Pattern - \li Qt.Dense2Pattern - \li Qt.Dense3Pattern - \li Qt.Dense4Pattern - \li Qt.Dense5Pattern - \li Qt.Dense6Pattern - \li Qt.Dense7Pattern - \li Qt.HorPattern - \li Qt.VerPattern - \li Qt.CrossPattern - \li Qt.BDiagPattern - \li Qt.FDiagPattern - \li Qt.DiagCrossPattern -\endlist + \qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode) + This is an overloaded function. + Returns a CanvasPattern object that uses the given \a color and \a patternMode. + The valid pattern modes are: + + \value Qt.SolidPattern Qt::SolidPattern + \value Qt.Dense1Pattern Qt::Dense1Pattern + \value Qt.Dense2Pattern Qt::Dense2Pattern + \value Qt.Dense3Pattern Qt::Dense3Pattern + \value Qt.Dense4Pattern Qt::Dense4Pattern + \value Qt.Dense5Pattern Qt::Dense5Pattern + \value Qt.Dense6Pattern Qt::Dense6Pattern + \value Qt.Dense7Pattern Qt::Dense7Pattern + \value Qt.HorPattern Qt::HorPattern + \value Qt.VerPattern Qt::VerPattern + \value Qt.CrossPattern Qt::CrossPattern + \value Qt.BDiagPattern Qt::BDiagPattern + \value Qt.FDiagPattern Qt::FDiagPattern + \value Qt.DiagCrossPattern Qt::DiagCrossPattern + \sa Qt::BrushStyle - */ +*/ /*! - \qmlmethod variant QtQuick::Context2D::createPattern(Image image, string repetition) - Returns a CanvasPattern object that uses the given image and repeats in the direction(s) given by the repetition argument. + \qmlmethod variant QtQuick::Context2D::createPattern(Image image, string repetition) + Returns a CanvasPattern object that uses the given image and repeats in the + direction(s) given by the repetition argument. - The \a image parameter must be a valid Image item, a valid CanvasImageData object or loaded image url, if there is no image data, throws an INVALID_STATE_ERR exception. + The \a image parameter must be a valid Image item, a valid CanvasImageData + object or loaded image url. If there is no image data, thus function throws an + INVALID_STATE_ERR exception. - The allowed values for \a repetition are: + The allowed values for \a repetition are: - \list - \li "repeat" - both directions - \li "repeat-x - horizontal only - \li "repeat-y" - vertical only - \li "no-repeat" - neither - \endlist + \value "repeat" both directions + \value "repeat-x horizontal only + \value "repeat-y" vertical only + \value "no-repeat" neither - If the repetition argument is empty or null, the value "repeat" is used. + If the repetition argument is empty or null, the value "repeat" is used. - \sa strokeStyle - \sa fillStyle - */ + \sa strokeStyle + \sa fillStyle +*/ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) { QV4::Scope scope(b); @@ -1827,13 +1881,20 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(const QV4::F // line styles /*! \qmlproperty string QtQuick::Context2D::lineCap - Holds the current line cap style. - The possible line cap styles are: - \list - \li butt - the end of each line has a flat edge perpendicular to the direction of the line, this is the default line cap value. - \li round - a semi-circle with the diameter equal to the width of the line must then be added on to the end of the line. - \li square - a rectangle with the length of the line width and the width of half the line width, placed flat against the edge perpendicular to the direction of the line. - \endlist + Holds the current line cap style. + The possible line cap styles are: + + \value "butt" + (default) Qt::FlatCap the end of each line has a flat edge + perpendicular to the direction of the line. + \value "round" + Qt::RoundCap a semi-circle with the diameter equal to the width of the + line is added on to the end of the line. + \value "square" + Qt::SquareCap a rectangle with the length of the line width and the + width of half the line width, placed flat against the edge + perpendicular to the direction of the line. + Other values are ignored. */ QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) @@ -1883,16 +1944,18 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(const QV4::FunctionObje /*! \qmlproperty string QtQuick::Context2D::lineJoin - Holds the current line join style. A join exists at any point in a subpath - shared by two consecutive lines. When a subpath is closed, then a join also exists - at its first point (equivalent to its last point) connecting the first and last lines in the subpath. + Holds the current line join style. A join exists at any point in a subpath + shared by two consecutive lines. When a subpath is closed, then a join also + exists at its first point (equivalent to its last point) connecting the + first and last lines in the subpath. The possible line join styles are: - \list - \li bevel - this is all that is rendered at joins. - \li round - a filled arc connecting the two aforementioned corners of the join, abutting (and not overlapping) the aforementioned triangle, with the diameter equal to the line width and the origin at the point of the join, must be rendered at joins. - \li miter - a second filled triangle must (if it can given the miter length) be rendered at the join, this is the default line join style. - \endlist + + \value "bevel" Qt::BevelJoin The triangular notch between the two lines is filled. + \value "round" Qt::RoundJoin A circular arc between the two lines is filled. + \value "miter" (default) Qt::MiterJoin The outer edges of the lines are extended to + meet at an angle, and this area is filled. + Other values are ignored. */ QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) @@ -2825,19 +2888,20 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(const QV4::FunctionObject } /*! - \qmlproperty string QtQuick::Context2D::textAlign - - Holds the current text alignment settings. - The possible values are: - \list - \li start - \li end - \li left - \li right - \li center - \endlist - Other values are ignored. The default value is "start". - */ + \qmlproperty string QtQuick::Context2D::textAlign + + Holds the current text alignment settings. The possible values are: + + \value "start" (default) Align to the start edge of the text (left side in + left-to-right text, right side in right-to-left text). + \value "end" Align to the end edge of the text (right side in left-to-right + text, left side in right-to-left text). + \value "left" Qt::AlignLeft + \value "right" Qt::AlignRight + \value "center" Qt::AlignHCenter + + Other values are ignored. +*/ QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(b); @@ -2892,20 +2956,19 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(const QV4::FunctionOb } /*! - \qmlproperty string QtQuick::Context2D::textBaseline - - Holds the current baseline alignment settings. - The possible values are: - \list - \li top - \li hanging - \li middle - \li alphabetic - \li ideographic - \li bottom - \endlist - Other values are ignored. The default value is "alphabetic". - */ + \qmlproperty string QtQuick::Context2D::textBaseline + + Holds the current baseline alignment settings. The possible values are: + + \value "top" The top of the em square + \value "hanging" The hanging baseline + \value "middle" The middle of the em square + \value "alphabetic" (default) The alphabetic baseline + \value "ideographic" The ideographic-under baseline + \value "bottom" The bottom of the em square + + Other values are ignored. The default value is "alphabetic". +*/ QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(b); diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 9a1c3cc1c1..3ae28deaf6 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -99,9 +99,8 @@ QT_BEGIN_NAMESPACE \image qml-borderimage-normal-image.png \endfloat - An unscaled image is displayed using an Image. The \l border property is - used to determine the parts of the image that will lie inside the unscaled corner - areas and the parts that will be stretched horizontally and vertically. + For comparison, an unscaled image is displayed using a simple Image item. + Here we have overlaid lines to show how we'd like to break it up with BorderImage: \snippet qml/borderimage/normal-image.qml normal image @@ -110,12 +109,15 @@ QT_BEGIN_NAMESPACE \image qml-borderimage-scaled.png \endfloat - A BorderImage is used to display the image, and it is given a size that is + But when a BorderImage is used to display the image, the \l border property is + used to determine the parts of the image that will lie inside the unscaled corner + areas, and the parts that will be stretched horizontally and vertically. + Then, you can give it a size that is larger than the original image. Since the \l horizontalTileMode property is set to \l{BorderImage::horizontalTileMode}{BorderImage.Stretch}, the parts of image in regions 2 and 8 are stretched horizontally. Since the \l verticalTileMode property is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image - in regions 4 and 6 are stretched vertically. + in regions 4 and 6 are stretched vertically: \snippet qml/borderimage/borderimage-scaled.qml scaled border image @@ -128,17 +130,25 @@ QT_BEGIN_NAMESPACE \l horizontalTileMode property set to \l{BorderImage::horizontalTileMode}{BorderImage.Repeat}, the parts of image in regions 2 and 8 are tiled so that they fill the space at the top and bottom of the item. Similarly, the \l verticalTileMode property is set to - \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions - 4 and 6 are tiled so that they fill the space at the left and right of the item. + \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, so the parts of image in regions + 4 and 6 are tiled to fill the space at the left and right of the item: \snippet qml/borderimage/borderimage-tiled.qml tiled border image \clearfloat + \beginfloatleft + \image qml-borderimage-rounded.png + \endfloat + In some situations, the width of regions 2 and 8 may not be an exact multiple of the width of the corresponding regions in the source image. Similarly, the height of regions 4 and 6 - may not be an exact multiple of the height of the corresponding regions. It can be useful - to use \l{BorderImage::horizontalTileMode}{BorderImage.Round} instead of - \l{BorderImage::horizontalTileMode}{BorderImage.Repeat} in cases like these. + may not be an exact multiple of the height of the corresponding regions. If you use + \l{BorderImage::horizontalTileMode}{BorderImage.Round} mode, it will choose an integer + number of tiles and shrink them to fit: + + \snippet qml/borderimage/borderimage-rounded.qml tiled border image + + \clearfloat The Border Image example in \l{Qt Quick Examples - Image Elements} shows how a BorderImage can be used to simulate a shadow effect on a rectangular item. @@ -185,12 +195,10 @@ QQuickBorderImage::~QQuickBorderImage() This property describes the status of image loading. It can be one of: - \list - \li BorderImage.Null - no image has been set - \li BorderImage.Ready - the image has been loaded - \li BorderImage.Loading - the image is currently being loaded - \li BorderImage.Error - an error occurred while loading the image - \endlist + \value BorderImage.Null No image has been set + \value BorderImage.Ready The image has been loaded + \value BorderImage.Loading The image is currently being loaded + \value BorderImage.Error An error occurred while loading the image \sa progress */ @@ -368,11 +376,9 @@ QQuickScaleGrid *QQuickBorderImage::border() This property describes how to repeat or stretch the middle parts of the border image. - \list - \li BorderImage.Stretch - Scales the image to fit to the available area. - \li BorderImage.Repeat - Tile the image until there is no more space. May crop the last image. - \li BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. - \endlist + \value BorderImage.Stretch Scales the image to fit to the available area. + \value BorderImage.Repeat Tile the image until there is no more space. May crop the last image. + \value BorderImage.Round Like Repeat, but scales the images down to ensure that the last image is not cropped. The default tile mode for each property is BorderImage.Stretch. */ diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index ba81028822..1f10be412c 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -567,11 +567,9 @@ void QQuickDragAttached::setProposedAction(Qt::DropAction action) A drag can also be started manually using \l startDrag. - \list - \li Drag.None - do not start drags automatically - \li Drag.Automatic - start drags automatically - \li Drag.Internal (default) - start backwards compatible drags automatically - \endlist + \value Drag.None do not start drags automatically + \value Drag.Automatic start drags automatically + \value Drag.Internal (default) start backwards compatible drags automatically When using \c Drag.Automatic you should also define \l mimeData and bind the \l active property to the active property of MouseArea : \l {MouseArea::drag.active} @@ -666,12 +664,10 @@ void QQuickDragAttached::start(QQmlV4Function *args) The returned drop action may be one of: - \list - \li Qt.CopyAction Copy the data to the target - \li Qt.MoveAction Move the data from the source to the target - \li Qt.LinkAction Create a link from the source to the target. - \li Qt.IgnoreAction Ignore the action (do nothing with the data). - \endlist + \value Qt.CopyAction Copy the data to the target + \value Qt.MoveAction Move the data from the source to the target + \value Qt.LinkAction Create a link from the source to the target. + \value Qt.IgnoreAction Ignore the action (do nothing with the data). */ int QQuickDragAttached::drop() diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index 077574cbd1..2e797f2e0d 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -389,12 +389,10 @@ void QQuickDropArea::dropEvent(QDropEvent *event) The drop action may be one of: - \list - \li Qt.CopyAction Copy the data to the target. - \li Qt.MoveAction Move the data from the source to the target. - \li Qt.LinkAction Create a link from the source to the target. - \li Qt.IgnoreAction Ignore the action (do nothing with the data). - \endlist + \value Qt.CopyAction Copy the data to the target. + \value Qt.MoveAction Move the data from the source to the target. + \value Qt.LinkAction Create a link from the source to the target. + \value Qt.IgnoreAction Ignore the action (do nothing with the data). */ /*! diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index f9b5b80a92..b749cbe771 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -133,16 +133,15 @@ Item { This property holds the keyboard modifier flags that existed immediately before the event occurred. - It contains a bitwise combination of: - \list - \li \l {Qt::NoModifier} {Qt.NoModifier} - No modifier key is pressed. - \li \l {Qt::ShiftModifier} {Qt.ShiftModifier} - A Shift key on the keyboard is pressed. - \li \l {Qt::ControlModifier} {Qt.ControlModifier} - A Ctrl key on the keyboard is pressed. - \li \l {Qt::AltModifier} {Qt.AltModifier} - An Alt key on the keyboard is pressed. - \li \l {Qt::MetaModifier} {Qt.MetaModifier} - A Meta key on the keyboard is pressed. - \li \l {Qt::KeypadModifier} {Qt.KeypadModifier} - A keypad button is pressed. - \li \l {Qt::GroupSwitchModifier} {Qt.GroupSwitchModifier} - X11 only. A Mode_switch key on the keyboard is pressed. - \endlist + It contains a bitwise combination of numeric values (the same as in Qt::KeyboardModifier): + + \value Qt.NoModifier No modifier key is pressed. + \value Qt.ShiftModifier} A Shift key on the keyboard is pressed. + \value Qt.ControlModifier A Ctrl key on the keyboard is pressed. + \value Qt.AltModifier An Alt key on the keyboard is pressed. + \value Qt.MetaModifier A Meta key on the keyboard is pressed. + \value Qt.KeypadModifier A keypad button is pressed. + \value Qt.GroupSwitchModifier X11 only. A Mode_switch key on the keyboard is pressed. For example, to react to a Shift key + Enter key combination: \qml diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index e050561ac5..556ccd8e0f 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1484,8 +1484,15 @@ void QQuickFlickablePrivate::handleReleaseEvent(QPointerEvent *event) fixupX(); flickingStarted(flickedHorizontally, flickedVertically); - if (!isViewMoving()) + if (!isViewMoving()) { q->movementEnding(); + } else { + if (flickedVertically) + vMoved = true; + if (flickedHorizontally) + hMoved = true; + q->movementStarting(); + } } void QQuickFlickable::mousePressEvent(QMouseEvent *event) @@ -2566,6 +2573,18 @@ bool QQuickFlickable::filterPointerEvent(QQuickItem *receiver, QPointerEvent *ev if (isTouch && static_cast<QTouchEvent *>(event)->touchPointStates().testFlag(QEventPoint::State::Pressed)) d->stealMouse = false; const auto &firstPoint = event->points().first(); + + if (event->pointCount() == 1 && event->exclusiveGrabber(firstPoint) == this) { + // We have an exclusive grab (since we're e.g dragging), but at the same time, we have + // a child with a passive grab (which is why this filter is being called). And because + // of that, we end up getting the same pointer events twice; First in our own event + // handlers (because of the grab), then once more in here, since we filter the child. + // To avoid processing the event twice (e.g avoid calling handleReleaseEvent once more + // from below), we mark the event as filtered, and simply return. + event->setAccepted(true); + return true; + } + QPointF localPos = mapFromScene(firstPoint.scenePosition()); bool receiverDisabled = receiver && !receiver->isEnabled(); bool stealThisEvent = d->stealMouse; diff --git a/src/quick/items/qquickgraphicsinfo.cpp b/src/quick/items/qquickgraphicsinfo.cpp index 6e483e8447..3f4ddac99b 100644 --- a/src/quick/items/qquickgraphicsinfo.cpp +++ b/src/quick/items/qquickgraphicsinfo.cpp @@ -92,16 +92,15 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) This property describes the graphics API that is currently in use. The possible values are: - \list - \li GraphicsInfo.Unknown - the default value when no active scenegraph is associated with the item - \li GraphicsInfo.Software - Qt Quick's software renderer based on QPainter with the raster paint engine - \li GraphicsInfo.OpenVG - OpenVG - \li GraphicsInfo.OpenGL - OpenGL or OpenGL ES on top of QRhi, a graphics abstraction layer - \li GraphicsInfo.Direct3D11 - Direct3D 11 on top of QRhi, a graphics abstraction layer - \li GraphicsInfo.Vulkan - Vulkan on top of QRhi, a graphics abstraction layer - \li GraphicsInfo.Metal - Metal on top of QRhi, a graphics abstraction layer - \li GraphicsInfo.Null - Null (no output) on top of QRhi, a graphics abstraction layer - \endlist + + \value GraphicsInfo.Unknown the default value when no active scenegraph is associated with the item + \value GraphicsInfo.Software Qt Quick's software renderer based on QPainter with the raster paint engine + \value GraphicsInfo.OpenVG OpenVG + \value GraphicsInfo.OpenGL OpenGL or OpenGL ES on top of QRhi, a graphics abstraction layer + \value GraphicsInfo.Direct3D11 Direct3D 11 on top of QRhi, a graphics abstraction layer + \value GraphicsInfo.Vulkan Vulkan on top of QRhi, a graphics abstraction layer + \value GraphicsInfo.Metal Metal on top of QRhi, a graphics abstraction layer + \value GraphicsInfo.Null Null (no output) on top of QRhi, a graphics abstraction layer */ /*! @@ -110,12 +109,10 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) This property contains the shading language supported by the Qt Quick backend the application is using. - \list - \li GraphicsInfo.UnknownShadingLanguage - Not yet known due to no window and scenegraph associated - \li GraphicsInfo.GLSL - GLSL or GLSL ES - \li GraphicsInfo.HLSL - HLSL - \li GraphicsInfo.RhiShader - QShader - \endlist + \value GraphicsInfo.UnknownShadingLanguage Not yet known due to no window and scenegraph associated + \value GraphicsInfo.GLSL GLSL or GLSL ES + \value GraphicsInfo.HLSL HLSL + \value GraphicsInfo.RhiShader QShader \note The value is only up-to-date once the item is associated with a window. Bindings relying on the value have to keep this in mind since the @@ -136,10 +133,8 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) This property contains a bitmask of the shader compilation approaches supported by the Qt Quick backend the application is using. - \list - \li GraphicsInfo.RuntimeCompilation - \li GraphicsInfo.OfflineCompilation - \endlist + \value GraphicsInfo.RuntimeCompilation + \value GraphicsInfo.OfflineCompilation With OpenGL the value is GraphicsInfo.RuntimeCompilation, which corresponds to the traditional way of using ShaderEffect. Non-OpenGL backends are @@ -163,11 +158,9 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) This property contains a bitmask of the supported ways of providing shader sources. - \list - \li GraphicsInfo.ShaderSourceString - \li GraphicsInfo.ShaderSourceFile - \li GraphicsInfo.ShaderByteCode - \endlist + \value GraphicsInfo.ShaderSourceString + \value GraphicsInfo.ShaderSourceFile + \value GraphicsInfo.ShaderByteCode With OpenGL the value is GraphicsInfo.ShaderSourceString, which corresponds to the traditional way of inlining GLSL source code into QML. Other, @@ -218,11 +211,10 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) This property holds the configured OpenGL context profile. The possible values are: - \list - \li GraphicsInfo.OpenGLNoProfile (default) - OpenGL version is lower than 3.2 or OpenGL is not in use. - \li GraphicsInfo.OpenGLCoreProfile - Functionality deprecated in OpenGL version 3.0 is not available. - \li GraphicsInfo.OpenGLCompatibilityProfile - Functionality from earlier OpenGL versions is available. - \endlist + + \value GraphicsInfo.OpenGLNoProfile (default) OpenGL version is lower than 3.2 or OpenGL is not in use. + \value GraphicsInfo.OpenGLCoreProfile Functionality deprecated in OpenGL version 3.0 is not available. + \value GraphicsInfo.OpenGLCompatibilityProfile Functionality from earlier OpenGL versions is available. Reusable QML components will typically use this property in bindings in order to choose between core and non core profile compatible shader sources. @@ -239,11 +231,10 @@ QQuickGraphicsInfo *QQuickGraphicsInfo::qmlAttachedProperties(QObject *object) other than OpenGL. The possible values are: - \list - \li GraphicsInfo.SurfaceFormatUnspecified (default) - Unspecified rendering method - \li GraphicsInfo.SurfaceFormatOpenGL - Desktop OpenGL or other graphics API - \li GraphicsInfo.SurfaceFormatOpenGLES - OpenGL ES - \endlist + + \value GraphicsInfo.SurfaceFormatUnspecified (default) Unspecified rendering method + \value GraphicsInfo.SurfaceFormatOpenGL Desktop OpenGL or other graphics API + \value GraphicsInfo.SurfaceFormatOpenGLES OpenGL ES \note This is applicable only to OpenGL. diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 73fe84fdef..d94ccddcbc 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1467,36 +1467,32 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) Valid values for \c highlightRangeMode are: - \list - \li GridView.ApplyRange - the view attempts to maintain the highlight within the range. + \value GridView.ApplyRange the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the view or due to mouse interaction. - \li GridView.StrictlyEnforceRange - the highlight never moves outside of the range. + \value GridView.StrictlyEnforceRange the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range. - \li GridView.NoHighlightRange - this is the default value. - \endlist + \value GridView.NoHighlightRange the default value */ /*! - \qmlproperty enumeration QtQuick::GridView::layoutDirection - This property holds the layout direction of the grid. + \qmlproperty enumeration QtQuick::GridView::layoutDirection + This property holds the layout direction of the grid. Possible values: - \list - \li Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is - dependent on the \l GridView::flow property. - \li Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent - on the \l GridView::flow property. - \endlist + \value Qt.LeftToRight (default) Items will be laid out starting in the top, left corner. The flow is + dependent on the \l GridView::flow property. + \value Qt.RightToLeft Items will be laid out starting in the top, right corner. The flow is dependent + on the \l GridView::flow property. - \b Note: If GridView::flow is set to GridView.FlowLeftToRight, this is not to be confused if - GridView::layoutDirection is set to Qt.RightToLeft. The GridView.FlowLeftToRight flow value simply - indicates that the flow is horizontal. + \b Note: If GridView::flow is set to GridView.FlowLeftToRight, this is not to be confused if + GridView::layoutDirection is set to Qt.RightToLeft. The GridView.FlowLeftToRight flow value simply + indicates that the flow is horizontal. - \sa GridView::effectiveLayoutDirection, GridView::verticalLayoutDirection + \sa GridView::effectiveLayoutDirection, GridView::verticalLayoutDirection */ @@ -1517,10 +1513,8 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) Possible values: - \list - \li GridView.TopToBottom (default) - Items are laid out from the top of the view down to the bottom of the view. - \li GridView.BottomToTop - Items are laid out from the bottom of the view up to the top of the view. - \endlist + \value GridView.TopToBottom (default) Items are laid out from the top of the view down to the bottom of the view. + \value GridView.BottomToTop Items are laid out from the bottom of the view up to the top of the view. \sa GridView::layoutDirection */ @@ -1628,10 +1622,8 @@ void QQuickGridView::setHighlightMoveDuration(int duration) Possible values: - \list - \li GridView.FlowLeftToRight (default) - Items are laid out from left to right, and the view scrolls vertically - \li GridView.FlowTopToBottom - Items are laid out from top to bottom, and the view scrolls horizontally - \endlist + \value GridView.FlowLeftToRight (default) Items are laid out from left to right, and the view scrolls vertically + \value GridView.FlowTopToBottom Items are laid out from top to bottom, and the view scrolls horizontally */ QQuickGridView::Flow QQuickGridView::flow() const { @@ -1706,15 +1698,12 @@ void QQuickGridView::setCellHeight(qreal cellHeight) This property determines how the view scrolling will settle following a drag or flick. The possible values are: - \list - \li GridView.NoSnap (default) - the view stops anywhere within the visible area. - \li GridView.SnapToRow - the view settles with a row (or column for \c GridView.FlowTopToBottom flow) - aligned with the start of the view. - \li GridView.SnapOneRow - the view will settle no more than one row (or column for \c GridView.FlowTopToBottom flow) - away from the first visible row at the time the mouse button is released. - This mode is particularly useful for moving one page at a time. - \endlist - + \value GridView.NoSnap (default) the view stops anywhere within the visible area. + \value GridView.SnapToRow the view settles with a row (or column for \c GridView.FlowTopToBottom flow) + aligned with the start of the view. + \value GridView.SnapOneRow the view will settle no more than one row (or column for \c GridView.FlowTopToBottom flow) + away from the first visible row at the time the mouse button is released. + This mode is particularly useful for moving one page at a time. */ QQuickGridView::SnapMode QQuickGridView::snapMode() const { @@ -2610,18 +2599,15 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co Positions the view such that the \a index is at the position specified by \a mode: - \list - \li GridView.Beginning - position item at the top (or left for \c GridView.FlowTopToBottom flow) of the view. - \li GridView.Center - position item in the center of the view. - \li GridView.End - position item at bottom (or right for horizontal orientation) of the view. - \li GridView.Visible - if any part of the item is visible then take no action, otherwise - bring the item into view. - \li GridView.Contain - ensure the entire item is visible. If the item is larger than - the view the item is positioned at the top (or left for \c GridView.FlowTopToBottom flow) of the view. - \li GridView.SnapPosition - position the item at \l preferredHighlightBegin. This mode - is only valid if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled - via \l snapMode. - \endlist + \value GridView.Beginning position item at the top (or left for \c GridView.FlowTopToBottom flow) of the view. + \value GridView.Center position item in the center of the view. + \value GridView.End position item at bottom (or right for horizontal orientation) of the view. + \value GridView.Visible if any part of the item is visible then take no action, otherwise + bring the item into view. + \value GridView.Contain ensure the entire item is visible. If the item is larger than the view, the item + is positioned at the top (or left for \c GridView.FlowTopToBottom flow) of the view. + \value GridView.SnapPosition position the item at \l preferredHighlightBegin. This mode is only valid if + \l highlightRangeMode is \c StrictlyEnforceRange or snapping is enabled via \l snapMode. If positioning the view at the index would cause empty space to be displayed at the beginning or end of the view, the view will be positioned at the boundary. diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 4426c26cab..88f58cc0fa 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -151,6 +151,43 @@ QQuickImagePrivate::QQuickImagePrivate() convert foo.png \( +clone -alpha Extract \) -channel RGB -compose Multiply -composite foo_pm.png \endcode + Do not confuse container formats, such as, \c KTX, and the format of the + actual texture data stored in the container file. For example, reading a + \c KTX file is supported on all platforms, independently of what GPU driver is + used at run time. However, this does not guarantee that the compressed + texture format, used by the data in the file, is supported at run time. For + example, if the KTX file contains compressed data with the format + \c{ETC2 RGBA8}, and the 3D graphics API implementation used at run time does not + support \c ETC2 compressed textures, the Image item will not display + anything. + + \note Compressed texture format support is not under Qt's control, and it + is up to the application or device developer to ensure the compressed + texture data is provided in the appropriate format for the target + environment(s). + + Do not assume that compressed format support is specific to a platform. It + may also be specific to the driver and 3D API implementation in use on that + particular platform. In practice, implementations of different 3D graphics + APIs (e.g., Vulkan and OpenGL) on the same platform (e.g., Windows) from + the same vendor for the same hardware may offer a different set of + compressed texture formats. + + When targeting desktop environments (Windows, macOS, Linux) only, a general + recommendation is to consider using the \c{DXTn}/\c{BCn} formats since + these tend to have the widest support amongst the implementations of Direct + 3D, Vulkan, OpenGL, and Metal on these platforms. In contrast, when + targeting mobile or embedded devices, the \c ETC2 or \c ASTC formats are + likely to be a better choice since these are typically the formats + supported by the OpenGL ES implementations on such hardware. + + An application that intends to run across desktop, mobile, and embedded + hardware should plan and design its use of compressed textures carefully. + It is highly likely that relying on a single format is not going to be + sufficient, and therefore the application will likely need to branch based + on the platform to use compressed textures in a format appropriate there, + or perhaps to skip using compressed textures in some cases. + \section1 Automatic Detection of File Extension If the \l source URL indicates a non-existing local file or resource, the @@ -241,15 +278,14 @@ void QQuickImagePrivate::setPixmap(const QQuickPixmap &pixmap) Set this property to define what happens when the source image has a different size than the item. - \list - \li Image.Stretch - the image is scaled to fit - \li Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping - \li Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary - \li Image.Tile - the image is duplicated horizontally and vertically - \li Image.TileVertically - the image is stretched horizontally and tiled vertically - \li Image.TileHorizontally - the image is stretched vertically and tiled horizontally - \li Image.Pad - the image is not transformed - \endlist + + \value Image.Stretch the image is scaled to fit + \value Image.PreserveAspectFit the image is scaled uniformly to fit without cropping + \value Image.PreserveAspectCrop the image is scaled uniformly to fill, cropping if necessary + \value Image.Tile the image is duplicated horizontally and vertically + \value Image.TileVertically the image is stretched horizontally and tiled vertically + \value Image.TileHorizontally the image is stretched vertically and tiled horizontally + \value Image.Pad the image is not transformed \table @@ -384,12 +420,11 @@ qreal QQuickImage::paintedHeight() const \readonly This property holds the status of image loading. It can be one of: - \list - \li Image.Null - no image has been set - \li Image.Ready - the image has been loaded - \li Image.Loading - the image is currently being loaded - \li Image.Error - an error occurred while loading the image - \endlist + + \value Image.Null No image has been set + \value Image.Ready The image has been loaded + \value Image.Loading The image is currently being loaded + \value Image.Error An error occurred while loading the image Use this status to provide an update or respond to the status change in some way. For example, you could: diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index dfa88c0a04..486acfdc01 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -597,14 +597,12 @@ void QQuickKeyNavigationAttached::setBacktab(QQuickItem *i) This property determines whether the keys are processed before or after the attached item's own key handling. - \list - \li KeyNavigation.BeforeItem - process the key events before normal - item key processing. If the event is used for key navigation, it will be accepted and will not - be passed on to the item. - \li KeyNavigation.AfterItem (default) - process the key events after normal item key - handling. If the item accepts the key event it will not be - handled by the KeyNavigation attached property handler. - \endlist + \value KeyNavigation.BeforeItem process the key events before normal + item key processing. If the event is used for key navigation, it will be accepted and + will not be passed on to the item. + \value KeyNavigation.AfterItem (default) process the key events after normal item key + handling. If the item accepts the key event it will not be + handled by the KeyNavigation attached property handler. */ QQuickKeyNavigationAttached::Priority QQuickKeyNavigationAttached::priority() const { @@ -897,14 +895,11 @@ bool QQuickKeysAttached::isConnected(const char *signalName) const This property determines whether the keys are processed before or after the attached item's own key handling. - \list - \li Keys.BeforeItem (default) - process the key events before normal - item key processing. If the event is accepted it will not - be passed on to the item. - \li Keys.AfterItem - process the key events after normal item key - handling. If the item accepts the key event it will not be - handled by the Keys attached property handler. - \endlist + \value Keys.BeforeItem (default) process the key events before normal item key processing. + If the event is accepted, it will not be passed on to the item. + \value Keys.AfterItem process the key events after normal item key handling. If the item + accepts the key event, it will not be handled by the + Keys attached property handler. \sa {Key Handling Priorities} */ @@ -2404,7 +2399,7 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item) return true; #if QT_CONFIG(accessibility) - QAccessible::Role role = QQuickItemPrivate::get(item)->accessibleRole(); + QAccessible::Role role = QQuickItemPrivate::get(item)->effectiveAccessibleRole(); if (role == QAccessible::EditableText || role == QAccessible::Table || role == QAccessible::List) { return true; } else if (role == QAccessible::ComboBox || role == QAccessible::SpinBox) { @@ -8999,11 +8994,12 @@ void QQuickItemLayer::setMipmap(bool mipmap) specified. Depending on the OpenGL implementation, this property might allow you to save some texture memory. - \list - \li ShaderEffectSource.Alpha - GL_ALPHA; - \li ShaderEffectSource.RGB - GL_RGB - \li ShaderEffectSource.RGBA - GL_RGBA - \endlist + \value ShaderEffectSource.RGBA8 GL_ALPHA + \value ShaderEffectSource.RGBA16F GL_RGB + \value ShaderEffectSource.RGBA32F GL_RGBA + \value ShaderEffectSource.Alpha Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. + \value ShaderEffectSource.RGB Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. + \value ShaderEffectSource.RGBA Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. \note ShaderEffectSource.RGB and ShaderEffectSource.Alpha should be used with caution, as support for these formats in the underlying @@ -9104,12 +9100,10 @@ void QQuickItemLayer::setSize(const QSize &size) Modifying this property makes most sense when the \a layer.effect is specified. - \list - \li ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically - \li ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically - \li ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically - \li ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically - \endlist + \value ShaderEffectSource.ClampToEdge GL_CLAMP_TO_EDGE both horizontally and vertically + \value ShaderEffectSource.RepeatHorizontally GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically + \value ShaderEffectSource.RepeatVertically GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically + \value ShaderEffectSource.Repeat GL_REPEAT both horizontally and vertically \note Some OpenGL ES 2 implementations do not support the GL_REPEAT wrap mode with non-power-of-two textures. @@ -9139,11 +9133,9 @@ void QQuickItemLayer::setWrapMode(QQuickShaderEffectSource::WrapMode mode) such as those specified by ShaderEffect. If no effect is specified for the layered item, mirroring has no effect on the UI representation of the item. - \list - \li ShaderEffectSource.NoMirroring - No mirroring - \li ShaderEffectSource.MirrorHorizontally - The generated texture is flipped along X-axis. - \li ShaderEffectSource.MirrorVertically - The generated texture is flipped along Y-axis. - \endlist + \value ShaderEffectSource.NoMirroring No mirroring + \value ShaderEffectSource.MirrorHorizontally The generated texture is flipped along X-axis. + \value ShaderEffectSource.MirrorVertically The generated texture is flipped along Y-axis. */ void QQuickItemLayer::setTextureMirroring(QQuickShaderEffectSource::TextureMirroring mirroring) @@ -9322,13 +9314,20 @@ QQuickItemPrivate::ExtraData::ExtraData() #if QT_CONFIG(accessibility) -QAccessible::Role QQuickItemPrivate::accessibleRole() const +QAccessible::Role QQuickItemPrivate::effectiveAccessibleRole() const { Q_Q(const QQuickItem); - QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, false)); - if (accessibleAttached) - return accessibleAttached->role(); + auto *attached = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, false); + auto role = QAccessible::NoRole; + if (auto *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(attached)) + role = accessibleAttached->role(); + if (role == QAccessible::NoRole) + role = accessibleRole(); + return role; +} +QAccessible::Role QQuickItemPrivate::accessibleRole() const +{ return QAccessible::NoRole; } #endif diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 4406e191cb..d4c9464fe9 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -627,7 +627,10 @@ public: virtual void implicitHeightChanged(); #if QT_CONFIG(accessibility) + QAccessible::Role effectiveAccessibleRole() const; +private: virtual QAccessible::Role accessibleRole() const; +public: #endif void setImplicitAntialiasing(bool antialiasing); diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 58f031a9eb..a4c0a8b740 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2479,15 +2479,13 @@ QQuickListView::~QQuickListView() Valid values for \c highlightRangeMode are: - \list - \li ListView.ApplyRange - the view attempts to maintain the highlight within the range. - However, the highlight can move outside of the range at the ends of the list or due - to mouse interaction. - \li ListView.StrictlyEnforceRange - the highlight never moves outside of the range. - The current item changes if a keyboard or mouse action would cause the highlight to move - outside of the range. - \li ListView.NoHighlightRange - this is the default value. - \endlist + \value ListView.ApplyRange the view attempts to maintain the highlight within the range. + However, the highlight can move outside of the range at the + ends of the list or due to mouse interaction. + \value ListView.StrictlyEnforceRange the highlight never moves outside of the range. + The current item changes if a keyboard or mouse action would + cause the highlight to move outside of the range. + \value ListView.NoHighlightRange this is the default value. */ void QQuickListView::setHighlightFollowsCurrentItem(bool autoHighlight) { @@ -2534,10 +2532,8 @@ void QQuickListView::setSpacing(qreal spacing) Possible values: - \list - \li ListView.Horizontal - Items are laid out horizontally - \li ListView.Vertical (default) - Items are laid out vertically - \endlist + \value ListView.Horizontal Items are laid out horizontally + \value ListView.Vertical (default) Items are laid out vertically \table \row @@ -2588,10 +2584,8 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) Possible values: - \list - \li Qt.LeftToRight (default) - Items will be laid out from left to right. - \li Qt.RightToLeft - Items will be laid out from right to left. - \endlist + \value Qt.LeftToRight (default) Items will be laid out from left to right. + \value Qt.RightToLeft Items will be laid out from right to left. Setting this property has no effect if the \l orientation is Qt.Vertical. @@ -2617,10 +2611,8 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) Possible values: - \list - \li ListView.TopToBottom (default) - Items are laid out from the top of the view down to the bottom of the view. - \li ListView.BottomToTop - Items are laid out from the bottom of the view up to the top of the view. - \endlist + \value ListView.TopToBottom (default) Items are laid out from the top of the view down to the bottom of the view. + \value ListView.BottomToTop Items are laid out from the bottom of the view up to the top of the view. Setting this property has no effect if the \l orientation is Qt.Horizontal. @@ -2728,13 +2720,11 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) \c section.criteria holds the criteria for forming each section based on \c section.property. This value can be one of: - \list - \li ViewSection.FullString (default) - sections are created based on the - \c section.property value. - \li ViewSection.FirstCharacter - sections are created based on the first - character of the \c section.property value (for example, 'A', 'B', 'C' - sections, etc. for an address book) - \endlist + \value ViewSection.FullString (default) sections are created based on the + \c section.property value. + \value ViewSection.FirstCharacter sections are created based on the first character of + the \c section.property value (for example, + 'A', 'B', 'C' ... sections for an address book.) A case insensitive comparison is used when determining section boundaries. @@ -2748,16 +2738,17 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) next section labels stick to the start/end of the view, and whether the labels are shown inline. This value can be a combination of: - \list - \li ViewSection.InlineLabels - section labels are shown inline between - the item delegates separating sections (default). - \li ViewSection.CurrentLabelAtStart - the current section label sticks to the - start of the view as it is moved. - \li ViewSection.NextLabelAtEnd - the next section label (beyond all visible - sections) sticks to the end of the view as it is moved. \note Enabling - \c ViewSection.NextLabelAtEnd requires the view to scan ahead for the next - section, which has performance implications, especially for slower models. - \endlist + \value ViewSection.InlineLabels + (default) section labels are shown inline between the item delegates + separating sections. + \value ViewSection.CurrentLabelAtStart + the current section label sticks to the start of the view as it is moved. + \value ViewSection.NextLabelAtEnd + the next section label (beyond all visible sections) sticks to the end + of the view as it is moved. + \note Enabling \c ViewSection.NextLabelAtEnd requires the view to scan + ahead for the next section, which has performance implications, + especially for slower models. Each item in the list has attached properties named \c ListView.section, \c ListView.previousSection and \c ListView.nextSection. @@ -2908,18 +2899,14 @@ void QQuickListView::setHighlightResizeDuration(int duration) This property determines how the view scrolling will settle following a drag or flick. The possible values are: - \list - \li ListView.NoSnap (default) - the view stops anywhere within the visible area. - \li ListView.SnapToItem - the view settles with an item aligned with the start of - the view. - \li ListView.SnapOneItem - the view settles no more than one item away from the first - visible item at the time the mouse button is released. This mode is particularly - useful for moving one page at a time. When SnapOneItem is enabled, the ListView will - show a stronger affinity to neighboring items when movement occurs. For example, a - short drag that snaps back to the current item with SnapToItem might snap to a - neighboring item with SnapOneItem. - - \endlist + \value ListView.NoSnap (default) the view stops anywhere within the visible area. + \value ListView.SnapToItem the view settles with an item aligned with the start of the view. + \value ListView.SnapOneItem the view settles no more than one item away from the first + visible item at the time the mouse button is released. This mode is particularly + useful for moving one page at a time. When SnapOneItem is enabled, the ListView will + show a stronger affinity to neighboring items when movement occurs. For example, a + short drag that snaps back to the current item with SnapToItem might snap to a + neighboring item with SnapOneItem. \c snapMode does not affect the \l currentIndex. To update the \l currentIndex as the list is moved, set \l highlightRangeMode @@ -3844,21 +3831,17 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex /*! \qmlmethod QtQuick::ListView::positionViewAtIndex(int index, PositionMode mode) - Positions the view such that the \a index is at the position specified by - \a mode: - - \list - \li ListView.Beginning - position item at the top (or left for horizontal orientation) of the view. - \li ListView.Center - position item in the center of the view. - \li ListView.End - position item at bottom (or right for horizontal orientation) of the view. - \li ListView.Visible - if any part of the item is visible then take no action, otherwise - bring the item into view. - \li ListView.Contain - ensure the entire item is visible. If the item is larger than - the view the item is positioned at the top (or left for horizontal orientation) of the view. - \li ListView.SnapPosition - position the item at \l preferredHighlightBegin. This mode - is only valid if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled - via \l snapMode. - \endlist + Positions the view such that the \a index is at the position specified by \a mode: + + \value ListView.Beginning position item at the top (or left for horizontal orientation) of the view. + \value ListView.Center position item in the center of the view. + \value ListView.End position item at bottom (or right for horizontal orientation) of the view. + \value ListView.Visible if any part of the item is visible then take no action, otherwise + bring the item into view. + \value ListView.Contain ensure the entire item is visible. If the item is larger than the view, + the item is positioned at the top (or left for horizontal orientation) of the view. + \value ListView.SnapPosition position the item at \l preferredHighlightBegin. This mode is only valid + if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled via \l snapMode. If positioning the view at \a index would cause empty space to be displayed at the beginning or end of the view, the view will be positioned at the boundary. diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index f714b98309..d86e4a4671 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -928,18 +928,16 @@ QQuickItem *QQuickPathView::highlightItem() const Valid values for \c highlightRangeMode are: - \list - \li \e PathView.NoHighlightRange - no range is applied and the - highlight will move freely within the view. - \li \e PathView.ApplyRange - the view will attempt to maintain - the highlight within the range, however the highlight can - move outside of the range at the ends of the path or due to - a mouse interaction. - \li \e PathView.StrictlyEnforceRange - the highlight will never - move outside of the range. This means that the current item - will change if a keyboard or mouse action would cause the - highlight to move outside of the range. - \endlist + \value PathView.NoHighlightRange no range is applied: the highlight + will move freely within the view. + \value PathView.ApplyRange the view will attempt to maintain the highlight + within the range, however the highlight can move + outside of the range at the ends of the path or + due to a mouse interaction. + \value PathView.StrictlyEnforceRange the highlight will never move outside of the range. + This means that the current item will change if a + keyboard or mouse action would cause the highlight + to move outside of the range. The default value is \e PathView.StrictlyEnforceRange. @@ -1346,13 +1344,11 @@ void QQuickPathView::setCacheItemCount(int i) This property determines how the items will settle following a drag or flick. The possible values are: - \list - \li PathView.NoSnap (default) - the items stop anywhere along the path. - \li PathView.SnapToItem - the items settle with an item aligned with the \l preferredHighlightBegin. - \li PathView.SnapOneItem - the items settle no more than one item away from the item nearest + \value PathView.NoSnap (default) the items stop anywhere along the path. + \value PathView.SnapToItem the items settle with an item aligned with the \l preferredHighlightBegin. + \value PathView.SnapOneItem the items settle no more than one item away from the item nearest \l preferredHighlightBegin at the time the press is released. This mode is particularly useful for moving one page at a time. - \endlist \c snapMode does not affect the \l currentIndex. To update the \l currentIndex as the view is moved, set \l highlightRangeMode @@ -1382,12 +1378,10 @@ void QQuickPathView::setSnapMode(SnapMode mode) This property determines the direction in which items move when setting the current index. The possible values are: - \list - \li PathView.Shortest (default) - the items move in the direction that requires the least - movement, which could be either \c Negative or \c Positive. - \li PathView.Negative - the items move backwards towards their destination. - \li PathView.Positive - the items move forwards towards their destination. - \endlist + \value PathView.Shortest (default) the items move in the direction that requires the least + movement, which could be either \c Negative or \c Positive. + \value PathView.Negative the items move backwards towards their destination. + \value PathView.Positive the items move forwards towards their destination. For example, suppose that there are 5 items in the model, and \l currentIndex is \c 0. If currentIndex is set to \c 2, @@ -1423,15 +1417,13 @@ void QQuickPathView::setMovementDirection(QQuickPathView::MovementDirection dir) Positions the view such that the \a index is at the position specified by \a mode: - \list - \li PathView.Beginning - position item at the beginning of the path. - \li PathView.Center - position item in the center of the path. - \li PathView.End - position item at the end of the path. - \li PathView.Contain - ensure the item is positioned on the path. - \li PathView.SnapPosition - position the item at \l preferredHighlightBegin. This mode - is only valid if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled - via \l snapMode. - \endlist + \value PathView.Beginning position item at the beginning of the path. + \value PathView.Center position item in the center of the path. + \value PathView.End position item at the end of the path. + \value PathView.Contain ensure the item is positioned on the path. + \value PathView.SnapPosition position the item at \l preferredHighlightBegin. This mode + is only valid if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled + via \l snapMode. \b Note: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 313143e881..b02c696169 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -1147,12 +1147,10 @@ QQuickRow::QQuickRow(QQuickItem *parent) Possible values: - \list - \li Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set, - the left anchor remains to the left of the row. - \li Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set, - the right anchor remains to the right of the row. - \endlist + \value Qt.LeftToRight (default) Items are laid out from left to right. If the width of the row is + explicitly set, the left anchor remains to the left of the row. + \value Qt.RightToLeft Items are laid out from right to left. If the width of the row is + explicitly set, the right anchor remains to the right of the row. \sa Grid::layoutDirection, Flow::layoutDirection, {Qt Quick Examples - Right to Left} */ diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp index 52c830c14a..a1063e5952 100644 --- a/src/quick/items/qquickrectangle.cpp +++ b/src/quick/items/qquickrectangle.cpp @@ -265,10 +265,9 @@ QQmlListProperty<QQuickGradientStop> QQuickGradient::stops() \since 5.12 Set this property to define the direction of the gradient. - \list - \li Gradient.Vertical - a vertical gradient - \li Gradient.Horizontal - a horizontal gradient - \endlist + + \value Gradient.Vertical a vertical gradient + \value Gradient.Horizontal a horizontal gradient The default is Gradient.Vertical. */ diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 5c2f113fdc..43f9828aca 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -775,11 +775,9 @@ void QQuickShaderEffect::setMesh(const QVariant &mesh) This property defines which sides of the item should be visible. - \list - \li ShaderEffect.NoCulling - Both sides are visible - \li ShaderEffect.BackFaceCulling - only front side is visible - \li ShaderEffect.FrontFaceCulling - only back side is visible - \endlist + \value ShaderEffect.NoCulling Both sides are visible + \value ShaderEffect.BackFaceCulling only the front side is visible + \value ShaderEffect.FrontFaceCulling only the back side is visible The default is NoCulling. */ @@ -830,11 +828,9 @@ void QQuickShaderEffect::setSupportsAtlasTextures(bool supports) This property tells the current status of the shaders. - \list - \li ShaderEffect.Compiled - the shader program was successfully compiled and linked. - \li ShaderEffect.Uncompiled - the shader program has not yet been compiled. - \li ShaderEffect.Error - the shader program failed to compile or link. - \endlist + \value ShaderEffect.Compiled the shader program was successfully compiled and linked. + \value ShaderEffect.Uncompiled the shader program has not yet been compiled. + \value ShaderEffect.Error the shader program failed to compile or link. When setting the fragment or vertex shader source code, the status will become Uncompiled. The first time the ShaderEffect is rendered with new diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index b298ed74da..d212ea6334 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -267,12 +267,10 @@ QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const The default value is \c{ShaderEffectSource.ClampToEdge}. - \list - \li ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically - \li ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically - \li ShaderEffectSource.RepeatVertically - GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically - \li ShaderEffectSource.Repeat - GL_REPEAT both horizontally and vertically - \endlist + \value ShaderEffectSource.ClampToEdge GL_CLAMP_TO_EDGE both horizontally and vertically + \value ShaderEffectSource.RepeatHorizontally GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically + \value ShaderEffectSource.RepeatVertically GL_CLAMP_TO_EDGE horizontally, GL_REPEAT vertically + \value ShaderEffectSource.Repeat GL_REPEAT both horizontally and vertically \note Some OpenGL ES 2 implementations do not support the GL_REPEAT wrap mode with non-power-of-two textures. @@ -419,11 +417,12 @@ void QQuickShaderEffectSource::setTextureSize(const QSize &size) source texture of a \l ShaderEffect. Depending on the OpenGL implementation, this property might allow you to save some texture memory. - \list - \li ShaderEffectSource.Alpha - GL_ALPHA - \li ShaderEffectSource.RGB - GL_RGB - \li ShaderEffectSource.RGBA - GL_RGBA - \endlist + \value ShaderEffectSource.RGBA8 GL_ALPHA + \value ShaderEffectSource.RGBA16F GL_RGB + \value ShaderEffectSource.RGBA32F GL_RGBA + \value ShaderEffectSource.Alpha Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. + \value ShaderEffectSource.RGB Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. + \value ShaderEffectSource.RGBA Starting with Qt 6.0, this value is not in use and has the same effect as \c RGBA8 in practice. \note Some OpenGL implementations do not support the GL_ALPHA format. */ @@ -557,11 +556,9 @@ void QQuickShaderEffectSource::setRecursive(bool enabled) such as those specified by ShaderEffect. Mirroring has no effect on the UI representation of the ShaderEffectSource item itself. - \list - \li ShaderEffectSource.NoMirroring - No mirroring - \li ShaderEffectSource.MirrorHorizontally - The generated texture is flipped along X-axis. - \li ShaderEffectSource.MirrorVertically - The generated texture is flipped along Y-axis. - \endlist + \value ShaderEffectSource.NoMirroring No mirroring + \value ShaderEffectSource.MirrorHorizontally The generated texture is flipped along X-axis. + \value ShaderEffectSource.MirrorVertically The generated texture is flipped along Y-axis. */ QQuickShaderEffectSource::TextureMirroring QQuickShaderEffectSource::textureMirroring() const diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index d16f0d0883..78d9cee7c0 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -1107,6 +1107,9 @@ void QQuickAnchorChanges::reverse() stateHAnchors != QQuickAnchors::LeftAnchor && stateHAnchors != QQuickAnchors::RightAnchor && stateHAnchors != QQuickAnchors::HCenterAnchor); + // in case of an additive AnchorChange, we _did_ end up modifying the width + stateSetWidth |= ((stateHAnchors & QQuickAnchors::LeftAnchor) && (origHAnchors & QQuickAnchors::RightAnchor)) || + ((stateHAnchors & QQuickAnchors::RightAnchor) && (origHAnchors & QQuickAnchors::LeftAnchor)); bool origSetWidth = (origHAnchors && origHAnchors != QQuickAnchors::LeftAnchor && origHAnchors != QQuickAnchors::RightAnchor && @@ -1122,12 +1125,15 @@ void QQuickAnchorChanges::reverse() stateVAnchors != QQuickAnchors::BottomAnchor && stateVAnchors != QQuickAnchors::VCenterAnchor && stateVAnchors != QQuickAnchors::BaselineAnchor); + // in case of an additive AnchorChange, we _did_ end up modifying the height + stateSetHeight |= ((stateVAnchors & QQuickAnchors::TopAnchor) && (origVAnchors & QQuickAnchors::BottomAnchor)) || + ((stateVAnchors & QQuickAnchors::BottomAnchor) && (origVAnchors & QQuickAnchors::TopAnchor)); bool origSetHeight = (origVAnchors && origVAnchors != QQuickAnchors::TopAnchor && origVAnchors != QQuickAnchors::BottomAnchor && origVAnchors != QQuickAnchors::VCenterAnchor && origVAnchors != QQuickAnchors::BaselineAnchor); - if (d->origHeight.isValid() && stateSetHeight && !origSetHeight && !!qt_is_nan(d->origHeight)) { + if (d->origHeight.isValid() && stateSetHeight && !origSetHeight && !qt_is_nan(d->origHeight)) { targetPrivate->heightValidFlag = true; if (targetPrivate->height != d->origHeight) targetPrivate->height.setValueBypassingBindings(d->origHeight); @@ -1141,7 +1147,12 @@ void QQuickAnchorChanges::reverse() const QRectF newGeometry(d->target->position(), d->target->size()); if (newGeometry != oldGeometry) { - targetPrivate->dirty(QQuickItemPrivate::Position); + QQuickItemPrivate::DirtyType dirtyFlags {}; + if (newGeometry.topLeft() != oldGeometry.topLeft()) + dirtyFlags = QQuickItemPrivate::DirtyType(dirtyFlags | QQuickItemPrivate::Position); + if (newGeometry.size() != oldGeometry.size()) + dirtyFlags = QQuickItemPrivate::DirtyType(dirtyFlags | QQuickItemPrivate::Size); + targetPrivate->dirty(dirtyFlags); d->target->geometryChange(newGeometry, oldGeometry); } } diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index ec1416768e..ce2010e489 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1483,17 +1483,16 @@ QQuickText::~QQuickText() The requested weight of the font. The weight requested must be an integer between 1 and 1000, or one of the predefined values: - \list - \li Font.Thin - \li Font.Light - \li Font.ExtraLight - \li Font.Normal - the default - \li Font.Medium - \li Font.DemiBold - \li Font.Bold - \li Font.ExtraBold - \li Font.Black - \endlist + + \value Font.Thin 100 + \value Font.ExtraLight 200 + \value Font.Light 300 + \value Font.Normal 400 (default) + \value Font.Medium 500 + \value Font.DemiBold 600 + \value Font.Bold 700 + \value Font.ExtraBold 800 + \value Font.Black 900 \qml Text { text: "Hello"; font.weight: Font.DemiBold } @@ -1557,13 +1556,12 @@ QQuickText::~QQuickText() Sets the capitalization for the text. - \list - \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. - \li Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \li Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \li Font.SmallCaps - This alters the text to be rendered in small-caps type. - \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. - \endlist + \value Font.MixedCase the normal case: no capitalization change is applied + \value Font.AllUppercase alters the text to be rendered in all uppercase type + \value Font.AllLowercase alters the text to be rendered in all lowercase type + \value Font.SmallCaps alters the text to be rendered in small-caps type + \value Font.Capitalize alters the text to be rendered with the first character of + each word as an uppercase character \qml Text { text: "Hello"; font.capitalization: Font.AllLowercase } @@ -1580,23 +1578,21 @@ QQuickText::~QQuickText() \note This property only has an effect when used together with render type Text.NativeRendering. - \list - \value Font.PreferDefaultHinting - Use the default hinting level for the target platform. - \value Font.PreferNoHinting - If possible, render text without hinting the outlines + \value Font.PreferDefaultHinting Use the default hinting level for the target platform. + \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs. The text layout will be typographically accurate, using the same metrics as are used e.g. when printing. - \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, + \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction. The text will appear crisper on displays where the density is too low to give an accurate rendering of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's layout will be scalable to higher density devices (such as printers) without impacting details such as line breaks. - \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and + \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions. The text will be altered to optimize legibility on the target device, but since the metrics will depend on the target size of the text, the positions of glyphs, line breaks, and other typographical detail will not scale, meaning that a text layout may look different on devices with different pixel densities. - \endlist \qml Text { text: "Hello"; renderType: Text.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } @@ -1838,12 +1834,11 @@ void QQuickText::setLinkColor(const QColor &color) Set an additional text style. Supported text styles are: - \list - \li Text.Normal - the default - \li Text.Outline - \li Text.Raised - \li Text.Sunken - \endlist + + \value Text.Normal - the default + \value Text.Outline + \value Text.Raised + \value Text.Sunken \qml Row { @@ -2043,12 +2038,17 @@ void QQuickText::setVAlign(VAlignment align) Set this property to wrap the text to the Text item's width. The text will only wrap if an explicit width has been set. wrapMode can be one of: - \list - \li Text.NoWrap (default) - no wrapping will be performed. If the text contains insufficient newlines, then \l contentWidth will exceed a set width. - \li Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, \l contentWidth will exceed a set width. - \li Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. - \li Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. - \endlist + \value Text.NoWrap + (default) no wrapping will be performed. If the text contains + insufficient newlines, then \l contentWidth will exceed a set width. + \value Text.WordWrap + wrapping is done on word boundaries only. If a word is too long, + \l contentWidth will exceed a set width. + \value Text.WrapAnywhere + wrapping is done at any point on a line, even if it occurs in the middle of a word. + \value Text.Wrap + if possible, wrapping occurs at a word boundary; otherwise it will occur + at the appropriate point on the line, even in the middle of a word. */ QQuickText::WrapMode QQuickText::wrapMode() const { @@ -2247,12 +2247,11 @@ void QQuickText::setTextFormat(TextFormat format) This property cannot be used with rich text. Eliding can be: - \list - \li Text.ElideNone - the default - \li Text.ElideLeft - \li Text.ElideMiddle - \li Text.ElideRight - \endlist + + \value Text.ElideNone - the default + \value Text.ElideLeft + \value Text.ElideMiddle + \value Text.ElideRight If this property is set to Text.ElideRight, it can be used with \l {wrapMode}{wrapped} text. The text will only elide if \c maximumLineCount, or \c height has been set. @@ -2611,11 +2610,9 @@ void QQuickText::setLineHeight(qreal lineHeight) This property determines how the line height is specified. The possible values are: - \list - \li Text.ProportionalHeight (default) - this sets the spacing proportional to the - line (as a multiplier). For example, set to 2 for double spacing. - \li Text.FixedHeight - this sets the line height to a fixed line height (in pixels). - \endlist + \value Text.ProportionalHeight (default) sets the spacing proportional to the line + (as a multiplier). For example, set to 2 for double spacing. + \value Text.FixedHeight sets the line height to a fixed line height (in pixels). */ QQuickText::LineHeightMode QQuickText::lineHeightMode() const { @@ -2643,16 +2640,16 @@ void QQuickText::setLineHeightMode(LineHeightMode mode) This property specifies how the font size of the displayed text is determined. The possible values are: - \list - \li Text.FixedSize (default) - The size specified by \l font.pixelSize - or \l font.pointSize is used. - \li Text.HorizontalFit - The largest size up to the size specified that fits - within the width of the item without wrapping is used. - \li Text.VerticalFit - The largest size up to the size specified that fits - the height of the item is used. - \li Text.Fit - The largest size up to the size specified that fits within the - width and height of the item is used. - \endlist + \value Text.FixedSize + (default) The size specified by \l font.pixelSize or \l font.pointSize is used. + \value Text.HorizontalFit + The largest size up to the size specified that fits within the width of the item + without wrapping is used. + \value Text.VerticalFit + The largest size up to the size specified that fits the height of the item is used. + \value Text.Fit + The largest size up to the size specified that fits within the width and height + of the item is used. The font size of fitted text has a minimum bound specified by the minimumPointSize or minimumPixelSize property and maximum bound specified @@ -3000,13 +2997,11 @@ void QQuickText::hoverLeaveEvent(QHoverEvent *event) The \c renderTypeQuality may be any integer over 0, or one of the following predefined values - \list - \li Text.DefaultRenderTypeQuality (default) = -1 - \li Text.LowRenderTypeQuality = 26 - \li Text.NormalRenderTypeQuality = 52 - \li Text.HighRenderTypeQuality = 104 - \li Text.VeryHighRenderTypeQuality = 208 - \endlist + \value Text.DefaultRenderTypeQuality -1 (default) + \value Text.LowRenderTypeQuality 26 + \value Text.NormalRenderTypeQuality 52 + \value Text.HighRenderTypeQuality 104 + \value Text.VeryHighRenderTypeQuality 208 */ int QQuickText::renderTypeQuality() const { @@ -3035,12 +3030,11 @@ void QQuickText::setRenderTypeQuality(int renderTypeQuality) Override the default rendering type for this component. Supported render types are: - \list - \li Text.QtRendering - \li Text.NativeRendering - \endlist - Select Text.NativeRendering if you prefer text to look native on the target platform and do + \value Text.QtRendering Text is rendered using a scalable distance field for each glyph. + \value Text.NativeRendering Text is rendered using a platform-specific technique. + + Select \c Text.NativeRendering if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the NativeRendering render type will lend poor and sometimes pixelated results. diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 1412b68ceb..e35c128001 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -235,17 +235,16 @@ QString QQuickTextEdit::text() const The requested weight of the font. The weight requested must be an integer between 1 and 1000, or one of the predefined values: - \list - \li Font.Thin - \li Font.Light - \li Font.ExtraLight - \li Font.Normal - the default - \li Font.Medium - \li Font.DemiBold - \li Font.Bold - \li Font.ExtraBold - \li Font.Black - \endlist + + \value Font.Thin 100 + \value Font.ExtraLight 200 + \value Font.Light 300 + \value Font.Normal 400 (default) + \value Font.Medium 500 + \value Font.DemiBold 600 + \value Font.Bold 700 + \value Font.ExtraBold 800 + \value Font.Black 900 \qml TextEdit { text: "Hello"; font.weight: Font.DemiBold } @@ -310,13 +309,12 @@ QString QQuickTextEdit::text() const Sets the capitalization for the text. - \list - \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. - \li Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \li Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \li Font.SmallCaps - This alters the text to be rendered in small-caps type. - \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. - \endlist + \value Font.MixedCase no capitalization change is applied + \value Font.AllUppercase alters the text to be rendered in all uppercase type + \value Font.AllLowercase alters the text to be rendered in all lowercase type + \value Font.SmallCaps alters the text to be rendered in small-caps type + \value Font.Capitalize alters the text to be rendered with the first character of + each word as an uppercase character \qml TextEdit { text: "Hello"; font.capitalization: Font.AllLowercase } @@ -333,23 +331,21 @@ QString QQuickTextEdit::text() const \note This property only has an effect when used together with render type TextEdit.NativeRendering. - \list - \value Font.PreferDefaultHinting - Use the default hinting level for the target platform. - \value Font.PreferNoHinting - If possible, render text without hinting the outlines + \value Font.PreferDefaultHinting Use the default hinting level for the target platform. + \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs. The text layout will be typographically accurate, using the same metrics as are used e.g. when printing. - \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, + \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction. The text will appear crisper on displays where the density is too low to give an accurate rendering of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's layout will be scalable to higher density devices (such as printers) without impacting details such as line breaks. - \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and + \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions. The text will be altered to optimize legibility on the target device, but since the metrics will depend on the target size of the text, the positions of glyphs, line breaks, and other typographical detail will not scale, meaning that a text layout may look different on devices with different pixel densities. - \endlist \qml TextEdit { text: "Hello"; renderType: TextEdit.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } @@ -519,12 +515,11 @@ void QQuickTextEdit::setTextFormat(TextFormat format) Override the default rendering type for this component. Supported render types are: - \list - \li Text.QtRendering - \li Text.NativeRendering - \endlist - Select Text.NativeRendering if you prefer text to look native on the target platform and do + \value TextEdit.QtRendering Text is rendered using a scalable distance field for each glyph. + \value TextEdit.NativeRendering Text is rendered using a platform-specific technique. + + Select \c TextEdit.NativeRendering if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the NativeRendering render type will lend poor and sometimes pixelated results. @@ -674,19 +669,21 @@ void QQuickTextEdit::setSelectedTextColor(const QColor &color) the left. Valid values for \c horizontalAlignment are: - \list - \li TextEdit.AlignLeft (default) - \li TextEdit.AlignRight - \li TextEdit.AlignHCenter - \li TextEdit.AlignJustify - \endlist + + \value TextEdit.AlignLeft + left alignment with ragged edges on the right (default) + \value TextEdit.AlignRight + align each line to the right with ragged edges on the left + \value TextEdit.AlignHCenter + align each line to the center + \value TextEdit.AlignJustify + align each line to both right and left, spreading out words as necessary Valid values for \c verticalAlignment are: - \list - \li TextEdit.AlignTop (default) - \li TextEdit.AlignBottom - \li TextEdit.AlignVCenter - \endlist + + \value TextEdit.AlignTop start at the top of the item (default) + \value TextEdit.AlignBottom align the last line to the bottom and other lines above + \value TextEdit.AlignVCenter align the center vertically When using the attached property LayoutMirroring::enabled to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property @@ -901,20 +898,26 @@ void QQuickTextEdit::setVAlign(QQuickTextEdit::VAlignment alignment) moveCursorDelegate(); emit verticalAlignmentChanged(d->vAlign); } + /*! \qmlproperty enumeration QtQuick::TextEdit::wrapMode Set this property to wrap the text to the TextEdit item's width. The text will only wrap if an explicit width has been set. - \list - \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. - \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. - \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. - \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. - \endlist + \value TextEdit.NoWrap + (default) no wrapping will be performed. If the text contains insufficient newlines, + \l {Item::}{implicitWidth} will exceed a set width. + \value TextEdit.WordWrap + wrapping is done on word boundaries only. If a word is too long, + \l {Item::}{implicitWidth} will exceed a set width. + \value TextEdit.WrapAnywhere + wrapping is done at any point on a line, even if it occurs in the middle of a word. + \value TextEdit.Wrap + if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate + point on the line, even in the middle of a word. - The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap. + The default is \c TextEdit.NoWrap. If you set a width, consider using \c TextEdit.Wrap. */ QQuickTextEdit::WrapMode QQuickTextEdit::wrapMode() const { @@ -1091,13 +1094,12 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const The selection mode specifies whether the selection is updated on a per character or a per word basis. If not specified the selection mode will default to \c {TextEdit.SelectCharacters}. - \list - \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at - the previous cursor position) to the specified position. - \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all - words between the specified position and the previous cursor position. Words partially in the - range are included. - \endlist + \value TextEdit.SelectCharacters + Sets either the selectionStart or selectionEnd (whichever was at the previous cursor position) + to the specified position. + \value TextEdit.SelectWords + Sets the selectionStart and selectionEnd to include all words between the specified position + and the previous cursor position. Words partially in the range are included. For example, take this sequence of calls: @@ -1395,38 +1397,31 @@ void QQuickTextEdit::setTextMargin(qreal margin) Flags that alter behaviour are: - \list - \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. - \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method - in any persistent storage like predictive user dictionary. - \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case - when a sentence ends. - \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). - \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required). - \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required). - \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing. - - \li Qt.ImhDate - The text editor functions as a date field. - \li Qt.ImhTime - The text editor functions as a time field. - \endlist + \value Qt.ImhHiddenText Characters should be hidden, as is typically used when entering passwords. + \value Qt.ImhSensitiveData Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \value Qt.ImhNoAutoUppercase The input method should not try to automatically switch to + upper case when a sentence ends. + \value Qt.ImhPreferNumbers Numbers are preferred (but not required). + \value Qt.ImhPreferUppercase Upper case letters are preferred (but not required). + \value Qt.ImhPreferLowercase Lower case letters are preferred (but not required). + \value Qt.ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. + \value Qt.ImhDate The text editor functions as a date field. + \value Qt.ImhTime The text editor functions as a time field. Flags that restrict input (exclusive flags) are: - \list - \li Qt.ImhDigitsOnly - Only digits are allowed. - \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. - \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed. - \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed. - \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. - \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. - \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. - \endlist + \value Qt.ImhDigitsOnly Only digits are allowed. + \value Qt.ImhFormattedNumbersOnly Only number input is allowed. This includes decimal point and minus sign. + \value Qt.ImhUppercaseOnly Only upper case letter input is allowed. + \value Qt.ImhLowercaseOnly Only lower case letter input is allowed. + \value Qt.ImhDialableCharactersOnly Only characters suitable for phone dialing are allowed. + \value Qt.ImhEmailCharactersOnly Only characters suitable for email addresses are allowed. + \value Qt.ImhUrlCharactersOnly Only characters suitable for URLs are allowed. Masks: - \list - \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. - \endlist + \value Qt.ImhExclusiveInputMask This mask yields nonzero if any of the exclusive flags are used. */ Qt::InputMethodHints QQuickTextEdit::inputMethodHints() const @@ -1574,10 +1569,8 @@ void QQuickTextEdit::setSelectByMouse(bool on) Specifies how text should be selected using a mouse. - \list - \li TextEdit.SelectCharacters - The selection is updated with individual characters. (Default) - \li TextEdit.SelectWords - The selection is updated with whole words. - \endlist + \value TextEdit.SelectCharacters (default) The selection is updated with individual characters. + \value TextEdit.SelectWords The selection is updated with whole words. This property only applies when \l selectByMouse is true. */ diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index c08f357df8..0096158d58 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -155,12 +155,11 @@ void QQuickTextInput::setText(const QString &s) Override the default rendering type for this component. Supported render types are: - \list - \li Text.QtRendering - \li Text.NativeRendering - \endlist - Select Text.NativeRendering if you prefer text to look native on the target platform and do + \value TextInput.QtRendering Text is rendered using a scalable distance field for each glyph. + \value TextInput.NativeRendering Text is rendered using a platform-specific technique. + + Select \c TextInput.NativeRendering if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the NativeRendering render type will lend poor and sometimes pixelated results. @@ -259,17 +258,16 @@ QString QQuickTextInputPrivate::realText() const The requested weight of the font. The weight requested must be an integer between 1 and 1000, or one of the predefined values: - \list - \li Font.Thin - \li Font.Light - \li Font.ExtraLight - \li Font.Normal - the default - \li Font.Medium - \li Font.DemiBold - \li Font.Bold - \li Font.ExtraBold - \li Font.Black - \endlist + + \value Font.Thin 100 + \value Font.ExtraLight 200 + \value Font.Light 300 + \value Font.Normal 400 (default) + \value Font.Medium 500 + \value Font.DemiBold 600 + \value Font.Bold 700 + \value Font.ExtraBold 800 + \value Font.Black 900 \qml TextInput { text: "Hello"; font.weight: Font.DemiBold } @@ -333,13 +331,12 @@ QString QQuickTextInputPrivate::realText() const Sets the capitalization for the text. - \list - \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. - \li Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \li Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \li Font.SmallCaps - This alters the text to be rendered in small-caps type. - \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. - \endlist + \value Font.MixedCase the normal case: no capitalization change is applied + \value Font.AllUppercase alters the text to be rendered in all uppercase type + \value Font.AllLowercase alters the text to be rendered in all lowercase type + \value Font.SmallCaps alters the text to be rendered in small-caps type + \value Font.Capitalize alters the text to be rendered with the first character of + each word as an uppercase character \qml TextInput { text: "Hello"; font.capitalization: Font.AllLowercase } @@ -356,23 +353,21 @@ QString QQuickTextInputPrivate::realText() const \note This property only has an effect when used together with render type TextInput.NativeRendering. - \list - \value Font.PreferDefaultHinting - Use the default hinting level for the target platform. - \value Font.PreferNoHinting - If possible, render text without hinting the outlines + \value Font.PreferDefaultHinting Use the default hinting level for the target platform. + \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs. The text layout will be typographically accurate, using the same metrics as are used e.g. when printing. - \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, + \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction. The text will appear crisper on displays where the density is too low to give an accurate rendering of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's layout will be scalable to higher density devices (such as printers) without impacting details such as line breaks. - \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and + \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions. The text will be altered to optimize legibility on the target device, but since the metrics will depend on the target size of the text, the positions of glyphs, line breaks, and other typographical detail will not scale, meaning that a text layout may look different on devices with different pixel densities. - \endlist \qml TextInput { text: "Hello"; renderType: TextInput.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } @@ -688,12 +683,17 @@ void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment) Set this property to wrap the text to the TextInput item's width. The text will only wrap if an explicit width has been set. - \list - \li TextInput.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. - \li TextInput.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. - \li TextInput.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. - \li TextInput.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. - \endlist + \value TextInput.NoWrap + (default) no wrapping will be performed. If the text contains + insufficient newlines, then \l contentWidth will exceed a set width. + \value TextInput.WordWrap + wrapping is done on word boundaries only. If a word is too long, + \l contentWidth will exceed a set width. + \value TextInput.WrapAnywhere + wrapping is done at any point on a line, even if it occurs in the middle of a word. + \value TextInput.Wrap + if possible, wrapping occurs at a word boundary; otherwise it will occur + at the appropriate point on the line, even in the middle of a word. The default is TextInput.NoWrap. If you set a width, consider using TextInput.Wrap. */ @@ -1236,14 +1236,13 @@ Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const \qmlproperty enumeration QtQuick::TextInput::echoMode Specifies how the text should be displayed in the TextInput. - \list - \li TextInput.Normal - Displays the text as it is. (Default) - \li TextInput.Password - Displays platform-dependent password mask - characters instead of the actual characters. - \li TextInput.NoEcho - Displays nothing. - \li TextInput.PasswordEchoOnEdit - Displays characters as they are entered - while editing, otherwise identical to \c TextInput.Password. - \endlist + + \value TextInput.Normal Displays the text as it is. (Default) + \value TextInput.Password Displays platform-dependent password mask + characters instead of the actual characters. + \value TextInput.NoEcho Displays nothing. + \value TextInput.PasswordEchoOnEdit Displays characters as they are entered + while editing, otherwise identical to \c TextInput.Password. */ QQuickTextInput::EchoMode QQuickTextInput::echoMode() const { @@ -1284,40 +1283,31 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo) Flags that alter behaviour are: - \list - \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. - This is automatically set when setting echoMode to \c TextInput.Password. - \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method - in any persistent storage like predictive user dictionary. - \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case - when a sentence ends. - \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). - \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required). - \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required). - \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing. - - \li Qt.ImhDate - The text editor functions as a date field. - \li Qt.ImhTime - The text editor functions as a time field. - \li Qt.ImhMultiLine - The text editor doesn't close software input keyboard when Return or Enter key is pressed (since QtQuick 2.4). - \endlist + \value Qt.ImhHiddenText Characters should be hidden, as is typically used when entering passwords. + \value Qt.ImhSensitiveData Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \value Qt.ImhNoAutoUppercase The input method should not try to automatically switch to + upper case when a sentence ends. + \value Qt.ImhPreferNumbers Numbers are preferred (but not required). + \value Qt.ImhPreferUppercase Upper case letters are preferred (but not required). + \value Qt.ImhPreferLowercase Lower case letters are preferred (but not required). + \value Qt.ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. + \value Qt.ImhDate The text editor functions as a date field. + \value Qt.ImhTime The text editor functions as a time field. Flags that restrict input (exclusive flags) are: - \list - \li Qt.ImhDigitsOnly - Only digits are allowed. - \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. - \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed. - \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed. - \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. - \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. - \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. - \endlist + \value Qt.ImhDigitsOnly Only digits are allowed. + \value Qt.ImhFormattedNumbersOnly Only number input is allowed. This includes decimal point and minus sign. + \value Qt.ImhUppercaseOnly Only upper case letter input is allowed. + \value Qt.ImhLowercaseOnly Only lower case letter input is allowed. + \value Qt.ImhDialableCharactersOnly Only characters suitable for phone dialing are allowed. + \value Qt.ImhEmailCharactersOnly Only characters suitable for email addresses are allowed. + \value Qt.ImhUrlCharactersOnly Only characters suitable for URLs are allowed. Masks: - \list - \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. - \endlist + \value Qt.ImhExclusiveInputMask This mask yields nonzero if any of the exclusive flags are used. */ Qt::InputMethodHints QQuickTextInput::inputMethodHints() const @@ -2439,10 +2429,8 @@ void QQuickTextInput::setSelectByMouse(bool on) Specifies how text should be selected using a mouse. - \list - \li TextInput.SelectCharacters - The selection is updated with individual characters. (Default) - \li TextInput.SelectWords - The selection is updated with whole words. - \endlist + \value TextInput.SelectCharacters (default) The selection is updated with individual characters. + \value TextInput.SelectWords The selection is updated with whole words. This property only applies when \l selectByMouse is true. */ @@ -2582,13 +2570,12 @@ void QQuickTextInput::moveCursorSelection(int position) The selection mode specifies whether the selection is updated on a per character or a per word basis. If not specified the selection mode will default to \c {TextInput.SelectCharacters}. - \list - \li TextInput.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at - the previous cursor position) to the specified position. - \li TextInput.SelectWords - Sets the selectionStart and selectionEnd to include all - words between the specified position and the previous cursor position. Words partially in the - range are included. - \endlist + \value TextInput.SelectCharacters + Sets either the selectionStart or selectionEnd (whichever was at the previous cursor position) + to the specified position. + \value TextInput.SelectWords + Sets the selectionStart and selectionEnd to include all words between the specified position + and the previous cursor position. Words partially in the range are included. For example, take this sequence of calls: diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 19b508cecb..1a57fdd4f2 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3343,6 +3343,7 @@ void QQuickWindow::endExternalCommands() */ /*! + \keyword qml-window-visibility-prop \qmlproperty QWindow::Visibility Window::visibility The screen-occupation state of the window. @@ -3365,6 +3366,7 @@ void QQuickWindow::endExternalCommands() /*! \qmlattachedproperty QWindow::Visibility Window::visibility + \readonly \since 5.4 This attached property holds whether the window is currently shown @@ -3372,7 +3374,7 @@ void QQuickWindow::endExternalCommands() hidden. The \c Window attached property can be attached to any Item. If the item is not shown in any window, the value will be \l {QWindow::}{Hidden}. - \sa visible, visibility + \sa visible, {qml-window-visibility-prop}{visibility} */ /*! diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index 7d7cf20210..68e9d7df90 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -69,6 +69,7 @@ void QQuickWindowQmlImpl::setVisible(bool visible) { Q_D(QQuickWindowQmlImpl); d->visible = visible; + d->visibleExplicitlySet = true; if (d->complete && (!transientParent() || transientParentVisible())) QQuickWindow::setVisible(visible); } @@ -148,7 +149,8 @@ void QQuickWindowQmlImpl::setWindowVisibility() // We have deferred window creation until we have the full picture of what // the user wanted in terms of window state, geometry, visibility, etc. - if ((d->visibility == Hidden && d->visible) || (d->visibility > AutomaticVisibility && !d->visible)) { + if (d->visibleExplicitlySet && ((d->visibility == Hidden && d->visible) || + (d->visibility > AutomaticVisibility && !d->visible))) { QQmlData *data = QQmlData::get(this); Q_ASSERT(data && data->context); diff --git a/src/quick/items/qquickwindowmodule_p_p.h b/src/quick/items/qquickwindowmodule_p_p.h index 4e94a4e43d..cce893ac25 100644 --- a/src/quick/items/qquickwindowmodule_p_p.h +++ b/src/quick/items/qquickwindowmodule_p_p.h @@ -62,6 +62,7 @@ public: bool complete = false; bool visible = false; + bool visibleExplicitlySet = false; QQuickWindow::Visibility visibility = QQuickWindow::AutomaticVisibility; QV4::PersistentValue rootItemMarker; }; diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index cf369f55a6..571cdf806d 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -532,13 +532,18 @@ const void *QSGGeometry::indexData() const Specifies the drawing mode, also called primitive topology. + \note Starting with Qt 6 the scene graph only exposes topologies that are + supported across all the supported 3D graphics APIs. As a result, the + values \c DrawLineLoop and \c DrawTriangleFan are no longer supported at + run time in Qt 6, even though the enum values themselves are still present. + \value DrawPoints \value DrawLines - \value DrawLineLoop + \omitvalue DrawLineLoop \value DrawLineStrip \value DrawTriangles \value DrawTriangleStrip - \value DrawTriangleFan + \omitvalue DrawTriangleFan */ /*! @@ -572,10 +577,10 @@ void QSGGeometry::setDrawingMode(unsigned int mode) } /*! - Gets the current line or point width or to be used for this - geometry. This property only applies to line width when the drawingMode - is DrawLines, DarwLineStrip, or DrawLineLoop. When supported, it also - applies to point size when the drawingMode is DrawPoints. + Gets the current line or point width or to be used for this geometry. This + property only applies to line width when the drawingMode is DrawLines or + DrawLineStrip. When supported, it also applies to point size when the + drawingMode is DrawPoints. The default value is \c 1.0 @@ -594,10 +599,10 @@ float QSGGeometry::lineWidth() const } /*! - Sets the line or point width to be used for this geometry to \a - width. This property only applies to line width when the drawingMode is - DrawLines, DrawLineStrip, or DrawLineLoop. When supported, it also - applies to point size when the drawingMode is DrawPoints. + Sets the line or point width to be used for this geometry to \a width. This + property only applies to line width when the drawingMode is DrawLines or + DrawLineStrip. When supported, it also applies to point size when the + drawingMode is DrawPoints. \note Support for point and line drawing may be limited at run time, depending on the platform and graphics API. For example, some APIs do diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp index 403206abc5..2344f27b63 100644 --- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp @@ -85,17 +85,15 @@ QSGRenderNodePrivate::QSGRenderNodePrivate() mask where each bit represents graphics states changed by the \l render() function: - \list - \li DepthState - depth write mask, depth test enabled, depth comparison function - \li StencilState - stencil write masks, stencil test enabled, stencil operations, - stencil comparison functions - \li ScissorState - scissor enabled, scissor test enabled - \li ColorState - clear color, color write mask - \li BlendState - blend enabled, blend function - \li CullState - front face, cull face enabled - \li ViewportState - viewport - \li RenderTargetState - render target - \endlist + \value DepthState depth write mask, depth test enabled, depth comparison function + \value StencilState stencil write masks, stencil test enabled, stencil operations, + stencil comparison functions + \value ScissorState scissor enabled, scissor test enabled + \value ColorState clear color, color write mask + \value BlendState blend enabled, blend function + \value CullState front face, cull face enabled + \value ViewportState viewport + \value RenderTargetState render target With APIs other than OpenGL, the only relevant values are the ones that correspond to dynamic state changes recorded on the command list/buffer. diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index cb9102c1bd..63573847af 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -1664,14 +1664,16 @@ void QQuickRotationAnimation::setTo(qreal t) Possible values are: - \list - \li RotationAnimation.Numerical (default) - Rotate by linearly interpolating between the two numbers. - A rotation from 10 to 350 will rotate 340 degrees clockwise. - \li RotationAnimation.Clockwise - Rotate clockwise between the two values - \li RotationAnimation.Counterclockwise - Rotate counterclockwise between the two values - \li RotationAnimation.Shortest - Rotate in the direction that produces the shortest animation path. - A rotation from 10 to 350 will rotate 20 degrees counterclockwise. - \endlist + \value RotationAnimation.Numerical + (default) Rotate by linearly interpolating between the two numbers. + A rotation from \c 10 to \c 350 will rotate 340 degrees clockwise. + \value RotationAnimation.Clockwise + Rotate clockwise between the two values + \value RotationAnimation.Counterclockwise + Rotate counterclockwise between the two values + \value RotationAnimation.Shortest + Rotate in the direction that produces the shortest animation path. + A rotation from \c 10 to \c 350 will rotate \c 20 degrees counterclockwise. */ QQuickRotationAnimation::RotationDirection QQuickRotationAnimation::direction() const { diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index cea23f374e..1ee46cba00 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -484,14 +484,16 @@ QQuickAnimatorJob *QQuickRotationAnimator::createJob() const { Possible values are: - \list - \li RotationAnimator.Numerical (default) - Rotate by linearly interpolating between the two numbers. - A rotation from 10 to 350 will rotate 340 degrees clockwise. - \li RotationAnimator.Clockwise - Rotate clockwise between the two values - \li RotationAnimator.Counterclockwise - Rotate counterclockwise between the two values - \li RotationAnimator.Shortest - Rotate in the direction that produces the shortest animation path. - A rotation from 10 to 350 will rotate 20 degrees counterclockwise. - \endlist + \value RotationAnimator.Numerical + (default) Rotate by linearly interpolating between the two numbers. + A rotation from 10 to 350 will rotate 340 degrees clockwise. + \value RotationAnimator.Clockwise + Rotate clockwise between the two values + \value RotationAnimator.Counterclockwise + Rotate counterclockwise between the two values + \value RotationAnimator.Shortest + Rotate in the direction that produces the shortest animation path. + A rotation from 10 to 350 will rotate 20 degrees counterclockwise. */ void QQuickRotationAnimator::setDirection(RotationDirection dir) { diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index e3915723fa..0f1d766a11 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -423,12 +423,11 @@ QString QQuickFontLoader::name() const \qmlproperty enumeration QtQuick::FontLoader::status This property holds the status of font loading. It can be one of: - \list - \li FontLoader.Null - no font has been set - \li FontLoader.Ready - the font has been loaded - \li FontLoader.Loading - the font is currently being loaded - \li FontLoader.Error - an error occurred while loading the font - \endlist + + \value FontLoader.Null no font has been set + \value FontLoader.Ready the font has been loaded + \value FontLoader.Loading the font is currently being loaded + \value FontLoader.Error an error occurred while loading the font Use this status to provide an update or respond to the status change in some way. For example, you could: diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index c2ef00e064..db3654154d 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -2685,22 +2685,21 @@ void QQuickPathMultiline::addToPath(QPainterPath &path, const QQuickPathData &) */ /*! - \qmlproperty enumeration QtQuick::PathText::font.weight + \qmlproperty int QtQuick::PathText::font.weight Sets the font's weight. The weight can be one of: - \list - \li Font.Thin - \li Font.Light - \li Font.ExtraLight - \li Font.Normal - the default - \li Font.Medium - \li Font.DemiBold - \li Font.Bold - \li Font.ExtraBold - \li Font.Black - \endlist + + \value Font.Thin 100 + \value Font.ExtraLight 200 + \value Font.Light 300 + \value Font.Normal 400 (default) + \value Font.Medium 500 + \value Font.DemiBold 600 + \value Font.Bold 700 + \value Font.ExtraBold 800 + \value Font.Black 900 \qml PathText { text: "Hello"; font.weight: Font.DemiBold } @@ -2764,13 +2763,12 @@ void QQuickPathMultiline::addToPath(QPainterPath &path, const QQuickPathData &) Sets the capitalization for the text. - \list - \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. - \li Font.AllUppercase - This alters the text to be rendered in all uppercase type. - \li Font.AllLowercase - This alters the text to be rendered in all lowercase type. - \li Font.SmallCaps - This alters the text to be rendered in small-caps type. - \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. - \endlist + \value Font.MixedCase no capitalization change is applied + \value Font.AllUppercase alters the text to be rendered in all uppercase type + \value Font.AllLowercase alters the text to be rendered in all lowercase type + \value Font.SmallCaps alters the text to be rendered in small-caps type + \value Font.Capitalize alters the text to be rendered with the first character of + each word as an uppercase character \qml PathText { text: "Hello"; font.capitalization: Font.AllLowercase } diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index fdd846adb6..ca3b653d83 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -355,10 +355,11 @@ void QQuickShortcut::setAutoRepeat(bool repeat) This property holds the \l{Qt::ShortcutContext}{shortcut context}. Supported values are: - \list - \li \c Qt.WindowShortcut (default) - The shortcut is active when its parent item is in an active top-level window. - \li \c Qt.ApplicationShortcut - The shortcut is active when one of the application's windows are active. - \endlist + + \value Qt.WindowShortcut + (default) The shortcut is active when its parent item is in an active top-level window. + \value Qt.ApplicationShortcut + The shortcut is active when one of the application's windows are active. \qml Shortcut { diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index d511dc0562..264d022cae 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -462,11 +462,12 @@ QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &a Possible values are: - \list - \li SmoothedAnimation.Eased (default) - the animation will smoothly decelerate, and then reverse direction - \li SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, beginning with a velocity of 0 - \li SmoothedAnimation.Sync - the property is immediately set to the target value - \endlist + \value SmoothedAnimation.Eased + (default) the animation will smoothly decelerate, and then reverse direction + \value SmoothedAnimation.Immediate + the animation will immediately begin accelerating in the reverse direction, beginning with a velocity of 0 + \value SmoothedAnimation.Sync + the property is immediately set to the target value */ QQuickSmoothedAnimation::ReversingMode QQuickSmoothedAnimation::reversingMode() const { diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp index 5d28c7bc0c..f2dc624f4a 100644 --- a/src/quick/util/qquickstategroup.cpp +++ b/src/quick/util/qquickstategroup.cpp @@ -383,9 +383,15 @@ bool QQuickStateGroupPrivate::updateAutoState() // if there is a binding, the value in when might not be up-to-date at this point // so we manually re-evaluate the binding - if (auto binding = dynamic_cast<QQmlBinding *>(potentialWhenBinding.asAbstractBinding())) { - if (binding->hasValidContext()) - whenValue = binding->evaluate().toBool(); + QQmlAbstractBinding *abstractBinding = potentialWhenBinding.asAbstractBinding(); + if (abstractBinding && !abstractBinding->isValueTypeProxy()) { + QQmlBinding *binding = static_cast<QQmlBinding *>(abstractBinding); + if (binding->hasValidContext()) { + const auto boolType = QMetaType::fromType<bool>(); + const bool isUndefined = !binding->evaluate(&whenValue, boolType); + if (isUndefined) + whenValue = false; + } } if (whenValue) { diff --git a/src/quick/util/qquicksystempalette.cpp b/src/quick/util/qquicksystempalette.cpp index 191607a597..7ccb19b5d3 100644 --- a/src/quick/util/qquicksystempalette.cpp +++ b/src/quick/util/qquicksystempalette.cpp @@ -275,11 +275,9 @@ QColor QQuickSystemPalette::placeholderText() const The color group of the palette. This can be one of: - \list - \li SystemPalette.Active (default) - \li SystemPalette.Inactive - \li SystemPalette.Disabled - \endlist + \value SystemPalette.Active (default) QPalette::Active + \value SystemPalette.Inactive QPalette::Inactive + \value SystemPalette.Disabled QPalette::Disabled \sa QPalette::ColorGroup */ diff --git a/src/quick/util/qquicktextmetrics.cpp b/src/quick/util/qquicktextmetrics.cpp index 62d0e71662..151d2848eb 100644 --- a/src/quick/util/qquicktextmetrics.cpp +++ b/src/quick/util/qquicktextmetrics.cpp @@ -130,12 +130,10 @@ void QQuickTextMetrics::setText(const QString &text) This property holds the elide mode of the text. This determines the position in which the string is elided. The possible values are: - \list - \li \c Qt::ElideNone - No eliding; this is the default value. - \li \c Qt::ElideLeft - For example: "...World" - \li \c Qt::ElideMiddle - For example: "He...ld" - \li \c Qt::ElideRight - For example: "Hello..." - \endlist + \value Qt::ElideNone No eliding; this is the default value. + \value Qt::ElideLeft For example: "...World" + \value Qt::ElideMiddle For example: "He...ld" + \value Qt::ElideRight For example: "Hello..." \sa elideWidth, QFontMetrics::elidedText */ diff --git a/src/quick/util/qquicktransitionmanager.cpp b/src/quick/util/qquicktransitionmanager.cpp index 97c1fcd045..4de4201c7b 100644 --- a/src/quick/util/qquicktransitionmanager.cpp +++ b/src/quick/util/qquicktransitionmanager.cpp @@ -140,8 +140,10 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, for (const QQuickStateAction &action : qAsConst(applyList)) { if (action.toBinding) d->bindingsList << action; - if (action.fromBinding) - QQmlPropertyPrivate::removeBinding(action.property); // Disable current binding + if (action.fromBinding) { + auto property = action.property; + QQmlAnyBinding::removeBindingFrom(property); // Disable current binding + } if (action.event && action.event->changesBindings()) { //### assume isReversable()? d->bindingsList << action; action.event->clearBindings(); @@ -194,8 +196,10 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, continue; } - if (action.toBinding) - QQmlPropertyPrivate::removeBinding(action.property); // Make sure this is disabled during the transition + if (action.toBinding) { + auto property = action.property; + QQmlAnyBinding::removeBindingFrom(property); // Make sure this is disabled during the transition + } QQmlPropertyPrivate::write(action.property, action.fromValue, QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding); } @@ -263,7 +267,8 @@ void QQuickTransitionManager::cancel() for (const QQuickStateAction &action : qAsConst(d->bindingsList)) { if (action.toBinding && action.deletableToBinding) { - QQmlPropertyPrivate::removeBinding(action.property); + auto property = action.property; + QQmlAnyBinding::removeBindingFrom(property); } else if (action.event) { //### what do we do here? } diff --git a/src/quick/util/qquickvalidator.cpp b/src/quick/util/qquickvalidator.cpp index 7e93d87555..efc9850389 100644 --- a/src/quick/util/qquickvalidator.cpp +++ b/src/quick/util/qquickvalidator.cpp @@ -196,12 +196,8 @@ void QQuickDoubleValidator::resetLocaleName() The possible values for this property are: - \list - \li DoubleValidator.StandardNotation - \li DoubleValidator.ScientificNotation (default) - \endlist - - If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part (e.g. 1.5E-2). + \value DoubleValidator.StandardNotation only decimal numbers with optional sign (e.g. \c -0.015) + \value DoubleValidator.ScientificNotation (default) the written number may have an exponent part (e.g. \c 1.5E-2) */ /*! diff --git a/src/quickcontrols2/imagine/impl/qquickninepatchimage.cpp b/src/quickcontrols2/imagine/impl/qquickninepatchimage.cpp index 934eb887d6..00be629945 100644 --- a/src/quickcontrols2/imagine/impl/qquickninepatchimage.cpp +++ b/src/quickcontrols2/imagine/impl/qquickninepatchimage.cpp @@ -476,6 +476,9 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode d->resetNode = false; } + if (d->ninePatch.isNull()) + return QQuickImage::updatePaintNode(oldNode, data); + QSizeF sz = size(); QImage image = d->pix.image(); if (!sz.isValid() || image.isNull()) { @@ -485,9 +488,6 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode return nullptr; } - if (d->ninePatch.isNull()) - return QQuickImage::updatePaintNode(oldNode, data); - QQuickNinePatchNode *patchNode = static_cast<QQuickNinePatchNode *>(oldNode); if (!patchNode) patchNode = new QQuickNinePatchNode; diff --git a/src/quicklayouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp index b4267704c6..dc55196c11 100644 --- a/src/quicklayouts/qquicklinearlayout.cpp +++ b/src/quicklayouts/qquicklinearlayout.cpp @@ -284,10 +284,8 @@ QSizeF QQuickGridLayoutBase::sizeHint(Qt::SizeHint whichSizeHint) const Possible values: - \list - \li Qt.LeftToRight (default) - Items are laid out from left to right. - \li Qt.RightToLeft - Items are laid out from right to left. - \endlist + \value Qt.LeftToRight (default) Items are laid out from left to right. + \value Qt.RightToLeft Items are laid out from right to left. \sa RowLayout::layoutDirection, ColumnLayout::layoutDirection */ @@ -641,12 +639,10 @@ void QQuickGridLayout::setRows(int rows) Possible values are: - \list - \li GridLayout.LeftToRight (default) - Items are positioned next to - each other, then wrapped to the next line. - \li GridLayout.TopToBottom - Items are positioned next to each - other from top to bottom, then wrapped to the next column. - \endlist + \value GridLayout.LeftToRight + (default) Items are positioned next to each other, then wrapped to the next line. + \value GridLayout.TopToBottom + Items are positioned next to each other from top to bottom, then wrapped to the next column. \sa rows \sa columns @@ -813,10 +809,8 @@ QQuickLinearLayout::QQuickLinearLayout(Qt::Orientation orientation, Possible values: - \list - \li Qt.LeftToRight (default) - Items are laid out from left to right. - \li Qt.RightToLeft - Items are laid out from right to left - \endlist + \value Qt.LeftToRight (default) Items are laid out from left to right. + \value Qt.RightToLeft Items are laid out from right to left \sa GridLayout::layoutDirection, ColumnLayout::layoutDirection */ @@ -830,10 +824,8 @@ QQuickLinearLayout::QQuickLinearLayout(Qt::Orientation orientation, Possible values: - \list - \li Qt.LeftToRight (default) - Items are laid out from left to right. - \li Qt.RightToLeft - Items are laid out from right to left - \endlist + \value Qt.LeftToRight (default) Items are laid out from left to right. + \value Qt.RightToLeft Items are laid out from right to left \sa GridLayout::layoutDirection, RowLayout::layoutDirection */ diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp index 4baf9a7123..ce091fab07 100644 --- a/src/quickshapes/qquickshape.cpp +++ b/src/quickshapes/qquickshape.cpp @@ -396,10 +396,8 @@ void QQuickShapePath::setCapStyle(CapStyle style) This property defines the style of stroking. The default value is ShapePath.SolidLine. - \list - \li ShapePath.SolidLine - A plain line. - \li ShapePath.DashLine - Dashes separated by a few pixels. - \endlist + \value ShapePath.SolidLine A plain line. + \value ShapePath.DashLine Dashes separated by a few pixels. */ QQuickShapePath::StrokeStyle QQuickShapePath::strokeStyle() const diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 5e2f2383fb..6e36c08081 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -2068,7 +2068,7 @@ void QQuickComboBox::keyReleaseEvent(QKeyEvent *event) switch (event->key()) { case Qt::Key_Space: - if (!isEditable()) + if (!isEditable() && isPressed()) d->togglePopup(true); setPressed(false); event->accept(); diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 140b2a7f17..8a46d040f2 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -799,13 +799,25 @@ void QQuickControlPrivate::hideOldItem(QQuickItem *item) Named "unhide" because it's used for cases where an item that was previously hidden by \l hideOldItem() wants to be shown by a control again, such as a ScrollBar in ScrollView. + + \a visibility controls the visibility of \a item, as there + may have been bindings that controlled visibility, such as + with a typical ScrollBar.qml implementation: + + \code + visible: control.policy !== T.ScrollBar.AlwaysOff + \endcode + + In the future we could try to save the binding for the visible + property (using e.g. QQmlAnyBinding::takeFrom), but for now we + keep it simple and just allow restoring an equivalent literal value. */ -void QQuickControlPrivate::unhideOldItem(QQuickControl *control, QQuickItem *item) +void QQuickControlPrivate::unhideOldItem(QQuickControl *control, QQuickItem *item, UnhideVisibility visibility) { Q_ASSERT(item); qCDebug(lcItemManagement) << "unhiding old item" << item; - item->setVisible(true); + item->setVisible(visibility == UnhideVisibility::Show); item->setParentItem(control); #if QT_CONFIG(accessibility) @@ -2175,12 +2187,13 @@ QAccessible::Role QQuickControl::accessibleRole() const void QQuickControl::accessibilityActiveChanged(bool active) { + Q_D(QQuickControl); if (!active) return; QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true)); Q_ASSERT(accessibleAttached); - accessibleAttached->setRole(accessibleRole()); + accessibleAttached->setRole(d->effectiveAccessibleRole()); } #endif diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h index aa187dbbd6..32840e6aaf 100644 --- a/src/quicktemplates2/qquickcontrol_p_p.h +++ b/src/quicktemplates2/qquickcontrol_p_p.h @@ -161,8 +161,14 @@ public: virtual void cancelBackground(); virtual void executeBackground(bool complete = false); + enum class UnhideVisibility { + Show, + Hide + }; + static void hideOldItem(QQuickItem *item); - static void unhideOldItem(QQuickControl *control, QQuickItem *item); + static void unhideOldItem(QQuickControl *control, QQuickItem *item, + UnhideVisibility visibility = UnhideVisibility::Show); void updateBaselineOffset(); diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp index 9aa501d110..cb3bb48984 100644 --- a/src/quicktemplates2/qquicklabel.cpp +++ b/src/quicktemplates2/qquicklabel.cpp @@ -223,7 +223,7 @@ void QQuickLabelPrivate::accessibilityActiveChanged(bool active) Q_Q(QQuickLabel); QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true)); Q_ASSERT(accessibleAttached); - accessibleAttached->setRole(accessibleRole()); + accessibleAttached->setRole(effectiveAccessibleRole()); maybeSetAccessibleName(text); } diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index a3492fcb54..4ac642ccc4 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -47,6 +47,7 @@ #include <QtCore/qloggingcategory.h> #include <QtQml/qqmlinfo.h> #include <QtQuick/qquickitem.h> +#include <QtQuick/private/qquickaccessibleattached_p.h> #include <QtQuick/private/qquicktransition_p.h> #include <QtQuick/private/qquickitem_p.h> @@ -202,6 +203,36 @@ Q_LOGGING_CATEGORY(lcPopup, "qt.quick.controls.popup") } \endcode + \note The popup's \l{contentItem}{content item} gets parented to the + \l{Overlay::overlay}{overlay}, and does not live within the popup's parent. + Because of that, a \l{Item::scale}{scale} applied to the tree in which + the popup lives does not apply to the visual popup. To make the popup + of e.g. a \l{ComboBox} follow the scale of the combobox, apply the same scale + to the \l{Overlay::overlay}{overlay} as well: + + \code + Window { + property double scaleFactor: 2.0 + + Scale { + id: scale + xScale: scaleFactor + yScale: scaleFactor + } + Item { + id: scaledContent + transform: scale + + ComboBox { + id: combobox + // ... + } + } + + Overlay.overlay.transform: scale + } + \endcode + \section1 Popup Positioning Similar to items in Qt Quick, Popup's \l x and \l y coordinates are @@ -2759,6 +2790,19 @@ QFont QQuickPopup::defaultFont() const } #if QT_CONFIG(accessibility) +QAccessible::Role QQuickPopup::effectiveAccessibleRole() const +{ + auto *attached = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, false); + + auto role = QAccessible::NoRole; + if (auto *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(attached)) + role = accessibleAttached->role(); + if (role == QAccessible::NoRole) + role = accessibleRole(); + + return role; +} + QAccessible::Role QQuickPopup::accessibleRole() const { return QAccessible::Dialog; diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h index cdbc3cc4be..456dcad4a9 100644 --- a/src/quicktemplates2/qquickpopup_p.h +++ b/src/quicktemplates2/qquickpopup_p.h @@ -451,7 +451,10 @@ protected: virtual QFont defaultFont() const; #if QT_CONFIG(accessibility) + QAccessible::Role effectiveAccessibleRole() const; +private: virtual QAccessible::Role accessibleRole() const; +protected: virtual void accessibilityActiveChanged(bool active); #endif diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp index 4111cbef99..b1214a52cc 100644 --- a/src/quicktemplates2/qquickpopupitem.cpp +++ b/src/quicktemplates2/qquickpopupitem.cpp @@ -396,7 +396,7 @@ QFont QQuickPopupItem::defaultFont() const QAccessible::Role QQuickPopupItem::accessibleRole() const { Q_D(const QQuickPopupItem); - return d->popup->accessibleRole(); + return d->popup->effectiveAccessibleRole(); } void QQuickPopupItem::accessibilityActiveChanged(bool active) diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 4cedde66dc..41f8795bd5 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -559,22 +559,21 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point) return; QQuickRangeSliderNodePrivate *pressedNodePrivate = QQuickRangeSliderNodePrivate::get(pressedNode); - if (q->keepMouseGrab() || q->keepTouchGrab()) { - const qreal oldPos = pressedNode->position(); - qreal pos = positionAt(q, pressedNode->handle(), point); - if (snapMode != QQuickRangeSlider::NoSnap) - pos = snapPosition(q, pos); - qreal val = valueAt(q, pos); - if (!qFuzzyCompare(val, pressedNode->value())) - pressedNode->setValue(val); - else if (snapMode != QQuickRangeSlider::NoSnap) - pressedNodePrivate->setPosition(pos); - q->setKeepMouseGrab(false); - q->setKeepTouchGrab(false); + const qreal oldPos = pressedNode->position(); + qreal pos = positionAt(q, pressedNode->handle(), point); + if (snapMode != QQuickRangeSlider::NoSnap) + pos = snapPosition(q, pos); + qreal val = valueAt(q, pos); + if (!qFuzzyCompare(val, pressedNode->value())) + pressedNode->setValue(val); + else if (snapMode != QQuickRangeSlider::NoSnap) + pressedNodePrivate->setPosition(pos); + q->setKeepMouseGrab(false); + q->setKeepTouchGrab(false); + + if (!qFuzzyCompare(pressedNode->position(), oldPos)) + emit pressedNode->moved(); - if (!qFuzzyCompare(pressedNode->position(), oldPos)) - emit pressedNode->moved(); - } pressedNode->setPressed(false); pressedNodePrivate->touchId = -1; } diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index fbcd772dc5..41f76e2d90 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -954,11 +954,11 @@ void QQuickScrollBarAttachedPrivate::initHorizontal() // If a scroll bar was previously hidden (due to e.g. setting a new contentItem // on a ScrollView), we need to make sure that we un-hide it. - // We don't bother checking if the item is actually the old one, because - // if it's not, all of the things the function does (setting parent, visibility, etc.) - // should be no-ops anyway. - if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) - QQuickControlPrivate::unhideOldItem(control, horizontal); + if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) { + const auto visibility = horizontal->policy() != QQuickScrollBar::AlwaysOff + ? QQuickControlPrivate::UnhideVisibility::Show : QQuickControlPrivate::UnhideVisibility::Hide; + QQuickControlPrivate::unhideOldItem(control, horizontal, visibility); + } layoutHorizontal(); horizontal->setSize(area->property("widthRatio").toReal()); @@ -981,8 +981,11 @@ void QQuickScrollBarAttachedPrivate::initVertical() if (parent && parent == flickable->parentItem()) vertical->stackAfter(flickable); - if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) - QQuickControlPrivate::unhideOldItem(control, vertical); + if (auto control = qobject_cast<QQuickControl*>(q_func()->parent())) { + const auto visibility = vertical->policy() != QQuickScrollBar::AlwaysOff + ? QQuickControlPrivate::UnhideVisibility::Show : QQuickControlPrivate::UnhideVisibility::Hide; + QQuickControlPrivate::unhideOldItem(control, vertical, visibility); + } layoutVertical(); vertical->setSize(area->property("heightRatio").toReal()); diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index 1f5adbb7ff..1a758a8dfa 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -178,6 +178,8 @@ QQuickItem *QQuickScrollViewPrivate::getContentItem() { if (!contentItem) executeContentItem(); + // This function is called by QQuickControl::contentItem() to lazily create + // a contentItem, so we don't need to try to set it again. return ensureFlickable(false); } @@ -187,6 +189,7 @@ QQuickFlickable *QQuickScrollViewPrivate::ensureFlickable(bool content) if (!flickable) { flickableHasExplicitContentWidth = false; flickableHasExplicitContentHeight = false; + // Pass ourselves as the Flickable's parent item. auto flickable = new QQuickFlickable(q); // We almost always want to clip the flickable so that flickable // contents doesn't show up outside the scrollview. The only time @@ -338,11 +341,14 @@ void QQuickScrollViewPrivate::setScrollBarsInteractive(bool interactive) void QQuickScrollViewPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj) { QQuickScrollViewPrivate *p = static_cast<QQuickScrollViewPrivate *>(prop->data); + // If we don't yet have a flickable assigned, and this object is a Flickable, + // make it our contentItem. if (!p->flickable && p->setFlickable(qobject_cast<QQuickFlickable *>(obj), true)) return; QQuickFlickable *flickable = p->ensureFlickable(true); Q_ASSERT(flickable); + // Add the object that was declared as a child of us as a child object of the Flickable. QQmlListProperty<QObject> data = flickable->flickableData(); data.append(&data, obj); } @@ -385,6 +391,7 @@ void QQuickScrollViewPrivate::contentChildren_append(QQmlListProperty<QQuickItem QQuickFlickable *flickable = p->ensureFlickable(true); Q_ASSERT(flickable); + // Add the item that was declared as a child of us as a child item of the Flickable's contentItem. QQmlListProperty<QQuickItem> children = flickable->flickableChildren(); children.append(&children, item); } @@ -588,7 +595,25 @@ void QQuickScrollView::contentItemChange(QQuickItem *newItem, QQuickItem *oldIte auto newItemAsFlickable = qobject_cast<QQuickFlickable *>(newItem); if (newItem && !newItemAsFlickable) qmlWarning(this) << "ScrollView only supports Flickable types as its contentItem"; + // This is called by QQuickControlPrivate::setContentItem_helper, so no need to + // try to set it as the contentItem. d->setFlickable(newItemAsFlickable, false); + // We do, however, need to set us as its parent item, as setContentItem_helper will only + // do so if the item doesn't already have a parent. If newItem wasn't declared as our + // child and was instead imperatively assigned, it may already have a parent item, + // which we'll need to override. + if (newItem) { + newItem->setParentItem(this); + + // Make sure that the scroll bars are stacked in front of the flickable, + // otherwise events won't get through to them. + QQuickScrollBar *verticalBar = d->verticalScrollBar(); + if (verticalBar) + verticalBar->stackAfter(newItem); + QQuickScrollBar *horizontalBar = d->horizontalScrollBar(); + if (horizontalBar) + horizontalBar->stackAfter(newItem); + } } QQuickPane::contentItemChange(newItem, oldItem); } diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp index cf644a16fa..c2291e8cae 100644 --- a/src/quicktemplates2/qquickstackelement.cpp +++ b/src/quicktemplates2/qquickstackelement.cpp @@ -215,7 +215,9 @@ void QQuickStackElement::initialize(RequiredProperties &requiredProperties) QV4::ScopedValue ipv(scope, properties.value()); QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value()); QV4::ScopedValue qmlObject(scope, QV4::QObjectWrapper::wrap(v4, item)); - QQmlComponentPrivate::setInitialProperties(v4, qmlContext, qmlObject, ipv, requiredProperties, item); + QQmlComponentPrivate::setInitialProperties( + v4, qmlContext, qmlObject, ipv, requiredProperties, item, + component ? QQmlComponentPrivate::get(component)->state.creator.data() : nullptr); properties.clear(); } diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp index 016b45a7bc..5b859adba1 100644 --- a/src/quicktemplates2/qquickstackview.cpp +++ b/src/quicktemplates2/qquickstackview.cpp @@ -937,6 +937,8 @@ void QQuickStackView::clear(Operation operation) return; } + const int oldDepth = d->elements.size(); + QScopedValueRollback<bool> modifyingElements(d->modifyingElements, true); QScopedValueRollback<QString> operationNameRollback(d->operation, operationName); if (operation != Immediate) { @@ -947,7 +949,6 @@ void QQuickStackView::clear(Operation operation) QQuickStackTransition::popEnter(operation, nullptr, this), false); } - int oldDepth = d->elements.count(); d->setCurrentItem(nullptr); qDeleteAll(d->elements); d->elements.clear(); diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index d28718f2fb..1628f64925 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -472,7 +472,7 @@ void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active) Q_Q(QQuickTextArea); QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true)); Q_ASSERT(accessibleAttached); - accessibleAttached->setRole(accessibleRole()); + accessibleAttached->setRole(effectiveAccessibleRole()); accessibleAttached->set_readOnly(q->isReadOnly()); accessibleAttached->setDescription(placeholder); } diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index 7cac120805..034c06dec8 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -319,7 +319,7 @@ void QQuickTextFieldPrivate::accessibilityActiveChanged(bool active) Q_Q(QQuickTextField); QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true)); Q_ASSERT(accessibleAttached); - accessibleAttached->setRole(accessibleRole()); + accessibleAttached->setRole(effectiveAccessibleRole()); accessibleAttached->set_readOnly(m_readOnly); accessibleAttached->set_passwordEdit((m_echoMode == QQuickTextField::Password || m_echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false); accessibleAttached->setDescription(placeholder); diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp index 843c078f8c..3837e193e5 100644 --- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp +++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp @@ -54,6 +54,8 @@ private Q_SLOTS: void testExample_data(); #endif + void testBackupFileLimit(); + private: QString readTestFile(const QString &path); QString runQmlformat(const QString &fileToFormat, QStringList args, bool shouldSucceed = true); @@ -297,6 +299,29 @@ void TestQmlformat::testExample() } #endif +void TestQmlformat::testBackupFileLimit() +{ + // Create a temporary directory + QTemporaryDir tempDir; + + // Unformatted file to format + const QString fileToFormat{ testFile("Annotations.qml") }; + + { + const QString tempFile = tempDir.path() + QDir::separator() + "test_0.qml"; + const QString backupFile = tempFile + QStringLiteral("~"); + QFile::copy(fileToFormat, tempFile); + + QProcess process; + process.start(m_qmlformatPath, QStringList{ "--verbose", "--inplace", tempFile }); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitStatus(), QProcess::NormalExit); + QCOMPARE(process.exitCode(), 0); + QVERIFY(QFileInfo::exists(tempFile)); + QVERIFY(!QFileInfo::exists(backupFile)); + }; +} + QString TestQmlformat::runQmlformat(const QString &fileToFormat, QStringList args, bool shouldSucceed) { diff --git a/tests/auto/qml/qqmlcomponent/data/removeBinding.qml b/tests/auto/qml/qqmlcomponent/data/removeBinding.qml new file mode 100644 index 0000000000..08126a1db2 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/removeBinding.qml @@ -0,0 +1,21 @@ +import QtQml 2.15 + +QtObject { + id: root + objectName: "400" + + property Component c: Component { + id: customItem + QtObject { + objectName: root.objectName + } + } + + property string result: { + const properties = { + "objectName": "42", + } + const item = customItem.createObject(root, properties) + return item.objectName; + } +} diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index decbe7dd22..7ebe44faa8 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -130,6 +130,7 @@ private slots: void testSetInitialProperties(); void createInsideJSModule(); void qmlErrorIsReported(); + void removeBinding(); private: QQmlEngine engine; @@ -1022,6 +1023,16 @@ void tst_qqmlcomponent::qmlErrorIsReported() })); } +void tst_qqmlcomponent::removeBinding() +{ + QQmlEngine e; + QQmlComponent c(&e, testFileUrl("removeBinding.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + QCOMPARE(o->property("result"), QStringLiteral("42")); +} + QTEST_MAIN(tst_qqmlcomponent) #include "tst_qqmlcomponent.moc" diff --git a/tests/auto/qml/qqmldelegatemodel/data/deleteRace.qml b/tests/auto/qml/qqmldelegatemodel/data/deleteRace.qml new file mode 100644 index 0000000000..b01b14f7b8 --- /dev/null +++ b/tests/auto/qml/qqmldelegatemodel/data/deleteRace.qml @@ -0,0 +1,50 @@ +import QtQuick +import QtQml.Models + +Item { + DelegateModel { + id: delegateModel + model: ListModel { + id: sourceModel + + ListElement { title: "foo" } + ListElement { title: "bar" } + + function clear() { + if (count > 0) + remove(0, count); + } + } + + groups: [ + DelegateModelGroup { name: "selectedItems" } + ] + + delegate: Text { + height: DelegateModel.inSelectedItems ? implicitHeight * 2 : implicitHeight + Component.onCompleted: { + if (index === 0) + DelegateModel.inSelectedItems = true; + } + } + + Component.onCompleted: { + items.create(0) + items.create(1) + } + } + + ListView { + anchors.fill: parent + model: delegateModel + } + + Timer { + running: true + interval: 10 + onTriggered: sourceModel.clear() + } + + property int count: delegateModel.items.count +} + diff --git a/tests/auto/qml/qqmldelegatemodel/data/resetModelData.qml b/tests/auto/qml/qqmldelegatemodel/data/resetModelData.qml new file mode 100644 index 0000000000..1fe6168c79 --- /dev/null +++ b/tests/auto/qml/qqmldelegatemodel/data/resetModelData.qml @@ -0,0 +1,16 @@ +import QtQuick + +ListView { + id: root + anchors.fill: parent + property bool success: (currentItem?.mydata ?? 0) === 42 + height: 300 + width: 200 + + delegate: Rectangle { + required property var model + implicitWidth: 100 + implicitHeight: 50 + property var mydata: model?.foo ?? model.bar + } +} diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp index f10c89872f..12d1cc57cb 100644 --- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp +++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp @@ -30,6 +30,7 @@ #include <QtCore/QConcatenateTablesProxyModel> #include <QtGui/QStandardItemModel> #include <QtQml/qqmlcomponent.h> +#include <QtQml/qqmlapplicationengine.h> #include <QtQmlModels/private/qqmldelegatemodel_p.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> @@ -44,12 +45,14 @@ public: tst_QQmlDelegateModel(); private slots: + void resettingRolesRespected(); void valueWithoutCallingObjectFirst_data(); void valueWithoutCallingObjectFirst(); void qtbug_86017(); void filterOnGroup_removeWhenCompleted(); void contextAccessedByHandler(); void redrawUponColumnChange(); + void deleteRace(); }; class AbstractItemModel : public QAbstractItemModel @@ -109,6 +112,61 @@ tst_QQmlDelegateModel::tst_QQmlDelegateModel() qmlRegisterType<AbstractItemModel>("Test", 1, 0, "AbstractItemModel"); } +class TableModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + int rowCount(const QModelIndex & = QModelIndex()) const override + { + return 1; + } + + int columnCount(const QModelIndex & = QModelIndex()) const override + { + return 1; + } + + QVariant data(const QModelIndex &index, int role) const override + { + switch (role) { + case 0: + return QString("foo: %1, %2").arg(index.column()).arg(index.row()); + case 1: + return 42; + default: + break; + } + + return QVariant(); + } + + Q_INVOKABLE void change() { beginResetModel(); toggle = !toggle; endResetModel(); } + + QHash<int, QByteArray> roleNames() const override + { + if (toggle) + return { {0, "foo"} }; + else + return { {1, "bar"} }; + } + + bool toggle = true; +}; + +void tst_QQmlDelegateModel::resettingRolesRespected() +{ + auto model = std::make_unique<TableModel>(); + QQmlApplicationEngine engine; + engine.setInitialProperties({ {"model", QVariant::fromValue(model.get()) }} ); + engine.load(testFileUrl("resetModelData.qml")); + QTRY_VERIFY(!engine.rootObjects().isEmpty()); + QObject *root = engine.rootObjects().constFirst(); + QVERIFY(!root->property("success").toBool()); + model->change(); + QTRY_VERIFY(root->property("success").toBool()); +} + void tst_QQmlDelegateModel::valueWithoutCallingObjectFirst_data() { QTest::addColumn<QUrl>("qmlFileUrl"); @@ -203,6 +261,18 @@ void tst_QQmlDelegateModel::redrawUponColumnChange() QCOMPARE(item->property("text").toString(), "Coconut"); } + +void tst_QQmlDelegateModel::deleteRace() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("deleteRace.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + QTRY_COMPARE(o->property("count").toInt(), 2); + QTRY_COMPARE(o->property("count").toInt(), 0); +} + QTEST_MAIN(tst_QQmlDelegateModel) #include "tst_qqmldelegatemodel.moc" diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index d48c7ed163..c220646e74 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -77,6 +77,7 @@ private slots: void commonTests(); void quickAttachedProperties(); + void attachedWins(); void basicPropertiesTest(); void hitTest(); void checkableTest(); @@ -342,6 +343,31 @@ void tst_QQuickAccessible::quickAttachedProperties() QTestAccessibility::clearEvents(); } +// Verify that a role can be explicitly set, and that the values from the +// attached object are used even if the item has a default role - QTBUG-110114 +void tst_QQuickAccessible::attachedWins() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData(R"( + import QtQuick + import QtQuick.Controls + Button { + text: "Button" + objectName: "button" + Accessible.role: Accessible.RadioButton + Accessible.description: "Radio Button" + })", QUrl()); + auto button = std::unique_ptr<QObject>(component.create()); + QVERIFY(button); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(button.get()); + QVERIFY(iface); + + QCOMPARE(iface->role(), QAccessible::RadioButton); + QTestAccessibility::clearEvents(); +} + void tst_QQuickAccessible::basicPropertiesTest() { diff --git a/tests/auto/quick/qquickflickable/data/flickableWithTapHandler.qml b/tests/auto/quick/qquickflickable/data/flickableWithTapHandler.qml new file mode 100644 index 0000000000..91b81059ab --- /dev/null +++ b/tests/auto/quick/qquickflickable/data/flickableWithTapHandler.qml @@ -0,0 +1,24 @@ +import QtQuick + +Item { + width: 300 + height: 300 + + Flickable { + anchors.fill: parent + anchors.topMargin: 100 + contentWidth: 1000 + contentHeight: 1000 + + Rectangle { + objectName: "childItem" + x: 20 + y: 50 + width: 20 + height: 20 + color: "red" + TapHandler { + } + } + } +} diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 51020672b7..8d4c8dfec7 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -242,10 +242,13 @@ private slots: void receiveTapOutsideContentItem(); void flickWhenRotated_data(); void flickWhenRotated(); + void flickAndReleaseOutsideBounds(); void scrollingWithFractionalExtentSize_data(); void scrollingWithFractionalExtentSize(); void setContentPositionWhileDragging_data(); void setContentPositionWhileDragging(); + void coalescedMove(); + void onlyOneMove(); private: void flickWithTouch(QQuickWindow *window, const QPoint &from, const QPoint &to); @@ -2956,6 +2959,42 @@ void tst_qquickflickable::flickWhenRotated() // QTBUG-99639 QVERIFY(!flickable->isAtYBeginning()); } +void tst_qquickflickable::flickAndReleaseOutsideBounds() // QTBUG-104987 +{ + // Check that flicking works when the mouse release happens + // outside the bounds of the flickable (and the flick started on top + // of a TapHandler that has a passive grab). + QQuickView window; + QVERIFY(QQuickTest::showView(window, testFileUrl("flickableWithTapHandler.qml"))); + QQuickItem *rootItem = window.rootObject(); + QVERIFY(rootItem); + QQuickFlickable *flickable = rootItem->findChild<QQuickFlickable*>(); + QVERIFY(flickable); + QQuickItem *childItem = flickable->findChild<QQuickItem*>("childItem"); + QVERIFY(childItem); + + QVERIFY(flickable->isAtYBeginning()); + + // Startpoint is on top of the tapHandler, while the endpoint is outside the flickable + const QPointF startPos = childItem->mapToGlobal(QPoint(10, 10)); + const QPointF endPos = flickable->mapToGlobal(QPoint(10, -10)); + const QPoint globalStartPos = window.mapFromGlobal(startPos).toPoint(); + const QPoint globalEndPos = window.mapFromGlobal(endPos).toPoint(); + const qreal dragDistance = 20; + + // Note: here we need to initiate a flick using raw events, rather than + // flickable.flick(), since we're testing if the mouse events takes the + // correct path to starts a flick (among passive and exclusive grabbers, combined + // with childMouseEventFilter()). + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, globalStartPos); + QTest::mouseMove(&window, globalStartPos - QPoint(0, dragDistance / 2)); + QTest::mouseMove(&window, globalStartPos - QPoint(0, dragDistance)); + QTest::mouseMove(&window, globalEndPos); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, globalEndPos); + + // Ensure that the content item ends up being moved more than what we dragged + QTRY_VERIFY(flickable->contentY() > dragDistance * 2); +} void tst_qquickflickable::scrollingWithFractionalExtentSize_data() { @@ -3144,6 +3183,80 @@ void tst_qquickflickable::setContentPositionWhileDragging() // QTBUG-104966 QVERIFY(!flickable->isDragging()); } +void tst_qquickflickable::coalescedMove() +{ + QQuickView *window = new QQuickView; + QScopedPointer<QQuickView> windowPtr(window); + windowPtr->setSource(testFileUrl("flickable03.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + QQuickVisualTestUtils::centerOnScreen(window); + QQuickVisualTestUtils::moveMouseAway(window); + window->show(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(window->rootObject() != nullptr); + + QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); + QVERIFY(flickable != nullptr); + + QSignalSpy movementStartedSpy(flickable, SIGNAL(movementStarted())); + QSignalSpy movementEndedSpy(flickable, SIGNAL(movementEnded())); + QSignalSpy flickStartedSpy(flickable, SIGNAL(flickStarted())); + QSignalSpy flickEndedSpy(flickable, SIGNAL(flickEnded())); + + QTest::touchEvent(window, touchDevice).press(0, {10, 10}).commit(); + + QTest::touchEvent(window, touchDevice).move(0, {10, 40}).commit(); + + QTest::touchEvent(window, touchDevice).move(0, {10, 100}).commit(); + + QTest::touchEvent(window, touchDevice).release(0, {10, 150}).commit(); + QQuickTouchUtils::flush(window); + + QTRY_VERIFY(!flickable->isMoving()); + + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); +} + +void tst_qquickflickable::onlyOneMove() +{ + QQuickView *window = new QQuickView; + QScopedPointer<QQuickView> windowPtr(window); + windowPtr->setSource(testFileUrl("flickable03.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + QQuickVisualTestUtils::centerOnScreen(window); + QQuickVisualTestUtils::moveMouseAway(window); + window->show(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(window->rootObject() != nullptr); + + QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); + QVERIFY(flickable != nullptr); + + QSignalSpy movementStartedSpy(flickable, SIGNAL(movementStarted())); + QSignalSpy movementEndedSpy(flickable, SIGNAL(movementEnded())); + QSignalSpy flickStartedSpy(flickable, SIGNAL(flickStarted())); + QSignalSpy flickEndedSpy(flickable, SIGNAL(flickEnded())); + + QTest::touchEvent(window, touchDevice).press(0, {10, 10}).commit(); + QQuickTouchUtils::flush(window); + + QTest::touchEvent(window, touchDevice).move(0, {10, 100}).commit(); + QQuickTouchUtils::flush(window); + + QTest::touchEvent(window, touchDevice).release(0, {10, 200}).commit(); + QQuickTouchUtils::flush(window); + + QTRY_VERIFY(!flickable->isMoving()); + + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); +} + QTEST_MAIN(tst_qquickflickable) #include "tst_qquickflickable.moc" diff --git a/tests/auto/quick/qquickstates/data/anchorRewindSize.qml b/tests/auto/quick/qquickstates/data/anchorRewindSize.qml new file mode 100644 index 0000000000..8fbae05c6d --- /dev/null +++ b/tests/auto/quick/qquickstates/data/anchorRewindSize.qml @@ -0,0 +1,30 @@ +import QtQuick + +Item { + id: root + width: 400 + height: 400 + property bool changeState: false + Item { + id: outer + anchors.fill: parent + Item { + id: inner + width: 100 + height: 100 + anchors.left: outer.left + anchors.top: outer.top + } + states: [ + State { + when: root.changeState + AnchorChanges { + target: inner + anchors.right: outer.right + anchors.bottom: outer.bottom + } + } + ] + } +} + diff --git a/tests/auto/quick/qquickstates/data/jsValueWhen.qml b/tests/auto/quick/qquickstates/data/jsValueWhen.qml new file mode 100644 index 0000000000..6d5eb1600c --- /dev/null +++ b/tests/auto/quick/qquickstates/data/jsValueWhen.qml @@ -0,0 +1,18 @@ +import QtQuick 2.15 + +Item { + id: root + property var prop: null + property bool works: false + states: [ + State { + name: "mystate" + when: root.prop + PropertyChanges { + target: root + works: "works" + } + } + ] + Component.onCompleted: root.prop = new Object +} diff --git a/tests/auto/quick/qquickstates/data/jsValueWhen2.qml b/tests/auto/quick/qquickstates/data/jsValueWhen2.qml new file mode 100644 index 0000000000..e1f173138e --- /dev/null +++ b/tests/auto/quick/qquickstates/data/jsValueWhen2.qml @@ -0,0 +1,20 @@ +import QtQuick 2.15 + +Item { + id: root + property var prop: null + property bool works: false + states: [ + State { + name: "mystate" + when: root.prop + PropertyChanges { + target: root + works: "works" + } + } + ] + Component.onCompleted: root.prop = Qt.createQmlObject( + "import QtQml 2.15\nQtObject {}", + root, "dynamicSnippet") +} diff --git a/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml b/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml new file mode 100644 index 0000000000..6936fe55ce --- /dev/null +++ b/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml @@ -0,0 +1,23 @@ +import QtQuick + +Item { + id: root + property bool toggle: true + property int state1Width: 500 + + states: [ + State { + when: root.toggle + PropertyChanges { target: root; width: root.state1Width } + }, + State { + when: !root.toggle + PropertyChanges { target: root; width: 300 } + } + ] + + transitions: Transition { + id: transition + SmoothedAnimation { target: root; property: "width"; velocity: 200 } + } +} diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 92c66211f4..224e17fc7b 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -200,12 +200,16 @@ private slots: void revertListMemoryLeak(); void duplicateStateName(); void trivialWhen(); + void jsValueWhen_data(); + void jsValueWhen(); void noStateOsciallation(); void parentChangeCorrectReversal(); void revertNullObjectBinding(); void bindableProperties(); void parentChangeInvolvingBindings(); void rewindAnchorChange(); + void rewindAnchorChangeSize(); + void bindingProperlyRemovedWithTransition(); }; void tst_qquickstates::initTestCase() @@ -1717,6 +1721,25 @@ void tst_qquickstates::trivialWhen() QVERIFY(root); } + +void tst_qquickstates::jsValueWhen_data() +{ + QTest::addColumn<QByteArray>("fileName"); + QTest::addRow("jsObject") << QByteArray("jsValueWhen.qml"); + QTest::addRow("qmlObject") << QByteArray("jsValueWhen2.qml"); +} + +void tst_qquickstates::jsValueWhen() +{ + QFETCH(QByteArray, fileName); + QQmlEngine engine; + + QQmlComponent c(&engine, testFileUrl(fileName.constData())); + QScopedPointer<QObject> root(c.create()); + QVERIFY(root); + QVERIFY(root->property("works").toBool()); +} + void tst_qquickstates::noStateOsciallation() { QQmlEngine engine; @@ -1941,6 +1964,61 @@ void tst_qquickstates::rewindAnchorChange() QTRY_COMPARE(innerRect->height(), 200); } +void tst_qquickstates::rewindAnchorChangeSize() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("anchorRewindSize.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + std::unique_ptr<QObject> root(c.create()); + QVERIFY(root); + + QQmlContext *context = qmlContext(root.get()); + QVERIFY(context); + + QObject *inner = context->objectForName(QStringLiteral("inner")); + QVERIFY(inner); + + QQuickItem *innerRect = qobject_cast<QQuickItem *>(inner); + QVERIFY(innerRect); + + QCOMPARE(innerRect->x(), 0); + QCOMPARE(innerRect->y(), 0); + QCOMPARE(innerRect->width(), 100); + QCOMPARE(innerRect->height(), 100); + + root->setProperty("changeState", true); + QCOMPARE(innerRect->x(), 0); + QCOMPARE(innerRect->y(), 0); + QCOMPARE(innerRect->width(), 400); + QCOMPARE(innerRect->height(), 400); + + root->setProperty("changeState", false); + QCOMPARE(innerRect->x(), 0); + QCOMPARE(innerRect->y(), 0); + QCOMPARE(innerRect->width(), 100); + QCOMPARE(innerRect->height(), 100); +} + +void tst_qquickstates::bindingProperlyRemovedWithTransition() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("removeBindingWithTransition.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> root(c.create()); + QVERIFY(root); + QQuickItem *item = qobject_cast<QQuickItem *>(root.get()); + QVERIFY(item); + + item->setProperty("toggle", false); + QTRY_COMPARE(item->width(), 300); + + item->setProperty("state1Width", 100); + QCOMPARE(item->width(), 300); + + item->setProperty("toggle", true); + QTRY_COMPARE(item->width(), 100); +} + QTEST_MAIN(tst_qquickstates) #include "tst_qquickstates.moc" diff --git a/tests/auto/quick/qquicktableview/data/resetModelData.qml b/tests/auto/quick/qquicktableview/data/resetModelData.qml new file mode 100644 index 0000000000..f7b3ec3009 --- /dev/null +++ b/tests/auto/quick/qquicktableview/data/resetModelData.qml @@ -0,0 +1,25 @@ +import QtQuick + +Item { + width: 640 + height: 450 + + property alias tableView: tableView + + TableView { + id: tableView + anchors.fill: parent + height: 300 + width: 200 + + property bool success: false + + delegate: Rectangle { + required property var model + implicitWidth: 100 + implicitHeight: 50 + property var mydata: model?.custom ?? model.display + onMydataChanged: tableView.success = mydata === 42 + } + } +} diff --git a/tests/auto/quick/qquicktableview/testmodel.h b/tests/auto/quick/qquicktableview/testmodel.h index 3db32938be..46e9b446d5 100644 --- a/tests/auto/quick/qquicktableview/testmodel.h +++ b/tests/auto/quick/qquicktableview/testmodel.h @@ -61,13 +61,27 @@ public: QVariant data(const QModelIndex &index, int role) const override { - if (!index.isValid() || role != Qt::DisplayRole) + if (!index.isValid()) return QVariant(); - int serializedIndex = index.row() + (index.column() * m_columns); - if (modelData.contains(serializedIndex)) - return modelData.value(serializedIndex); - return QStringLiteral("%1").arg(index.row()); + QVariant ret; + + switch (role) { + case Qt::UserRole: + ret = 42; + break; + case Qt::DisplayRole: { + int serializedIndex = index.row() + (index.column() * m_columns); + if (modelData.contains(serializedIndex)) + ret = modelData.value(serializedIndex); + else + ret = QStringLiteral("%1").arg(index.row()); } + break; + default: + break; + } + + return ret; } Q_INVOKABLE QVariant dataFromSerializedIndex(int index) const @@ -79,9 +93,18 @@ public: QHash<int, QByteArray> roleNames() const override { + if (m_useCustomRoleNames) + return { { Qt::UserRole, "custom"} }; return { {Qt::DisplayRole, "display"} }; } + Q_INVOKABLE void useCustomRoleNames(bool use) + { + beginResetModel(); + m_useCustomRoleNames = use; + endResetModel(); + } + Q_INVOKABLE void setModelData(const QPoint &cell, const QSize &span, const QString &string) { for (int c = 0; c < span.width(); ++c) { @@ -192,6 +215,7 @@ private: int m_rows = 0; int m_columns = 0; bool m_dataCanBeFetched = false; + bool m_useCustomRoleNames = false; QHash<int, QString> modelData; }; diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 04670837d6..97dae95fce 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -212,6 +212,7 @@ private slots: void testSelectableStartPosEndPos(); void testSelectableStartPosEndPosOutsideView(); void testSelectableScrollTowardsPos(); + void resettingRolesRespected(); }; tst_QQuickTableView::tst_QQuickTableView() @@ -3974,6 +3975,20 @@ void tst_QQuickTableView::testSelectableScrollTowardsPos() QCOMPARE(tableView->contentY(), 0); } +void tst_QQuickTableView::resettingRolesRespected() +{ + LOAD_TABLEVIEW("resetModelData.qml"); + + TestModel model(1, 1); + tableView->setModel(QVariant::fromValue(&model)); + + WAIT_UNTIL_POLISHED; + + QVERIFY(!tableView->property("success").toBool()); + model.useCustomRoleNames(true); + QTRY_VERIFY(tableView->property("success").toBool()); +} + QTEST_MAIN(tst_QQuickTableView) #include "tst_qquicktableview.moc" diff --git a/tests/auto/quick/qquickwindow/data/conflictingVisibleFalse.qml b/tests/auto/quick/qquickwindow/data/conflictingVisibleFalse.qml new file mode 100644 index 0000000000..98f374a741 --- /dev/null +++ b/tests/auto/quick/qquickwindow/data/conflictingVisibleFalse.qml @@ -0,0 +1,6 @@ +import QtQuick + +Window { + visibility: Window.Windowed + visible: false +} diff --git a/tests/auto/quick/qquickwindow/data/conflictingVisibleTrue.qml b/tests/auto/quick/qquickwindow/data/conflictingVisibleTrue.qml new file mode 100644 index 0000000000..52d9b2fc34 --- /dev/null +++ b/tests/auto/quick/qquickwindow/data/conflictingVisibleTrue.qml @@ -0,0 +1,6 @@ +import QtQuick + +Window { + visibility: Window.Hidden + visible: true +} diff --git a/tests/auto/quick/qquickwindow/data/maximized.qml b/tests/auto/quick/qquickwindow/data/maximized.qml new file mode 100644 index 0000000000..4d7054645b --- /dev/null +++ b/tests/auto/quick/qquickwindow/data/maximized.qml @@ -0,0 +1,5 @@ +import QtQuick + +Window { + visibility: Window.Maximized +} diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 894e6ee297..773ccdac99 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -562,6 +562,9 @@ private slots: void rendererInterfaceWithRenderControl_data(); void rendererInterfaceWithRenderControl(); + void visibleVsVisibility_data(); + void visibleVsVisibility(); + private: QPointingDevice *touchDevice; QPointingDevice *touchDeviceWithVelocity; @@ -4023,6 +4026,42 @@ void tst_qquickwindow::rendererInterfaceWithRenderControl() QQuickWindow::setGraphicsApi(QSGRendererInterface::Unknown); } +void tst_qquickwindow::visibleVsVisibility_data() +{ + QTest::addColumn<QUrl>("qmlfile"); + QTest::addColumn<bool>("expectVisible"); + QTest::addColumn<bool>("expectConflictingPropertyWarning"); + + QTest::newRow("default invisible") << testFileUrl("window.qml") << false << false; + QTest::newRow("just visibility") << testFileUrl("maximized.qml") << true << false; + // In these conflicting cases, the 'visibility' property "wins" (see QQuickWindowQmlImpl::setWindowVisibility()) + QTest::newRow("conflicting invisible") << testFileUrl("conflictingVisibleFalse.qml") << true << true; + QTest::newRow("conflicting visible") << testFileUrl("conflictingVisibleTrue.qml") << false << true; +} + +void tst_qquickwindow::visibleVsVisibility() +{ + QFETCH(QUrl, qmlfile); + QFETCH(bool, expectVisible); + QFETCH(bool, expectConflictingPropertyWarning); + + const QString warningMsg = qmlfile.toString() + ": Conflicting properties 'visible' and 'visibility'"; + + if (expectConflictingPropertyWarning) + QTest::ignoreMessage(QtWarningMsg, warningMsg.toUtf8().data()); + + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(qmlfile); + QObject *created = component.create(); + QScopedPointer<QObject> cleanup(created); + QVERIFY(created); + + QQuickWindow *window = qobject_cast<QQuickWindow*>(created); + QVERIFY(window); + QCOMPARE(window->isVisible(), expectVisible); +} + QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" diff --git a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml index e015553355..48a048945d 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_combobox.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_combobox.qml @@ -2321,4 +2321,33 @@ TestCase { compare(textField.selectedText, "") compare(control.currentIndex, 1) } + + // QTBUG-109721 - verify that an eaten press event for the space key + // doesn't open the popup when the key is released. + Component { + id: comboboxEatsSpace + ComboBox { + id: nonEditableComboBox + editable: false + model: ["NonEditable", "Delta", "Echo", "Foxtrot"] + Keys.onSpacePressed: (event) => event.accept + } + } + + function test_spacePressEaten() { + let control = createTemporaryObject(comboboxEatsSpace, testCase) + verify(control) + control.forceActiveFocus() + + var visibleChangedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "visibleChanged"}) + verify(visibleChangedSpy.valid) + + // press doesn't open + keyPress(Qt.Key_Space) + verify(!control.pressed) + compare(visibleChangedSpy.count, 0) + // neither does release + keyRelease(Qt.Key_Space) + compare(visibleChangedSpy.count, 0) + } } diff --git a/tests/auto/quickcontrols2/controls/data/tst_rangeslider.qml b/tests/auto/quickcontrols2/controls/data/tst_rangeslider.qml index 011e190e5a..7a76dd1574 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_rangeslider.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_rangeslider.qml @@ -484,7 +484,8 @@ TestCase { // Press and release the first handle without moving it. var touch = touchEvent(control) - touch.press(0, control, control.width * 0.25, control.height * 0.75).commit() + control.setValues(0, 1); + touch.press(0, control, control.leftPadding, control.height - control.bottomPadding - 1).commit() compare(firstPressedSpy.count, 1) compare(firstMovedSpy.count, 0) compare(secondPressedSpy.count, 0) @@ -496,7 +497,7 @@ TestCase { compare(control.second.value, 1.0) compare(control.second.position, 1.0) - touch.release(0, control, control.width * 0.25, control.height * 0.75).commit() + touch.release(0, control, control.leftPadding, control.height - control.bottomPadding - 1).commit() compare(firstPressedSpy.count, 2) compare(firstMovedSpy.count, 0) compare(secondPressedSpy.count, 0) @@ -509,7 +510,7 @@ TestCase { compare(control.second.position, 1.0) // Press and release the second handle without moving it. - touch.press(0, control, control.width * 0.75, control.height * 0.25).commit() + touch.press(0, control, control.width - control.rightPadding - 1, control.topPadding).commit() compare(firstPressedSpy.count, 2) compare(secondPressedSpy.count, 1) compare(control.first.pressed, false) @@ -519,7 +520,7 @@ TestCase { compare(control.second.value, 1.0) compare(control.second.position, 1.0) - touch.release(0, control, control.width * 0.75, control.height * 0.25).commit() + touch.release(0, control, control.width - control.rightPadding - 1, control.topPadding).commit() compare(firstPressedSpy.count, 2) compare(secondPressedSpy.count, 2) compare(control.first.pressed, false) @@ -1126,4 +1127,153 @@ TestCase { compare(control.valueAt(0.5), data.values[2]) compare(control.valueAt(1.0), data.values[3]) } + + + function test_updatePositionOnPress() { + var control = createTemporaryObject(sliderComponent, testCase) + verify(control) + + var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"}) + verify(firstPressedSpy.valid) + + var firstMovedSpy = signalSpy.createObject(control, {target: control.first, signalName: "moved"}) + verify(firstMovedSpy.valid) + + var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"}) + verify(secondPressedSpy.valid) + + var secondMovedSpy = signalSpy.createObject(control, {target: control.second, signalName: "moved"}) + verify(secondMovedSpy.valid) + + // Touch press and release on the left corner + control.setValues(0.2, 0.8) + compare(control.first.value, 0.2) + compare(control.second.value, 0.8) + var touch = touchEvent(control) + touch.press(0, control, 0, control.height * 0.75).commit() + compare(firstPressedSpy.count, 1) + compare(firstMovedSpy.count, 0) + compare(secondPressedSpy.count, 0) + compare(secondMovedSpy.count, 0) + compare(control.first.pressed, true) + compare(control.first.value, 0.2) + compare(control.first.position, 0.2) + compare(control.second.pressed, false) + compare(control.second.value, 0.8) + compare(control.second.position, 0.8) + + touch.release(0, control, 0, control.height * 0.75).commit() + compare(firstPressedSpy.count, 2) + compare(firstMovedSpy.count, 1) + compare(secondPressedSpy.count, 0) + compare(secondMovedSpy.count, 0) + compare(control.first.pressed, false) + compare(control.first.value, 0.0) + compare(control.first.position, 0.0) + compare(control.second.pressed, false) + compare(control.second.value, 0.8) + compare(control.second.position, 0.8) + + firstPressedSpy.clear() + firstMovedSpy.clear() + secondPressedSpy.clear() + secondMovedSpy.clear() + + // Touch press and release on the right corner + // On touch, the handle position is updated on release + control.setValues(0.2, 0.8) + compare(control.first.value, 0.2) + compare(control.second.value, 0.8) + var touch = touchEvent(control) + touch.press(0, control, control.width - control.rightPadding - 1, control.height * 0.75).commit() + compare(secondPressedSpy.count, 1) + compare(secondMovedSpy.count, 0) + compare(firstPressedSpy.count, 0) + compare(firstMovedSpy.count, 0) + compare(control.second.pressed, true) + compare(control.second.value, 0.8) + compare(control.second.position, 0.8) + compare(control.first.pressed, false) + compare(control.first.value, 0.2) + compare(control.first.position, 0.2) + + touch.release(0, control, control.width - control.rightPadding - 1, control.height * 0.75).commit() + compare(secondPressedSpy.count, 2) + compare(secondMovedSpy.count, 1) + compare(firstPressedSpy.count, 0) + compare(firstMovedSpy.count, 0) + compare(control.second.pressed, false) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + compare(control.first.pressed, false) + compare(control.first.value, 0.2) + compare(control.first.position, 0.2) + + firstPressedSpy.clear() + firstMovedSpy.clear() + secondPressedSpy.clear() + secondMovedSpy.clear() + + // Mouse press and release on the left corner + // On mouse, the position is immediately updated on press + control.setValues(0.2, 0.8) + compare(control.first.value, 0.2) + compare(control.second.value, 0.8) + mousePress(control, 0, control.height * 0.75, Qt.LeftButton) + compare(firstPressedSpy.count, 1) + compare(firstMovedSpy.count, 1) + compare(secondPressedSpy.count, 0) + compare(secondMovedSpy.count, 0) + compare(control.first.pressed, true) + compare(control.first.value, 0.0) + compare(control.first.position, 0.0) + compare(control.second.pressed, false) + compare(control.second.value, 0.8) + compare(control.second.position, 0.8) + + mouseRelease(control, 0, control.height * 0.75, Qt.LeftButton) + compare(firstPressedSpy.count, 2) + compare(firstMovedSpy.count, 1) + compare(secondPressedSpy.count, 0) + compare(secondMovedSpy.count, 0) + compare(control.first.pressed, false) + compare(control.first.value, 0.0) + compare(control.first.position, 0.0) + compare(control.second.pressed, false) + compare(control.second.value, 0.8) + compare(control.second.position, 0.8) + + firstPressedSpy.clear() + firstMovedSpy.clear() + secondPressedSpy.clear() + secondMovedSpy.clear() + + // Mouse press and release on the right corner + control.setValues(0.2, 0.8) + compare(control.first.value, 0.2) + compare(control.second.value, 0.8) + mousePress(control, control.width - control.rightPadding - 1, control.height * 0.75, Qt.LeftButton) + compare(secondPressedSpy.count, 1) + compare(secondMovedSpy.count, 1) + compare(firstPressedSpy.count, 0) + compare(firstMovedSpy.count, 0) + compare(control.second.pressed, true) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + compare(control.first.pressed, false) + compare(control.first.value, 0.2) + compare(control.first.position, 0.2) + + mouseRelease(control, control.width - control.rightPadding - 1, control.height * 0.75, Qt.LeftButton) + compare(secondPressedSpy.count, 2) + compare(secondMovedSpy.count, 1) + compare(firstPressedSpy.count, 0) + compare(firstMovedSpy.count, 0) + compare(control.second.pressed, false) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + compare(control.first.pressed, false) + compare(control.first.value, 0.2) + compare(control.first.position, 0.2) + } } diff --git a/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml b/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml index 6704d5894c..bcc1c44fe8 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_scrollview.qml @@ -586,6 +586,7 @@ TestCase { id: bindingToContentItemAndStandaloneFlickable Item { + objectName: "container" width: 200 height: 200 @@ -624,7 +625,7 @@ TestCase { verify(verticalScrollBar.visible) verify(horizontalScrollBar.visible) - mouseDrag(verticalScrollBar, verticalScrollBar.width / 2, verticalScrollBar.height / 2, 0, 50) + mouseWheel(control, control.width / 2, control.height / 2, 0, -120) verify(verticalScrollBar.active) verify(horizontalScrollBar.active) } @@ -633,6 +634,7 @@ TestCase { id: contentItemAssignedImperatively Item { + objectName: "container" width: 100 height: 100 @@ -658,11 +660,28 @@ TestCase { } // Tests that a ListView declared before the ScrollView (as the QObject destruction order - // is relevant for the bug) and assigned imperatively to ScrollView does not cause a crash - // on exit. + // is relevant for the bug) and assigned imperatively to ScrollView does not cause: + // - a crash on exit + // - scroll bars that should be hidden to be visible function test_contentItemAssignedImperatively() { let root = createTemporaryObject(contentItemAssignedImperatively, testCase) verify(root) + + let control = root.scrollView + let flickable = control.contentItem + compare(flickable.parent, control) + + let horizontalScrollBar = control.ScrollBar.horizontal + let verticalScrollBar = control.ScrollBar.vertical + // The horizontal ScrollBar's policy is set to AlwaysOff, so it shouldn't ever be visible. + verify(!horizontalScrollBar.visible) + // The vertical ScrollBar should be visible... + verify(verticalScrollBar.visible) + + // ... and it should become active when the ScrollView is scrolled. + mouseWheel(control, control.width / 2, control.height / 2, 0, -120) + verify(verticalScrollBar.active) + // Shouldn't crash. } } diff --git a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml index c925e68a36..6b530fd772 100644 --- a/tests/auto/quickcontrols2/controls/data/tst_stackview.qml +++ b/tests/auto/quickcontrols2/controls/data/tst_stackview.qml @@ -292,6 +292,15 @@ TestCase { compare(depthSpy.count, depthChanges) compare(control.empty, true) compare(emptySpy.count, emptyChanges) + + control.push(item, StackView.PushTransition) + compare(depthSpy.count, ++depthChanges) + compare(emptySpy.count, ++emptyChanges) + compare(control.depth, 1) + control.clear(StackView.PopTransition) + compare(depthSpy.count, ++depthChanges) + compare(emptySpy.count, ++emptyChanges) + compare(control.depth, 0) } function test_size() { diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/CMakeLists.txt b/tests/auto/quickcontrols2/qquickninepatchimage/CMakeLists.txt index 56edab461d..b0fdebd1aa 100644 --- a/tests/auto/quickcontrols2/qquickninepatchimage/CMakeLists.txt +++ b/tests/auto/quickcontrols2/qquickninepatchimage/CMakeLists.txt @@ -7,11 +7,7 @@ # Collect test data file(GLOB_RECURSE test_data_glob RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/data/*.qml) -list(APPEND test_data ${test_data_glob}) -file(GLOB_RECURSE test_data_glob - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/data/*.png) + ${CMAKE_CURRENT_SOURCE_DIR}/data/*) list(APPEND test_data ${test_data_glob}) qt_internal_add_test(tst_qquickninepatchimage diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/data/logo.pkm b/tests/auto/quickcontrols2/qquickninepatchimage/data/logo.pkm Binary files differnew file mode 100644 index 0000000000..c0987c5c36 --- /dev/null +++ b/tests/auto/quickcontrols2/qquickninepatchimage/data/logo.pkm diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/data/o1_bc1.ktx b/tests/auto/quickcontrols2/qquickninepatchimage/data/o1_bc1.ktx Binary files differnew file mode 100644 index 0000000000..d61194a745 --- /dev/null +++ b/tests/auto/quickcontrols2/qquickninepatchimage/data/o1_bc1.ktx diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/data/qt4.astc b/tests/auto/quickcontrols2/qquickninepatchimage/data/qt4.astc Binary files differnew file mode 100644 index 0000000000..7f7a3f4739 --- /dev/null +++ b/tests/auto/quickcontrols2/qquickninepatchimage/data/qt4.astc diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp index 0578248379..1c61523093 100644 --- a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp +++ b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp @@ -36,8 +36,10 @@ #include <QtQuick/qquickview.h> #include <QtQuick/qquickitemgrabresult.h> #include <QtQuick/private/qquickimage_p.h> +#include <QtQuick/private/qquickimage_p_p.h> #include <QtQuickTestUtils/private/qmlutils_p.h> #include <QtQuickTestUtils/private/visualtestutils_p.h> +#include <QtGui/private/qrhi_p.h> using namespace QQuickVisualTestUtils; @@ -57,6 +59,8 @@ private slots: void inset(); void implicitSize_data(); void implicitSize(); + void hwCompressedImages_data(); + void hwCompressedImages(); }; static QImage grabItemToImage(QQuickItem *item) @@ -255,6 +259,61 @@ void tst_qquickninepatchimage::implicitSize() QCOMPARE(ninePatchImage->implicitHeight(), implicitSize.height()); } +void tst_qquickninepatchimage::hwCompressedImages_data() +{ + QTest::addColumn<int>("dpr"); + QTest::addColumn<QString>("file"); + QTest::addColumn<QSize>("size"); + QTest::addColumn<QRhiTexture::Format>("format"); + + const struct TestFile { + QString name; + QSize size; + QRhiTexture::Format format; + } testFiles [] = { + { "o1_bc1.ktx", QSize(64, 64), QRhiTexture::BC1 }, + { "logo.pkm", QSize(256, 256), QRhiTexture::ETC2_RGB8 }, + { "qt4.astc", QSize(250, 200), QRhiTexture::ASTC_8x8 } + }; + + for (const TestFile &file : testFiles) { + for (int dpr = 1; dpr <= 4; ++dpr) + QTest::newRow(qPrintable(QString::fromLatin1("%1 DPR=%2").arg(file.name).arg(dpr))) << dpr << file.name << file.size << file.format; + } +} + +void tst_qquickninepatchimage::hwCompressedImages() +{ + QFETCH(int, dpr); + QFETCH(QString, file); + QFETCH(QSize, size); + QFETCH(QRhiTexture::Format, format); + + QHighDpiScaling::setGlobalFactor(dpr); + + QQuickView view(testFileUrl("ninepatchimage.qml")); + QCOMPARE(view.status(), QQuickView::Ready); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (!QSGRendererInterface::isApiRhiBased(view.rendererInterface()->graphicsApi())) + QSKIP("Skipping due to using software backend"); + + QRhi *rhi = static_cast<QRhi *>(view.rendererInterface()->getResource(&view, QSGRendererInterface::RhiResource)); + if (!rhi->isTextureFormatSupported(format)) + QSKIP(qPrintable(QString::fromLatin1("%1 not supported, skip").arg(format))); + + QQuickImage *ninePatchImage = qobject_cast<QQuickImage *>(view.rootObject()); + QVERIFY(ninePatchImage); + ninePatchImage->setSource(testFileUrl(file)); + ninePatchImage->setSize(size); + QSignalSpy spy(&view, SIGNAL(afterSynchronizing())); + QTRY_VERIFY(spy.size() >= 1); + + QQuickImagePrivate *ninePatchImagePrivate = static_cast<QQuickImagePrivate *>(QQuickItemPrivate::get(ninePatchImage)); + QVERIFY(ninePatchImagePrivate->paintNode); +} + QTEST_MAIN(tst_qquickninepatchimage) #include "tst_qquickninepatchimage.moc" diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 66f9dcba5f..aab662bb75 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -408,8 +408,8 @@ int main(int argc, char *argv[]) QCommandLineParser parser; parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); parser.setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsPositionalArguments); - const QCommandLineOption helpOption = parser.addHelpOption(); - const QCommandLineOption versionOption = parser.addVersionOption(); + parser.addHelpOption(); + parser.addVersionOption(); #ifdef QT_GUI_LIB QCommandLineOption apptypeOption(QStringList() << QStringLiteral("a") << QStringLiteral("apptype"), QCoreApplication::translate("main", "Select which application class to use. Default is gui."), @@ -484,14 +484,7 @@ int main(int argc, char *argv[]) parser.addPositionalArgument("args", QCoreApplication::translate("main", "Arguments after '--' are ignored, but passed through to the application.arguments variable in QML."), "[-- args...]"); - if (!parser.parse(QCoreApplication::arguments())) { - qWarning() << parser.errorText(); - exit(1); - } - if (parser.isSet(versionOption)) - parser.showVersion(); - if (parser.isSet(helpOption)) - parser.showHelp(); + parser.process(*app); if (parser.isSet(listConfOption)) listConfFiles(); if (applicationType == QmlApplicationTypeUnknown) { diff --git a/tools/qmlformat/qmlformat.cpp b/tools/qmlformat/qmlformat.cpp index dab1ee42c7..930d5f32dc 100644 --- a/tools/qmlformat/qmlformat.cpp +++ b/tools/qmlformat/qmlformat.cpp @@ -144,7 +144,8 @@ bool parseFile(const QString &filename, const Options &options) if (options.verbose) qWarning().noquote() << "Writing to file" << filename; FileWriter fw; - res = qmlFile.writeOut(filename, 2, lwOptions, &fw, checks); + const unsigned numberOfBackupFiles = 0; + res = qmlFile.writeOut(filename, numberOfBackupFiles, lwOptions, &fw, checks); } else { QFile out; out.open(stdout, QIODevice::WriteOnly); |