diff options
Diffstat (limited to 'src/quick/util')
25 files changed, 257 insertions, 63 deletions
diff --git a/src/quick/util/qquickanimation_p.h b/src/quick/util/qquickanimation_p.h index 746cb938bd..45f1635c91 100644 --- a/src/quick/util/qquickanimation_p.h +++ b/src/quick/util/qquickanimation_p.h @@ -80,6 +80,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAbstractAnimation : public QObject, public QQ Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopCountChanged) Q_CLASSINFO("DefaultMethod", "start()") + QML_NAMED_ELEMENT(Animation) + QML_UNCREATABLE("Animation is an abstract class") + public: enum ThreadingModel { GuiThread, @@ -165,6 +168,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPauseAnimation : public QQuickAbstractAnimati Q_DECLARE_PRIVATE(QQuickPauseAnimation) Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + QML_NAMED_ELEMENT(PauseAnimation) public: QQuickPauseAnimation(QObject *parent=nullptr); @@ -191,6 +195,7 @@ class QQuickScriptAction : public QQuickAbstractAnimation Q_PROPERTY(QQmlScriptString script READ script WRITE setScript) Q_PROPERTY(QString scriptName READ stateChangeScriptName WRITE setStateChangeScriptName) + QML_NAMED_ELEMENT(ScriptAction) public: QQuickScriptAction(QObject *parent=nullptr); @@ -221,6 +226,7 @@ class QQuickPropertyAction : public QQuickAbstractAnimation Q_PROPERTY(QQmlListProperty<QObject> targets READ targets) Q_PROPERTY(QQmlListProperty<QObject> exclude READ exclude) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PropertyAction) public: QQuickPropertyAction(QObject *parent=nullptr); @@ -269,6 +275,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPropertyAnimation : public QQuickAbstractAnim Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) Q_PROPERTY(QQmlListProperty<QObject> targets READ targets) Q_PROPERTY(QQmlListProperty<QObject> exclude READ exclude) + QML_NAMED_ELEMENT(PropertyAnimation) public: QQuickPropertyAnimation(QObject *parent=nullptr); @@ -324,6 +331,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickColorAnimation : public QQuickPropertyAnimati Q_DECLARE_PRIVATE(QQuickPropertyAnimation) Q_PROPERTY(QColor from READ from WRITE setFrom) Q_PROPERTY(QColor to READ to WRITE setTo) + QML_NAMED_ELEMENT(ColorAnimation) public: QQuickColorAnimation(QObject *parent=nullptr); @@ -343,6 +351,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickNumberAnimation : public QQuickPropertyAnimat Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + QML_NAMED_ELEMENT(NumberAnimation) public: QQuickNumberAnimation(QObject *parent=nullptr); @@ -368,6 +377,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickVector3dAnimation : public QQuickPropertyAnim Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged) + QML_NAMED_ELEMENT(Vector3dAnimation) public: QQuickVector3dAnimation(QObject *parent=nullptr); @@ -389,6 +399,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimation : public QQuickPropertyAnim Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) + QML_NAMED_ELEMENT(RotationAnimation) public: QQuickRotationAnimation(QObject *parent=nullptr); @@ -433,6 +444,7 @@ class QQuickSequentialAnimation : public QQuickAnimationGroup { Q_OBJECT Q_DECLARE_PRIVATE(QQuickAnimationGroup) + QML_NAMED_ELEMENT(SequentialAnimation) public: QQuickSequentialAnimation(QObject *parent=nullptr); @@ -450,6 +462,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickParallelAnimation : public QQuickAnimationGro { Q_OBJECT Q_DECLARE_PRIVATE(QQuickAnimationGroup) + QML_NAMED_ELEMENT(ParallelAnimation) public: QQuickParallelAnimation(QObject *parent=nullptr); diff --git a/src/quick/util/qquickanimationcontroller_p.h b/src/quick/util/qquickanimationcontroller_p.h index d9ce377060..da6df6038a 100644 --- a/src/quick/util/qquickanimationcontroller_p.h +++ b/src/quick/util/qquickanimationcontroller_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimationController : public QObject, public QQmlP Q_DECLARE_PRIVATE(QQuickAnimationController) Q_CLASSINFO("DefaultProperty", "animation") + QML_NAMED_ELEMENT(AnimationController) Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged) Q_PROPERTY(QQuickAbstractAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged) diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index 511cecda7f..9f7aaafcb0 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -69,6 +69,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAnimator : public QQuickAbstractAnimation Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) + QML_NAMED_ELEMENT(Animator) + QML_ADDED_IN_MINOR_VERSION(2) + QML_UNCREATABLE("Animator is an abstract class") + public: QQuickItem *targetItem() const; void setTargetItem(QQuickItem *target); @@ -109,6 +113,8 @@ class QQuickScaleAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(ScaleAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickScaleAnimator(QObject *parent = nullptr); protected: @@ -119,6 +125,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickXAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(XAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickXAnimator(QObject *parent = nullptr); protected: @@ -129,6 +137,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickYAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(YAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickYAnimator(QObject *parent = nullptr); protected: @@ -139,6 +149,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(OpacityAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickOpacityAnimator(QObject *parent = nullptr); protected: @@ -152,6 +164,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimator : public QQuickAnimator Q_OBJECT Q_DECLARE_PRIVATE(QQuickRotationAnimator) Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) + QML_NAMED_ELEMENT(RotationAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise }; @@ -177,6 +191,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator Q_OBJECT Q_DECLARE_PRIVATE(QQuickUniformAnimator) Q_PROPERTY(QString uniform READ uniform WRITE setUniform NOTIFY uniformChanged) + QML_NAMED_ELEMENT(UniformAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickUniformAnimator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h index 66a33489e4..b0eb6fa604 100644 --- a/src/quick/util/qquickapplication_p.h +++ b/src/quick/util/qquickapplication_p.h @@ -71,6 +71,9 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) Q_PROPERTY(QQmlListProperty<QQuickScreenInfo> screens READ screens NOTIFY screensChanged) + QML_NAMED_ELEMENT(Application) + QML_UNCREATABLE("Application is an abstract class.") + public: explicit QQuickApplication(QObject *parent = nullptr); virtual ~QQuickApplication(); diff --git a/src/quick/util/qquickbehavior_p.h b/src/quick/util/qquickbehavior_p.h index 80a51d77af..fa9cf6d6bc 100644 --- a/src/quick/util/qquickbehavior_p.h +++ b/src/quick/util/qquickbehavior_p.h @@ -71,6 +71,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBehavior : public QObject, public QQmlPropert Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(QVariant targetValue READ targetValue NOTIFY targetValueChanged REVISION 13) Q_CLASSINFO("DeferredPropertyNames", "animation") + QML_NAMED_ELEMENT(Behavior) public: QQuickBehavior(QObject *parent=nullptr); diff --git a/src/quick/util/qquickboundaryrule_p.h b/src/quick/util/qquickboundaryrule_p.h index 3325b675c5..d13031b173 100644 --- a/src/quick/util/qquickboundaryrule_p.h +++ b/src/quick/util/qquickboundaryrule_p.h @@ -77,6 +77,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBoundaryRule : public QObject, public QQmlPro Q_PROPERTY(OvershootFilter overshootFilter READ overshootFilter WRITE setOvershootFilter NOTIFY overshootFilterChanged) Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) Q_PROPERTY(int returnDuration READ returnDuration WRITE setReturnDuration NOTIFY returnDurationChanged) + QML_NAMED_ELEMENT(BoundaryRule) public: enum OvershootFilter { diff --git a/src/quick/util/qquickfontloader_p.h b/src/quick/util/qquickfontloader_p.h index 8d277f7cf7..e849c52a35 100644 --- a/src/quick/util/qquickfontloader_p.h +++ b/src/quick/util/qquickfontloader_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickFontLoader : public QObject Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) + QML_NAMED_ELEMENT(FontLoader) public: enum Status { Null = 0, Ready, Loading, Error }; diff --git a/src/quick/util/qquickfontmetrics_p.h b/src/quick/util/qquickfontmetrics_p.h index db2b7b6796..ee6d679649 100644 --- a/src/quick/util/qquickfontmetrics_p.h +++ b/src/quick/util/qquickfontmetrics_p.h @@ -79,6 +79,8 @@ class Q_AUTOTEST_EXPORT QQuickFontMetrics : public QObject Q_PROPERTY(qreal overlinePosition READ overlinePosition NOTIFY fontChanged) Q_PROPERTY(qreal strikeOutPosition READ strikeOutPosition NOTIFY fontChanged) Q_PROPERTY(qreal lineWidth READ lineWidth NOTIFY fontChanged) + QML_NAMED_ELEMENT(FontMetrics) + QML_ADDED_IN_MINOR_VERSION(4) public: explicit QQuickFontMetrics(QObject *parent = nullptr); ~QQuickFontMetrics(); diff --git a/src/quick/util/qquickforeignutils_p.h b/src/quick/util/qquickforeignutils_p.h new file mode 100644 index 0000000000..7e51bc4f82 --- /dev/null +++ b/src/quick/util/qquickforeignutils_p.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTQUICKFOREIGN_P_H +#define QTQUICKFOREIGN_P_H + +#include <qtquickglobal_p.h> + +#if QT_CONFIG(im) +#include <QtGui/qinputmethod.h> +#endif +#if QT_CONFIG(validator) +#include <QtGui/qvalidator.h> +#endif +#if QT_CONFIG(shortcut) +#include <QtGui/qkeysequence.h> +#endif + +#include <QtQml/qqml.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(validator) +struct QValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QValidator) + QML_ANONYMOUS +}; + +struct QRegExpValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QRegExpValidator) + QML_NAMED_ELEMENT(RegExpValidator) +}; + +#if QT_CONFIG(regularexpression) +struct QRegularExpressionValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QRegularExpressionValidator) + QML_NAMED_ELEMENT(RegularExpressionValidator) + QML_ADDED_IN_MINOR_VERSION(14) +}; +#endif // QT_CONFIG(regularexpression) + +#endif // QT_CONFIG(validator) + +#if QT_CONFIG(im) +struct QInputMethodForeign +{ + Q_GADGET + QML_FOREIGN(QInputMethod) + QML_NAMED_ELEMENT(InputMethod) + QML_UNCREATABLE("InputMethod is an abstract class.") +}; +#endif // QT_CONFIG(im) + +#if QT_CONFIG(shortcut) +struct QKeySequenceForeign +{ + Q_GADGET + QML_FOREIGN(QKeySequence) + QML_NAMED_ELEMENT(StandardKey) + QML_ADDED_IN_MINOR_VERSION(2) + QML_UNCREATABLE("Cannot create an instance of StandardKey.") +}; +#endif // QT_CONFIG(shortcut) + +QT_END_NAMESPACE + +#endif // QTQUICKFOREIGN_P_H diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index 5987ae8f35..ca0495a90d 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -77,6 +77,7 @@ struct QQuickPathData class Q_QUICK_PRIVATE_EXPORT QQuickPathElement : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickPathElement(QObject *parent=nullptr) : QObject(parent) {} Q_SIGNALS: @@ -89,6 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAttribute : public QQuickPathElement Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PathAttribute) public: QQuickPathAttribute(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -116,6 +118,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCurve : public QQuickPathElement Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(qreal relativeX READ relativeX WRITE setRelativeX NOTIFY relativeXChanged) Q_PROPERTY(qreal relativeY READ relativeY WRITE setRelativeY NOTIFY relativeYChanged) + QML_ANONYMOUS public: QQuickCurve(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -153,6 +156,7 @@ private: class Q_QUICK_PRIVATE_EXPORT QQuickPathLine : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathLine) public: QQuickPathLine(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -162,6 +166,8 @@ public: class Q_QUICK_PRIVATE_EXPORT QQuickPathMove : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathMove) + QML_ADDED_IN_MINOR_VERSION(9) public: QQuickPathMove(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -176,6 +182,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathQuad : public QQuickCurve Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY controlYChanged) Q_PROPERTY(qreal relativeControlX READ relativeControlX WRITE setRelativeControlX NOTIFY relativeControlXChanged) Q_PROPERTY(qreal relativeControlY READ relativeControlY WRITE setRelativeControlY NOTIFY relativeControlYChanged) + + QML_NAMED_ELEMENT(PathQuad) public: QQuickPathQuad(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -220,6 +228,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCubic : public QQuickCurve Q_PROPERTY(qreal relativeControl1Y READ relativeControl1Y WRITE setRelativeControl1Y NOTIFY relativeControl1YChanged) Q_PROPERTY(qreal relativeControl2X READ relativeControl2X WRITE setRelativeControl2X NOTIFY relativeControl2XChanged) Q_PROPERTY(qreal relativeControl2Y READ relativeControl2Y WRITE setRelativeControl2Y NOTIFY relativeControl2YChanged) + QML_NAMED_ELEMENT(PathCubic) public: QQuickPathCubic(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -277,6 +286,7 @@ private: class Q_QUICK_PRIVATE_EXPORT QQuickPathCatmullRomCurve : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathCurve) public: QQuickPathCatmullRomCurve(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -291,6 +301,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathArc : public QQuickCurve Q_PROPERTY(bool useLargeArc READ useLargeArc WRITE setUseLargeArc NOTIFY useLargeArcChanged) Q_PROPERTY(ArcDirection direction READ direction WRITE setDirection NOTIFY directionChanged) Q_PROPERTY(qreal xAxisRotation READ xAxisRotation WRITE setXAxisRotation NOTIFY xAxisRotationChanged REVISION 9) + QML_NAMED_ELEMENT(PathArc) public: QQuickPathArc(QObject *parent=nullptr) @@ -342,6 +353,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve Q_PROPERTY(qreal sweepAngle READ sweepAngle WRITE setSweepAngle NOTIFY sweepAngleChanged) Q_PROPERTY(bool moveToStart READ moveToStart WRITE setMoveToStart NOTIFY moveToStartChanged) + QML_NAMED_ELEMENT(PathAngleArc) + QML_ADDED_IN_MINOR_VERSION(11) + public: QQuickPathAngleArc(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -392,6 +406,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathSvg : public QQuickCurve { Q_OBJECT Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QML_NAMED_ELEMENT(PathSvg) public: QQuickPathSvg(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -411,6 +426,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPercent : public QQuickPathElement { Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PathPercent) public: QQuickPathPercent(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -429,6 +445,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPolyline : public QQuickCurve Q_OBJECT Q_PROPERTY(QPointF start READ start NOTIFY startChanged) Q_PROPERTY(QVariant path READ path WRITE setPath NOTIFY pathChanged) + QML_NAMED_ELEMENT(PathPolyline) + QML_ADDED_IN_MINOR_VERSION(14) public: QQuickPathPolyline(QObject *parent=nullptr); @@ -451,6 +469,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathMultiline : public QQuickCurve Q_OBJECT Q_PROPERTY(QPointF start READ start NOTIFY startChanged) Q_PROPERTY(QVariant paths READ paths WRITE setPaths NOTIFY pathsChanged) + QML_NAMED_ELEMENT(PathMultiline) + QML_ADDED_IN_MINOR_VERSION(14) public: QQuickPathMultiline(QObject *parent=nullptr); @@ -493,6 +513,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPath : public QObject, public QQmlParserStatu Q_PROPERTY(bool closed READ isClosed NOTIFY changed) Q_PROPERTY(QSizeF scale READ scale WRITE setScale NOTIFY scaleChanged REVISION 14) Q_CLASSINFO("DefaultProperty", "pathElements") + QML_NAMED_ELEMENT(Path) Q_INTERFACES(QQmlParserStatus) public: QQuickPath(QObject *parent=nullptr); diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h index 60a9ff2e22..440ea06841 100644 --- a/src/quick/util/qquickpathinterpolator_p.h +++ b/src/quick/util/qquickpathinterpolator_p.h @@ -69,6 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickPathInterpolator : public QObject Q_PROPERTY(qreal x READ x NOTIFY xChanged) Q_PROPERTY(qreal y READ y NOTIFY yChanged) Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged) + QML_NAMED_ELEMENT(PathInterpolator) public: explicit QQuickPathInterpolator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickpropertychanges_p.h b/src/quick/util/qquickpropertychanges_p.h index 82a6ebffac..27a00420af 100644 --- a/src/quick/util/qquickpropertychanges_p.h +++ b/src/quick/util/qquickpropertychanges_p.h @@ -65,6 +65,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPropertyChanges : public QQuickStateOperation Q_PROPERTY(QObject *target READ object WRITE setObject) Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues) Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit) + QML_NAMED_ELEMENT(PropertyChanges) + public: QQuickPropertyChanges(); ~QQuickPropertyChanges(); @@ -107,6 +109,11 @@ public: void applyBindings(QObject *obj, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override; }; +template<> +inline QQmlCustomParser *qmlCreateCustomParser<QQuickPropertyChanges>() +{ + return new QQuickPropertyChangesParser; +} QT_END_NAMESPACE diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h index 712cca7696..0e66a38e75 100644 --- a/src/quick/util/qquickshortcut_p.h +++ b/src/quick/util/qquickshortcut_p.h @@ -56,6 +56,7 @@ #include <QtCore/qvariant.h> #include <QtGui/qkeysequence.h> #include <QtQml/qqmlparserstatus.h> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -72,6 +73,8 @@ class QQuickShortcut : public QObject, public QQmlParserStatus Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL) Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL) + QML_NAMED_ELEMENT(Shortcut) + QML_ADDED_IN_MINOR_VERSION(5) public: explicit QQuickShortcut(QObject *parent = nullptr); diff --git a/src/quick/util/qquicksmoothedanimation_p.h b/src/quick/util/qquicksmoothedanimation_p.h index 7bceba387c..d7e637446d 100644 --- a/src/quick/util/qquicksmoothedanimation_p.h +++ b/src/quick/util/qquicksmoothedanimation_p.h @@ -68,6 +68,7 @@ class Q_AUTOTEST_EXPORT QQuickSmoothedAnimation : public QQuickNumberAnimation Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged) Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged) Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged) + QML_NAMED_ELEMENT(SmoothedAnimation) public: enum ReversingMode { Eased, Immediate, Sync }; diff --git a/src/quick/util/qquickspringanimation_p.h b/src/quick/util/qquickspringanimation_p.h index 2014a4311a..771b746622 100644 --- a/src/quick/util/qquickspringanimation_p.h +++ b/src/quick/util/qquickspringanimation_p.h @@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQuickSpringAnimation : public QQuickNumberAnimation Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon) Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged) Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged) + QML_NAMED_ELEMENT(SpringAnimation) public: QQuickSpringAnimation(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstate_p.h b/src/quick/util/qquickstate_p.h index 576ba9834c..af49bb1c2f 100644 --- a/src/quick/util/qquickstate_p.h +++ b/src/quick/util/qquickstate_p.h @@ -125,6 +125,7 @@ class QQuickStateOperationPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickStateOperation : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickStateOperation(QObject *parent = nullptr) : QObject(parent) {} @@ -157,6 +158,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickState : public QObject Q_PROPERTY(QQmlListProperty<QQuickStateOperation> changes READ changes) Q_CLASSINFO("DefaultProperty", "changes") Q_CLASSINFO("DeferredPropertyNames", "changes") + QML_NAMED_ELEMENT(State) public: QQuickState(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstatechangescript_p.h b/src/quick/util/qquickstatechangescript_p.h index ff509a7cf5..931baaca4e 100644 --- a/src/quick/util/qquickstatechangescript_p.h +++ b/src/quick/util/qquickstatechangescript_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickStateChangeScript : public QQuickStateOperation, p Q_PROPERTY(QQmlScriptString script READ script WRITE setScript) Q_PROPERTY(QString name READ name WRITE setName) + QML_NAMED_ELEMENT(StateChangeScript) public: QQuickStateChangeScript(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstategroup_p.h b/src/quick/util/qquickstategroup_p.h index 7235066d99..11a0c5f442 100644 --- a/src/quick/util/qquickstategroup_p.h +++ b/src/quick/util/qquickstategroup_p.h @@ -65,6 +65,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStateGroup : public QObject, public QQmlParse Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QQmlListProperty<QQuickState> states READ statesProperty DESIGNABLE false) Q_PROPERTY(QQmlListProperty<QQuickTransition> transitions READ transitionsProperty DESIGNABLE false) + QML_NAMED_ELEMENT(StateGroup) public: QQuickStateGroup(QObject * = nullptr); diff --git a/src/quick/util/qquicksystempalette_p.h b/src/quick/util/qquicksystempalette_p.h index 9a3a520ed1..c6d9fc2604 100644 --- a/src/quick/util/qquicksystempalette_p.h +++ b/src/quick/util/qquicksystempalette_p.h @@ -79,6 +79,7 @@ class Q_AUTOTEST_EXPORT QQuickSystemPalette : public QObject Q_PROPERTY(QColor shadow READ shadow NOTIFY paletteChanged) Q_PROPERTY(QColor highlight READ highlight NOTIFY paletteChanged) Q_PROPERTY(QColor highlightedText READ highlightedText NOTIFY paletteChanged) + QML_NAMED_ELEMENT(SystemPalette) public: QQuickSystemPalette(QObject *parent=nullptr); diff --git a/src/quick/util/qquicktextmetrics_p.h b/src/quick/util/qquicktextmetrics_p.h index 4fb6741996..a1d64e3d0a 100644 --- a/src/quick/util/qquicktextmetrics_p.h +++ b/src/quick/util/qquicktextmetrics_p.h @@ -74,6 +74,8 @@ class Q_AUTOTEST_EXPORT QQuickTextMetrics : public QObject Q_PROPERTY(QString elidedText READ elidedText NOTIFY metricsChanged FINAL) Q_PROPERTY(Qt::TextElideMode elide READ elide WRITE setElide NOTIFY elideChanged FINAL) Q_PROPERTY(qreal elideWidth READ elideWidth WRITE setElideWidth NOTIFY elideWidthChanged FINAL) + QML_NAMED_ELEMENT(TextMetrics) + QML_ADDED_IN_MINOR_VERSION(4) public: explicit QQuickTextMetrics(QObject *parent = 0); diff --git a/src/quick/util/qquicktransition_p.h b/src/quick/util/qquicktransition_p.h index c7d06b8832..6e45143126 100644 --- a/src/quick/util/qquicktransition_p.h +++ b/src/quick/util/qquicktransition_p.h @@ -103,6 +103,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTransition : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_CLASSINFO("DefaultProperty", "animations") Q_CLASSINFO("DeferredPropertyNames", "animations") + QML_NAMED_ELEMENT(Transition) public: QQuickTransition(QObject *parent=nullptr); diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 93b6599506..650a8c7e81 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -40,6 +40,7 @@ #include "qquickutilmodule_p.h" #include "qquickanimation_p.h" #include "qquickanimation_p_p.h" +#include "qquickapplication_p.h" #include "qquickbehavior_p.h" #include "qquicksmoothedanimation_p.h" #include "qquickfontloader_p.h" @@ -58,12 +59,11 @@ #include "qquickshortcut_p.h" #endif #include "qquickvalidator_p.h" +#include "qquickforeignutils_p.h" #include <qqmlinfo.h> #include <private/qqmltypenotavailable_p.h> #include <private/qquickanimationcontroller_p.h> #include <QtCore/qcoreapplication.h> -#include <QtGui/QInputMethod> -#include <QtGui/QKeySequence> #if QT_CONFIG(shortcut) Q_DECLARE_METATYPE(QKeySequence::StandardKey) @@ -71,73 +71,61 @@ Q_DECLARE_METATYPE(QKeySequence::StandardKey) void QQuickUtilModule::defineModule() { -#if QT_CONFIG(im) - qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputMethod", - QInputMethod::tr("InputMethod is an abstract class")); +#if QT_CONFIG(shortcut) + qRegisterMetaType<QKeySequence::StandardKey>(); #endif - qmlRegisterUncreatableType<QQuickAbstractAnimation>("QtQuick",2,0,"Animation",QQuickAbstractAnimation::tr("Animation is an abstract class")); - - qmlRegisterType<QQuickBehavior>("QtQuick",2,0,"Behavior"); - qmlRegisterType<QQuickColorAnimation>("QtQuick",2,0,"ColorAnimation"); - qmlRegisterType<QQuickSmoothedAnimation>("QtQuick",2,0,"SmoothedAnimation"); - qmlRegisterType<QQuickFontLoader>("QtQuick",2,0,"FontLoader"); - qmlRegisterType<QQuickNumberAnimation>("QtQuick",2,0,"NumberAnimation"); - qmlRegisterType<QQuickParallelAnimation>("QtQuick",2,0,"ParallelAnimation"); - qmlRegisterType<QQuickPauseAnimation>("QtQuick",2,0,"PauseAnimation"); - qmlRegisterType<QQuickPropertyAction>("QtQuick",2,0,"PropertyAction"); - qmlRegisterType<QQuickPropertyAnimation>("QtQuick",2,0,"PropertyAnimation"); - qmlRegisterType<QQuickRotationAnimation>("QtQuick",2,0,"RotationAnimation"); - qmlRegisterType<QQuickScriptAction>("QtQuick",2,0,"ScriptAction"); - qmlRegisterType<QQuickSequentialAnimation>("QtQuick",2,0,"SequentialAnimation"); - qmlRegisterType<QQuickSpringAnimation>("QtQuick",2,0,"SpringAnimation"); - qmlRegisterType<QQuickAnimationController>("QtQuick",2,0,"AnimationController"); - qmlRegisterType<QQuickStateChangeScript>("QtQuick",2,0,"StateChangeScript"); - qmlRegisterType<QQuickStateGroup>("QtQuick",2,0,"StateGroup"); - qmlRegisterType<QQuickState>("QtQuick",2,0,"State"); - qmlRegisterType<QQuickSystemPalette>("QtQuick",2,0,"SystemPalette"); - qmlRegisterType<QQuickTransition>("QtQuick",2,0,"Transition"); - qmlRegisterType<QQuickVector3dAnimation>("QtQuick",2,0,"Vector3dAnimation"); + qmlRegisterTypesAndRevisions< #if QT_CONFIG(validator) - qmlRegisterAnonymousType<QValidator>("QtQuick", 2); - qmlRegisterType<QQuickIntValidator>("QtQuick",2,0,"IntValidator"); - qmlRegisterType<QQuickDoubleValidator>("QtQuick",2,0,"DoubleValidator"); - qmlRegisterType<QRegExpValidator>("QtQuick",2,0,"RegExpValidator"); + QValidatorForeign, + QQuickIntValidator, + QQuickDoubleValidator, + QRegExpValidatorForeign, #if QT_CONFIG(regularexpression) - qmlRegisterType<QRegularExpressionValidator>("QtQuick", 2, 14, "RegularExpressionValidator"); -#endif -#endif - - qmlRegisterUncreatableType<QQuickAnimator>("QtQuick", 2, 2, "Animator", QQuickAbstractAnimation::tr("Animator is an abstract class")); - qmlRegisterType<QQuickXAnimator>("QtQuick", 2, 2, "XAnimator"); - qmlRegisterType<QQuickYAnimator>("QtQuick", 2, 2, "YAnimator"); - qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator"); - qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator"); - qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator"); + QRegularExpressionValidatorForeign, +#endif // QT_CONFIG(regularexpression) +#endif // QT_CONFIG(validator) #if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) - qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator"); + QQuickUniformAnimator, #endif - qmlRegisterAnonymousType<QQuickStateOperation>("QtQuick", 2); - - qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser); - #if QT_CONFIG(shortcut) - qRegisterMetaType<QKeySequence::StandardKey>(); - qmlRegisterUncreatableType<QKeySequence, 2>("QtQuick", 2, 2, "StandardKey", QStringLiteral("Cannot create an instance of StandardKey.")); + QQuickShortcut, + QKeySequenceForeign, #endif - - qmlRegisterType<QQuickFontMetrics>("QtQuick", 2, 4, "FontMetrics"); - qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics"); - -#if QT_CONFIG(shortcut) - qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut"); - qmlRegisterType<QQuickShortcut,6>("QtQuick", 2, 6, "Shortcut"); - - qmlRegisterType<QQuickShortcut,9>("QtQuick", 2, 9, "Shortcut"); +#if QT_CONFIG(im) + QInputMethodForeign, #endif - - qmlRegisterUncreatableType<QQuickAbstractAnimation, 12>("QtQuick", 2, 12, "Animation", - QQuickAbstractAnimation::tr("Animation is an abstract class")); - // 5.13 - qmlRegisterType<QQuickBehavior, 13>("QtQuick", 2, 13, "Behavior"); + QQuickAbstractAnimation, + QQuickBehavior, + QQuickColorAnimation, + QQuickSmoothedAnimation, + QQuickFontLoader, + QQuickNumberAnimation, + QQuickParallelAnimation, + QQuickPauseAnimation, + QQuickPropertyAction, + QQuickPropertyAnimation, + QQuickRotationAnimation, + QQuickScriptAction, + QQuickSequentialAnimation, + QQuickSpringAnimation, + QQuickAnimationController, + QQuickStateChangeScript, + QQuickStateGroup, + QQuickState, + QQuickSystemPalette, + QQuickTransition, + QQuickVector3dAnimation, + QQuickAnimator, + QQuickXAnimator, + QQuickYAnimator, + QQuickScaleAnimator, + QQuickRotationAnimator, + QQuickOpacityAnimator, + QQuickStateOperation, + QQuickPropertyChanges, + QQuickFontMetrics, + QQuickTextMetrics, + QQuickApplication + >("QtQuick", 2); } diff --git a/src/quick/util/qquickvalidator_p.h b/src/quick/util/qquickvalidator_p.h index 9212efa044..a0dc2cd5ba 100644 --- a/src/quick/util/qquickvalidator_p.h +++ b/src/quick/util/qquickvalidator_p.h @@ -61,6 +61,7 @@ class Q_AUTOTEST_EXPORT QQuickIntValidator : public QIntValidator { Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) + QML_NAMED_ELEMENT(IntValidator) public: QQuickIntValidator(QObject *parent = nullptr); @@ -76,6 +77,7 @@ class Q_AUTOTEST_EXPORT QQuickDoubleValidator : public QDoubleValidator { Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) + QML_NAMED_ELEMENT(DoubleValidator) public: QQuickDoubleValidator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 5a9af970e8..25fac72a38 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -326,6 +326,9 @@ class QQuickFontValueType Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL) Q_PROPERTY(bool preferShaping READ preferShaping WRITE setPreferShaping FINAL) + QML_NAMED_ELEMENT(Font) + QML_UNCREATABLE("Element is not creatable.") + public: enum FontWeight { Thin = QFont::Thin, ExtraLight = QFont::ExtraLight, diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 63d995e34c..ae06f7a7fe 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -65,7 +65,8 @@ HEADERS += \ $$PWD/qquickprofiler_p.h \ $$PWD/qquickfontmetrics_p.h \ $$PWD/qquicktextmetrics_p.h \ - $$PWD/qquickvalidator_p.h + $$PWD/qquickvalidator_p.h \ + $$PWD/qquickforeignutils_p.h qtConfig(shortcut) { SOURCES += \ |