diff options
Diffstat (limited to 'src/quick')
88 files changed, 643 insertions, 379 deletions
diff --git a/src/quick/handlers/qquickdragaxis_p.h b/src/quick/handlers/qquickdragaxis_p.h index a4649d5eb9..ef74902122 100644 --- a/src/quick/handlers/qquickdragaxis_p.h +++ b/src/quick/handlers/qquickdragaxis_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtQml/qqml.h> #include <private/qtquickglobal_p.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickDragAxis : public QObject Q_PROPERTY(qreal minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) Q_PROPERTY(qreal maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + QML_NAMED_ELEMENT(DragAxis) + QML_ADDED_IN_MINOR_VERSION(12) + QML_UNCREATABLE("DragAxis is only available as a grouped property of DragHandler.") public: QQuickDragAxis(); diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h index e8f47163ed..22d51c78ec 100644 --- a/src/quick/handlers/qquickdraghandler_p.h +++ b/src/quick/handlers/qquickdraghandler_p.h @@ -63,6 +63,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickDragHandler : public QQuickMultiPointHandler Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT) Q_PROPERTY(QVector2D translation READ translation NOTIFY translationChanged) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged REVISION 14) + QML_NAMED_ELEMENT(DragHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: enum SnapMode { diff --git a/src/quick/handlers/qquickhoverhandler_p.h b/src/quick/handlers/qquickhoverhandler_p.h index d8e5fc00a1..e4786bfa53 100644 --- a/src/quick/handlers/qquickhoverhandler_p.h +++ b/src/quick/handlers/qquickhoverhandler_p.h @@ -62,6 +62,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickHoverHandler : public QQuickSinglePointHandle { Q_OBJECT Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged) + QML_NAMED_ELEMENT(HoverHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickHoverHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h index cea794f0c8..708c836acf 100644 --- a/src/quick/handlers/qquickpinchhandler_p.h +++ b/src/quick/handlers/qquickpinchhandler_p.h @@ -78,6 +78,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPinchHandler : public QQuickMultiPointHandler #endif Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT) Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT) + QML_NAMED_ELEMENT(PinchHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickPinchHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 995db9c1dc..34ae9ce2c2 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -73,6 +73,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandler : public QObject, public QQmlP Q_PROPERTY(qreal margin READ margin WRITE setMargin NOTIFY marginChanged) Q_PROPERTY(int dragThreshold READ dragThreshold WRITE setDragThreshold RESET resetDragThreshold NOTIFY dragThresholdChanged REVISION 15) + QML_NAMED_ELEMENT(PointerHandler) + QML_UNCREATABLE("PointerHandler is an abstract base class.") + QML_ADDED_IN_MINOR_VERSION(12) + public: explicit QQuickPointerHandler(QQuickItem *parent = nullptr); ~QQuickPointerHandler(); diff --git a/src/quick/handlers/qquickpointhandler_p.h b/src/quick/handlers/qquickpointhandler_p.h index c197cb4f20..42677540a7 100644 --- a/src/quick/handlers/qquickpointhandler_p.h +++ b/src/quick/handlers/qquickpointhandler_p.h @@ -59,6 +59,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointHandler : public QQuickSinglePointHandle { Q_OBJECT Q_PROPERTY(QVector2D translation READ translation NOTIFY translationChanged) + QML_NAMED_ELEMENT(PointHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickPointHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h index 56e08590b2..07454bccb8 100644 --- a/src/quick/handlers/qquicktaphandler_p.h +++ b/src/quick/handlers/qquicktaphandler_p.h @@ -67,6 +67,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTapHandler : public QQuickSinglePointHandler Q_PROPERTY(qreal longPressThreshold READ longPressThreshold WRITE setLongPressThreshold NOTIFY longPressThresholdChanged) Q_PROPERTY(GesturePolicy gesturePolicy READ gesturePolicy WRITE setGesturePolicy NOTIFY gesturePolicyChanged) + QML_NAMED_ELEMENT(TapHandler) + QML_ADDED_IN_MINOR_VERSION(12) + public: enum GesturePolicy { DragThreshold, diff --git a/src/quick/handlers/qquickwheelhandler_p.h b/src/quick/handlers/qquickwheelhandler_p.h index f8d1c00726..26b052c5b3 100644 --- a/src/quick/handlers/qquickwheelhandler_p.h +++ b/src/quick/handlers/qquickwheelhandler_p.h @@ -72,6 +72,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWheelHandler : public QQuickSinglePointHandle Q_PROPERTY(qreal targetScaleMultiplier READ targetScaleMultiplier WRITE setTargetScaleMultiplier NOTIFY targetScaleMultiplierChanged) Q_PROPERTY(bool targetTransformAroundCursor READ isTargetTransformAroundCursor WRITE setTargetTransformAroundCursor NOTIFY targetTransformAroundCursorChanged) + QML_NAMED_ELEMENT(WheelHandler) + QML_ADDED_IN_MINOR_VERSION(14) + public: explicit QQuickWheelHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index cd2977429b..6575caf806 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -99,6 +99,7 @@ class QQuickCanvasItem : public QQuickItem Q_PROPERTY(QRectF canvasWindow READ canvasWindow WRITE setCanvasWindow NOTIFY canvasWindowChanged) Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged) Q_PROPERTY(RenderStrategy renderStrategy READ renderStrategy WRITE setRenderStrategy NOTIFY renderStrategyChanged) + QML_NAMED_ELEMENT(Canvas) public: enum RenderTarget { diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index f4194ef13d..678c1361ba 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -90,6 +90,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAccessibleAttached : public QObject Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged FINAL) Q_PROPERTY(bool ignored READ ignored WRITE setIgnored NOTIFY ignoredChanged FINAL) + QML_NAMED_ELEMENT(Accessible) + QML_UNCREATABLE("Accessible is only available via attached properties.") + QML_ATTACHED(QQuickAccessibleAttached) + public: Q_ENUMS(QAccessible::Role QAccessible::Event) STATE_PROPERTY(checkable) @@ -237,7 +241,6 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickAccessibleAttached) -QML_DECLARE_TYPEINFO(QQuickAccessibleAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // accessibility diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h index c7995cb7a8..e0276549e9 100644 --- a/src/quick/items/qquickanchors_p.h +++ b/src/quick/items/qquickanchors_p.h @@ -84,6 +84,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAnchors : public QObject Q_PROPERTY(QQuickItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QQuickItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) Q_PROPERTY(bool alignWhenCentered READ alignWhenCentered WRITE setAlignWhenCentered NOTIFY centerAlignedChanged) + QML_ANONYMOUS public: QQuickAnchors(QQuickItem *item, QObject *parent=nullptr); diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h index ef5af6b387..d18e7c43c7 100644 --- a/src/quick/items/qquickanimatedimage_p.h +++ b/src/quick/items/qquickanimatedimage_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedImage : public QQuickImage // read-only for AnimatedImage Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + QML_NAMED_ELEMENT(AnimatedImage) public: QQuickAnimatedImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index ff59591c9f..ff5002334e 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -92,6 +92,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedSprite : public QQuickItem Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) Q_PROPERTY(bool paused READ paused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged) + QML_NAMED_ELEMENT(AnimatedSprite) public: explicit QQuickAnimatedSprite(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h index 61bd26ba83..515edb33da 100644 --- a/src/quick/items/qquickborderimage_p.h +++ b/src/quick/items/qquickborderimage_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickBorderImage : public QQuickImageBase Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) // read-only for BorderImage Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + QML_NAMED_ELEMENT(BorderImage) public: QQuickBorderImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 028b2b153d..4840333923 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE class QQuickDragAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener { Q_DECLARE_PUBLIC(QQuickDragAttached) + QML_ANONYMOUS + public: static QQuickDragAttachedPrivate *get(QQuickDragAttached *attached) { return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); } diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h index 094070aa2c..9dbaac18f9 100644 --- a/src/quick/items/qquickdrag_p.h +++ b/src/quick/items/qquickdrag_p.h @@ -172,6 +172,10 @@ class Q_AUTOTEST_EXPORT QQuickDrag : public QObject Q_PROPERTY(qreal threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged RESET resetThreshold) //### consider drag and drop + QML_NAMED_ELEMENT(Drag) + QML_UNCREATABLE("Drag is only available via attached properties.") + QML_ATTACHED(QQuickDragAttached) + public: QQuickDrag(QObject *parent=nullptr); ~QQuickDrag(); @@ -254,6 +258,9 @@ class QQuickDragAttached : public QObject Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged) Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction WRITE setProposedAction NOTIFY proposedActionChanged) Q_PROPERTY(QQuickDrag::DragType dragType READ dragType WRITE setDragType NOTIFY dragTypeChanged) + + QML_ANONYMOUS + public: QQuickDragAttached(QObject *parent); ~QQuickDragAttached(); @@ -316,6 +323,5 @@ Q_SIGNALS: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickDrag) -QML_DECLARE_TYPEINFO(QQuickDrag, QML_HAS_ATTACHED_PROPERTIES) #endif diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index 2b2ace2eae..ee2deaa97a 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -80,6 +80,7 @@ class QQuickDropEvent : public QObject Q_PROPERTY(QString text READ text) Q_PROPERTY(QList<QUrl> urls READ urls) Q_PROPERTY(QStringList formats READ formats) + QML_ANONYMOUS public: QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {} @@ -125,6 +126,7 @@ class QQuickDropAreaDrag : public QObject Q_PROPERTY(qreal x READ x NOTIFY positionChanged) Q_PROPERTY(qreal y READ y NOTIFY positionChanged) Q_PROPERTY(QObject *source READ source NOTIFY sourceChanged) + QML_ANONYMOUS public: QQuickDropAreaDrag(QQuickDropAreaPrivate *d, QObject *parent = 0); ~QQuickDropAreaDrag(); @@ -151,6 +153,7 @@ class Q_AUTOTEST_EXPORT QQuickDropArea : public QQuickItem Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged) Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged) Q_PROPERTY(QQuickDropAreaDrag *drag READ drag CONSTANT) + QML_NAMED_ELEMENT(DropArea) public: QQuickDropArea(QQuickItem *parent=0); diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 1a3737091f..1d2ffefc9d 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -84,6 +84,7 @@ class QQuickKeyEvent : public QObject Q_PROPERTY(int count READ count CONSTANT) Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickKeyEvent() @@ -135,6 +136,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject Q_PROPERTY(bool isClick READ isClick CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) Q_PROPERTY(int flags READ flags CONSTANT REVISION 11) + QML_ANONYMOUS public: QQuickMouseEvent() @@ -201,6 +203,7 @@ class QQuickWheelEvent : public QObject Q_PROPERTY(int modifiers READ modifiers CONSTANT) Q_PROPERTY(bool inverted READ inverted CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickWheelEvent() @@ -245,6 +248,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject { Q_OBJECT Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickCloseEvent() {} @@ -271,6 +275,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) Q_PROPERTY(QObject *exclusiveGrabber READ exclusiveGrabber WRITE setExclusiveGrabber) + QML_NAMED_ELEMENT(EventPoint) + QML_UNCREATABLE("EventPoint is only available as a member of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: enum State { Pressed = Qt::TouchPointPressed, @@ -362,6 +370,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters) Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) + QML_NAMED_ELEMENT(EventTouchPoint) + QML_UNCREATABLE("EventTouchPoint is only available as a member of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickEventTouchPoint(QQuickPointerTouchEvent *parent); @@ -391,6 +403,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerEvent : public QObject Q_PROPERTY(Qt::MouseButtons button READ button CONSTANT) Q_PROPERTY(Qt::MouseButtons buttons READ buttons CONSTANT) + QML_NAMED_ELEMENT(PointerEvent) + QML_UNCREATABLE("PointerEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QObject(parent) @@ -482,6 +498,11 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickPointerMouseEvent : public QQuickSinglePointEvent { Q_OBJECT + + QML_NAMED_ELEMENT(PointerMouseEvent) + QML_UNCREATABLE("PointerMouseEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerMouseEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickSinglePointEvent(parent, device) { } @@ -502,6 +523,11 @@ public: class Q_QUICK_PRIVATE_EXPORT QQuickPointerTouchEvent : public QQuickPointerEvent { Q_OBJECT + + QML_NAMED_ELEMENT(PointerTouchEvent) + QML_UNCREATABLE("PointerTouchEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerTouchEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickPointerEvent(parent, device) @@ -623,6 +649,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerDevice : public QObject Q_PROPERTY(QString name READ name CONSTANT) Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT) + QML_NAMED_ELEMENT(PointerDevice) + QML_UNCREATABLE("PointerDevice is only available as a property of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: enum DeviceType : qint16 { UnknownDevice = 0x0000, diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index c54ed5ce71..2d8d4a5e9a 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -114,6 +114,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem Q_PROPERTY(QQmlListProperty<QObject> flickableData READ flickableData) Q_PROPERTY(QQmlListProperty<QQuickItem> flickableChildren READ flickableChildren) Q_CLASSINFO("DefaultProperty", "flickableData") + QML_NAMED_ELEMENT(Flickable) public: QQuickFlickable(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index 835c54170f..1ff55dae90 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -284,6 +284,7 @@ class QQuickFlickableVisibleArea : public QObject Q_PROPERTY(qreal yPosition READ yPosition NOTIFY yPositionChanged) Q_PROPERTY(qreal widthRatio READ widthRatio NOTIFY widthRatioChanged) Q_PROPERTY(qreal heightRatio READ heightRatio NOTIFY heightRatioChanged) + QML_ANONYMOUS public: QQuickFlickableVisibleArea(QQuickFlickable *parent=nullptr); diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h index d70cd02d35..42c632a33c 100644 --- a/src/quick/items/qquickflipable_p.h +++ b/src/quick/items/qquickflipable_p.h @@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQuickFlipable : public QQuickItem Q_PROPERTY(QQuickItem *front READ front WRITE setFront NOTIFY frontChanged) Q_PROPERTY(QQuickItem *back READ back WRITE setBack NOTIFY backChanged) Q_PROPERTY(Side side READ side NOTIFY sideChanged) + QML_NAMED_ELEMENT(Flipable) //### flipAxis //### flipRotation public: diff --git a/src/quick/items/qquickfocusscope_p.h b/src/quick/items/qquickfocusscope_p.h index af750fc127..c32fa93cd9 100644 --- a/src/quick/items/qquickfocusscope_p.h +++ b/src/quick/items/qquickfocusscope_p.h @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QQuickFocusScope : public QQuickItem { Q_OBJECT + QML_NAMED_ELEMENT(FocusScope) public: QQuickFocusScope(QQuickItem *parent=nullptr); virtual ~QQuickFocusScope(); diff --git a/src/quick/items/qquickgraphicsinfo_p.h b/src/quick/items/qquickgraphicsinfo_p.h index f0a18c29cc..066a419c37 100644 --- a/src/quick/items/qquickgraphicsinfo_p.h +++ b/src/quick/items/qquickgraphicsinfo_p.h @@ -75,6 +75,11 @@ class QQuickGraphicsInfo : public QObject Q_PROPERTY(OpenGLContextProfile profile READ profile NOTIFY profileChanged FINAL) Q_PROPERTY(RenderableType renderableType READ renderableType NOTIFY renderableTypeChanged FINAL) + QML_NAMED_ELEMENT(GraphicsInfo) + QML_ADDED_IN_MINOR_VERSION(8) + QML_UNCREATABLE("GraphicsInfo is only available via attached properties.") + QML_ATTACHED(QQuickGraphicsInfo) + public: enum GraphicsApi { Unknown = QSGRendererInterface::Unknown, @@ -168,6 +173,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickGraphicsInfo, QML_HAS_ATTACHED_PROPERTIES) - #endif // QQUICKGRAPHICSINFO_P_H diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h index 7daeaf41a1..9072e5f269 100644 --- a/src/quick/items/qquickgridview_p.h +++ b/src/quick/items/qquickgridview_p.h @@ -73,6 +73,8 @@ class Q_AUTOTEST_EXPORT QQuickGridView : public QQuickItemView Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(GridView) + QML_ATTACHED(QQuickGridViewAttached) public: enum Flow { @@ -136,6 +138,5 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickGridView) -QML_DECLARE_TYPEINFO(QQuickGridView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKGRIDVIEW_P_H diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h index 257cde5313..f7e652cdcc 100644 --- a/src/quick/items/qquickimage_p.h +++ b/src/quick/items/qquickimage_p.h @@ -68,6 +68,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImage : public QQuickImageBase Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged) Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged REVISION 3) Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION 5) + QML_NAMED_ELEMENT(Image) public: QQuickImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index 8cd59c8cea..d1d01ad27d 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -71,6 +71,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImageBase : public QQuickImplicitSizeItem Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged REVISION 14) Q_PROPERTY(int frameCount READ frameCount NOTIFY frameCountChanged REVISION 14) + QML_NAMED_ELEMENT(ImageBase); + QML_ADDED_IN_MINOR_VERSION(14) + QML_UNCREATABLE("ImageBase is an abstract base class.") + public: QQuickImageBase(QQuickItem *parent=nullptr); ~QQuickImageBase(); diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 394a5adb8c..8c04ced11b 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -58,6 +58,7 @@ class QQuickTransformPrivate; class Q_QUICK_EXPORT QQuickTransform : public QObject { Q_OBJECT + QML_ANONYMOUS public: explicit QQuickTransform(QObject *parent = nullptr); ~QQuickTransform() override; @@ -150,6 +151,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_CLASSINFO("DefaultProperty", "data") Q_CLASSINFO("qt_QmlJSWrapperFactoryMethod", "_q_createJSWrapper(QV4::ExecutionEngine*)") + QML_NAMED_ELEMENT(Item) public: enum Flag { diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 3e8feec4bf..7c3325fd90 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -152,6 +152,7 @@ class QQuickItemLayer : public QObject, public QQuickItemChangeListener Q_PROPERTY(QQmlComponent *effect READ effect WRITE setEffect NOTIFY effectChanged) Q_PROPERTY(QQuickShaderEffectSource::TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged) Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged) + QML_ANONYMOUS public: QQuickItemLayer(QQuickItem *item); @@ -715,6 +716,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickKeyNavigationAttached : public QObject, publi Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged) Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) + QML_NAMED_ELEMENT(KeyNavigation) + QML_UNCREATABLE("KeyNavigation is only available via attached properties.") + QML_ATTACHED(QQuickKeyNavigationAttached) + public: QQuickKeyNavigationAttached(QObject * = nullptr); @@ -760,6 +765,10 @@ class QQuickLayoutMirroringAttached : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged) Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged) + QML_NAMED_ELEMENT(LayoutMirroring) + QML_UNCREATABLE("LayoutMirroring is only available via attached properties.") + QML_ATTACHED(QQuickLayoutMirroringAttached) + public: explicit QQuickLayoutMirroringAttached(QObject *parent = nullptr); @@ -784,6 +793,11 @@ class QQuickEnterKeyAttached : public QObject Q_OBJECT Q_PROPERTY(Qt::EnterKeyType type READ type WRITE setType NOTIFY typeChanged) + QML_NAMED_ELEMENT(EnterKey) + QML_UNCREATABLE("EnterKey is only available via attached properties") + QML_ADDED_IN_MINOR_VERSION(6) + QML_ATTACHED(QQuickEnterKeyAttached) + public: explicit QQuickEnterKeyAttached(QObject *parent = nullptr); @@ -829,6 +843,10 @@ class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo) Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) + QML_NAMED_ELEMENT(Keys) + QML_UNCREATABLE("Keys is only available via attached properties") + QML_ATTACHED(QQuickKeysAttached) + public: QQuickKeysAttached(QObject *parent=nullptr); ~QQuickKeysAttached() override; @@ -984,12 +1002,8 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickItemLayer) #endif QML_DECLARE_TYPE(QQuickKeysAttached) -QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickKeyNavigationAttached) -QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickLayoutMirroringAttached) -QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickEnterKeyAttached) -QML_DECLARE_TYPEINFO(QQuickEnterKeyAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKITEM_P_H diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h index b803455f12..28c18c874d 100644 --- a/src/quick/items/qquickitemanimation_p.h +++ b/src/quick/items/qquickitemanimation_p.h @@ -66,6 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickParentAnimation : public QQuickAnimationGroup Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged) Q_PROPERTY(QQuickItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged) Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged) + QML_NAMED_ELEMENT(ParentAnimation) public: QQuickParentAnimation(QObject *parent=nullptr); @@ -100,6 +101,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorAnimation : public QQuickAbstractAnimation Q_PROPERTY(QQmlListProperty<QQuickItem> targets READ targets) Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) + QML_NAMED_ELEMENT(AnchorAnimation) public: QQuickAnchorAnimation(QObject *parent=nullptr); @@ -143,6 +145,7 @@ class Q_AUTOTEST_EXPORT QQuickPathAnimation : public QQuickAbstractAnimation Q_PROPERTY(int orientationEntryDuration READ orientationEntryDuration WRITE setOrientationEntryDuration NOTIFY orientationEntryDurationChanged) Q_PROPERTY(int orientationExitDuration READ orientationExitDuration WRITE setOrientationExitDuration NOTIFY orientationExitDurationChanged) Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged) + QML_NAMED_ELEMENT(PathAnimation) public: QQuickPathAnimation(QObject *parent=nullptr); diff --git a/src/quick/items/qquickitemgrabresult.h b/src/quick/items/qquickitemgrabresult.h index 3dc10e2d75..c92a8c52f4 100644 --- a/src/quick/items/qquickitemgrabresult.h +++ b/src/quick/items/qquickitemgrabresult.h @@ -45,6 +45,7 @@ #include <QtCore/QUrl> #include <QtGui/QImage> #include <QtQml/QJSValue> +#include <QtQml/qqml.h> #include <QtQuick/qtquickglobal.h> QT_BEGIN_NAMESPACE @@ -60,6 +61,8 @@ class Q_QUICK_EXPORT QQuickItemGrabResult : public QObject Q_PROPERTY(QImage image READ image CONSTANT) Q_PROPERTY(QUrl url READ url CONSTANT) + QML_ANONYMOUS + public: QImage image() const; QUrl url() const; diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index fbfb7521ea..dd4e4dfdc0 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -175,331 +175,218 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject return QQmlPrivate::IncompatibleObject; } -static void qt_quickitems_defineModule(const char *uri, int major, int minor) +static void qt_quickitems_defineModule() { + const char *uri = "QtQuick"; + const int major = 2; + QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent }; QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); - // Register the latest version, even if there are no new types or new revisions for existing types yet. - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); - -#if !QT_CONFIG(quick_animatedimage) - qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie")); -#else - qmlRegisterType<QQuickAnimatedImage>(uri,major,minor,"AnimatedImage"); -#endif - qmlRegisterType<QQuickBorderImage>(uri,major,minor,"BorderImage"); - qmlRegisterType<QQuickFlickable>(uri,major,minor,"Flickable"); -#if QT_CONFIG(quick_flipable) - qmlRegisterType<QQuickFlipable>(uri,major,minor,"Flipable"); -#endif -// qmlRegisterType<QQuickFocusPanel>(uri,major,minor,"FocusPanel"); - qmlRegisterType<QQuickFocusScope>(uri,major,minor,"FocusScope"); - qmlRegisterType<QQuickGradient>(uri,major,minor,"Gradient"); - qmlRegisterType<QQuickGradientStop>(uri,major,minor,"GradientStop"); -#if QT_CONFIG(quick_positioners) - qmlRegisterType<QQuickColumn>(uri,major,minor,"Column"); - qmlRegisterType<QQuickFlow>(uri,major,minor,"Flow"); - qmlRegisterType<QQuickGrid>(uri,major,minor,"Grid"); - qmlRegisterUncreatableType<QQuickBasePositioner>(uri,major,minor,"Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); - qmlRegisterType<QQuickRow>(uri,major,minor,"Row"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView>(uri,major,minor,"GridView"); -#endif - qmlRegisterType<QQuickImage>(uri,major,minor,"Image"); - qmlRegisterType<QQuickItem>(uri,major,minor,"Item"); -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView>(uri,major,minor,"ListView"); - qmlRegisterType<QQuickViewSection>(uri,major,minor,"ViewSection"); -#endif - qmlRegisterType<QQuickLoader>(uri,major,minor,"Loader"); - qmlRegisterType<QQuickMouseArea>(uri,major,minor,"MouseArea"); -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPath>(uri,major,minor,"Path"); - qmlRegisterType<QQuickPathAttribute>(uri,major,minor,"PathAttribute"); - qmlRegisterType<QQuickPathCubic>(uri,major,minor,"PathCubic"); - qmlRegisterType<QQuickPathLine>(uri,major,minor,"PathLine"); - qmlRegisterType<QQuickPathPercent>(uri,major,minor,"PathPercent"); - qmlRegisterType<QQuickPathQuad>(uri,major,minor,"PathQuad"); - qmlRegisterType<QQuickPathCatmullRomCurve>("QtQuick",2,0,"PathCurve"); - qmlRegisterType<QQuickPathArc>("QtQuick",2,0,"PathArc"); - qmlRegisterType<QQuickPathSvg>("QtQuick",2,0,"PathSvg"); - qmlRegisterType<QQuickPath, 14>(uri, 2, 14, "Path"); - qmlRegisterType<QQuickPathPolyline>("QtQuick", 2, 14, "PathPolyline"); - qmlRegisterType<QQuickPathMultiline>("QtQuick", 2, 14, "PathMultiline"); -#endif -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView>(uri,major,minor,"PathView"); -#endif - qmlRegisterType<QQuickRectangle>(uri,major,minor,"Rectangle"); -#if QT_CONFIG(quick_repeater) - qmlRegisterType<QQuickRepeater>(uri,major,minor,"Repeater"); -#endif - qmlRegisterType<QQuickTranslate>(uri,major,minor,"Translate"); - qmlRegisterType<QQuickRotation>(uri,major,minor,"Rotation"); - qmlRegisterType<QQuickScale>(uri,major,minor,"Scale"); - qmlRegisterType<QQuickMatrix4x4>(uri,2,3,"Matrix4x4"); - qmlRegisterType<QQuickText>(uri,major,minor,"Text"); - qmlRegisterType<QQuickTextEdit>(uri,major,minor,"TextEdit"); - qmlRegisterType<QQuickTextEdit,1>(uri,2,1,"TextEdit"); - qmlRegisterType<QQuickTextInput>(uri,major,minor,"TextInput"); - qmlRegisterType<QQuickTextInput,2>(uri,2,2,"TextInput"); - qmlRegisterType<QQuickTextInput,4>(uri,2,4,"TextInput"); - qmlRegisterAnonymousType<QQuickItemGrabResult>(uri, major); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterAnonymousType<QQuickItemLayer>(uri, major); -#endif - qmlRegisterAnonymousType<QQuickAnchors>(uri, major); - qmlRegisterAnonymousType<QQuickKeyEvent>(uri, major); - qmlRegisterAnonymousType<QQuickMouseEvent>(uri, major); - qmlRegisterAnonymousType<QQuickWheelEvent>(uri, major); - qmlRegisterAnonymousType<QQuickCloseEvent>(uri, major); - qmlRegisterAnonymousType<QQuickTransform>(uri, major); -#if QT_CONFIG(quick_path) - qmlRegisterAnonymousType<QQuickPathElement>(uri, major); - qmlRegisterAnonymousType<QQuickCurve>(uri, major); -#endif - qmlRegisterAnonymousType<QQuickScaleGrid>(uri, major); - qmlRegisterAnonymousType<QQuickTextLine>(uri, major); - qmlRegisterAnonymousType<QQuickPen>(uri, major); - qmlRegisterAnonymousType<QQuickFlickableVisibleArea>(uri, major); qRegisterMetaType<QQuickAnchorLine>("QQuickAnchorLine"); + qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); + qRegisterMetaType<QQuickHandlerPoint>(); - qmlRegisterAnonymousType<QQuickTextDocument>(uri, major); - - - qmlRegisterUncreatableType<QQuickKeyNavigationAttached>(uri,major,minor,"KeyNavigation",QQuickKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); - qmlRegisterUncreatableType<QQuickKeysAttached>(uri,major,minor,"Keys",QQuickKeysAttached::tr("Keys is only available via attached properties")); - qmlRegisterUncreatableType<QQuickLayoutMirroringAttached>(uri,major,minor,"LayoutMirroring", QQuickLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); -#if QT_CONFIG(quick_viewtransitions) - qmlRegisterUncreatableType<QQuickViewTransitionAttached>(uri,major,minor,"ViewTransition",QQuickViewTransitionAttached::tr("ViewTransition is only available via attached properties")); -#endif + // Register the latest version, even if there are no new types or new revisions for existing types yet. + qmlRegisterModule(uri, major, QT_VERSION_MINOR); + + // Core QtQuick types + qmlRegisterTypesAndRevisions< + QPointingDeviceUniqueIdForeign, + QQuickAnchorAnimation, + QQuickAnchorChanges, + QQuickAnchors, + QQuickAnchorSet, + QQuickBorderImage, + QQuickEnterKeyAttached, + QQuickEventPoint, + QQuickEventTouchPoint, + QQuickFlickable, + QQuickFlickableVisibleArea, + QQuickFocusScope, + QQuickGradient, + QQuickGradientStop, + QQuickGraphicsInfo, + QQuickImage, + QQuickImageBase, + QQuickItem, + QQuickItemGrabResult, + QQuickKeyNavigationAttached, + QQuickKeysAttached, + QQuickLayoutMirroringAttached, + QQuickLoader, + QQuickMatrix4x4, + QQuickMouseArea, + QQuickMultiPointTouchArea, + QQuickPaintedItem, + QQuickParentAnimation, + QQuickParentChange, + QQuickPen, + QQuickPinch, + QQuickPinchArea, + QQuickPointerDevice, + QQuickRectangle, + QQuickRotation, + QQuickScale, + QQuickScaleGrid, + QQuickTouchPoint, + QQuickTransform, + QQuickTranslate + >(uri, major); + + // text-related types + qmlRegisterTypesAndRevisions< + QQuickText, + QQuickTextDocument, + QQuickTextEdit, + QQuickTextInput, + QQuickTextLine + >(uri, major); + + // events + qmlRegisterTypesAndRevisions< + QQuickCloseEvent, + QQuickDropEvent, + QQuickGrabGestureEvent, + QQuickKeyEvent, + QQuickMouseEvent, + QQuickPinchEvent, + QQuickPointerEvent, + QQuickPointerMouseEvent, + QQuickPointerTouchEvent, + QQuickWheelEvent + >(uri, major); - qmlRegisterType<QQuickPinchArea>(uri,major,minor,"PinchArea"); - qmlRegisterType<QQuickPinch>(uri,major,minor,"Pinch"); - qmlRegisterAnonymousType<QQuickPinchEvent>(uri, major); + // Input Handlers are part of QtQuick, not a separate module, since 5.12 + qmlRegisterTypesAndRevisions< + QQuickDragHandler, + QQuickHoverHandler, + QQuickPinchHandler, + QQuickPointerHandler, + QQuickPointHandler, + QQuickTapHandler + >(uri, major); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource>("QtQuick", 2, 0, "ShaderEffectSource"); - qmlRegisterUncreatableType<QQuickShaderEffectMesh>("QtQuick", 2, 0, "ShaderEffectMesh", QQuickShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); - qmlRegisterType<QQuickGridMesh>("QtQuick", 2, 0, "GridMesh"); - qmlRegisterType<QQuickShaderEffect>("QtQuick", 2, 0, "ShaderEffect"); +#if QT_CONFIG(accessibility) + qmlRegisterTypesAndRevisions<QQuickAccessibleAttached>(uri, major); #endif - qmlRegisterUncreatableType<QQuickPaintedItem>("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); - -#if QT_CONFIG(quick_canvas) - qmlRegisterType<QQuickCanvasItem>("QtQuick", 2, 0, "Canvas"); +#if QT_CONFIG(opengl) + qmlRegisterTypesAndRevisions<QQuickOpenGLInfo>(uri, major); #endif -#if QT_CONFIG(quick_sprite) - qmlRegisterType<QQuickSprite>("QtQuick", 2, 0, "Sprite"); - qmlRegisterType<QQuickAnimatedSprite>("QtQuick", 2, 0, "AnimatedSprite"); - qmlRegisterType<QQuickSpriteSequence>("QtQuick", 2, 0, "SpriteSequence"); +#if QT_CONFIG(quick_animatedimage) + qmlRegisterTypesAndRevisions<QQuickAnimatedImage>(uri, major); +#else + qmlRegisterTypeNotAvailable( + uri, major, minor, "AnimatedImage", + QCoreApplication::translate("QQuickAnimatedImage", + "Qt was built without support for QMovie")); #endif - qmlRegisterType<QQuickParentChange>(uri, major, minor,"ParentChange"); - qmlRegisterType<QQuickAnchorChanges>(uri, major, minor,"AnchorChanges"); - qmlRegisterAnonymousType<QQuickAnchorSet>(uri, major); - qmlRegisterType<QQuickAnchorAnimation>(uri, major, minor,"AnchorAnimation"); - qmlRegisterType<QQuickParentAnimation>(uri, major, minor,"ParentAnimation"); -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathAnimation>("QtQuick",2,0,"PathAnimation"); - qmlRegisterType<QQuickPathInterpolator>("QtQuick",2,0,"PathInterpolator"); +#if QT_CONFIG(quick_canvas) + qmlRegisterTypesAndRevisions<QQuickCanvasItem>(uri, major); #endif #if QT_CONFIG(quick_draganddrop) - qmlRegisterType<QQuickDropArea>("QtQuick", 2, 0, "DropArea"); - qmlRegisterAnonymousType<QQuickDropEvent>(uri, 2); - qmlRegisterAnonymousType<QQuickDropAreaDrag>(uri, 2); - qmlRegisterUncreatableType<QQuickDrag>("QtQuick", 2, 0, "Drag", QQuickDragAttached::tr("Drag is only available via attached properties")); + qmlRegisterTypesAndRevisions< + QQuickDrag, + QQuickDropArea, + QQuickDropAreaDrag, + QQuickDragAttached, + QQuickDragAxis + >(uri, major); #endif - qmlRegisterType<QQuickMultiPointTouchArea>("QtQuick", 2, 0, "MultiPointTouchArea"); - qmlRegisterType<QQuickTouchPoint>("QtQuick", 2, 0, "TouchPoint"); - qmlRegisterUncreatableType<QQuickGrabGestureEvent>(uri,major,minor, "GestureEvent", - QQuickMouseEvent::tr("GestureEvent is only available in the context of handling the gestureStarted signal from MultiPointTouchArea")); - -#if QT_CONFIG(accessibility) - qmlRegisterUncreatableType<QQuickAccessibleAttached>("QtQuick", 2, 0, "Accessible",QQuickAccessibleAttached::tr("Accessible is only available via attached properties")); +#if QT_CONFIG(quick_flipable) + qmlRegisterTypesAndRevisions<QQuickFlipable>(uri, major); #endif - qmlRegisterType<QQuickItem, 1>(uri, 2, 1,"Item"); #if QT_CONFIG(quick_positioners) - qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid"); -#endif -#if QT_CONFIG(quick_itemview) - const char *itemViewName = "ItemView"; - const QString itemViewMessage = QQuickItemView::tr("ItemView is an abstract base class"); - qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, itemViewName, itemViewMessage); - qmlRegisterUncreatableType<QQuickItemView, 3>(uri, 2, 3, itemViewName, itemViewMessage); -#endif -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 1>(uri, 2, 1, "GridView"); + qmlRegisterTypesAndRevisions< + QQuickBasePositioner, + QQuickColumn, + QQuickFlow, + QQuickGrid, + QQuickRow + >(uri, major); #endif - qmlRegisterType<QQuickTextEdit, 1>(uri, 2, 1, "TextEdit"); - qmlRegisterType<QQuickText, 2>(uri, 2, 2, "Text"); - qmlRegisterType<QQuickTextEdit, 2>(uri, 2, 2, "TextEdit"); - - qmlRegisterType<QQuickText, 3>(uri, 2, 3, "Text"); - qmlRegisterType<QQuickTextEdit, 3>(uri, 2, 3, "TextEdit"); - qmlRegisterType<QQuickImage, 3>(uri, 2, 3,"Image"); - - qmlRegisterType<QQuickItem, 4>(uri, 2, 4, "Item"); -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 4>(uri, 2, 4, "ListView"); -#endif - qmlRegisterType<QQuickMouseArea, 4>(uri, 2, 4, "MouseArea"); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffect, 4>(uri, 2, 4, "ShaderEffect"); -#endif - -#if QT_CONFIG(opengl) - qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties")); +#if QT_CONFIG(quick_gridview) + qmlRegisterTypesAndRevisions<QQuickGridView>(uri, major); #endif - qmlRegisterType<QQuickPinchArea, 5>(uri, 2, 5,"PinchArea"); - qmlRegisterType<QQuickImage, 5>(uri, 2, 5,"Image"); - qmlRegisterType<QQuickMouseArea, 5>(uri, 2, 5, "MouseArea"); - qmlRegisterType<QQuickText, 6>(uri, 2, 6, "Text"); - qmlRegisterType<QQuickTextEdit, 6>(uri, 2, 6, "TextEdit"); - qmlRegisterType<QQuickTextInput, 6>(uri, 2, 6, "TextInput"); -#if QT_CONFIG(quick_positioners) - qmlRegisterUncreatableType<QQuickBasePositioner, 6>(uri, 2, 6, "Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); - qmlRegisterType<QQuickColumn, 6>(uri, 2, 6, "Column"); - qmlRegisterType<QQuickRow, 6>(uri, 2, 6, "Row"); - qmlRegisterType<QQuickGrid, 6>(uri, 2, 6, "Grid"); - qmlRegisterType<QQuickFlow, 6>(uri, 2, 6, "Flow"); -#endif - qmlRegisterUncreatableType<QQuickEnterKeyAttached, 6>(uri, 2, 6, "EnterKey", - QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource, 6>(uri, 2, 6, "ShaderEffectSource"); +#if QT_CONFIG(quick_itemview) + qmlRegisterTypesAndRevisions<QQuickItemView>(uri, major); #endif - qmlRegisterType<QQuickItem, 7>(uri, 2, 7, "Item"); #if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 7>(uri, 2, 7, "ListView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 7>(uri, 2, 7, "GridView"); -#endif - qmlRegisterType<QQuickTextInput, 7>(uri, 2, 7, "TextInput"); - qmlRegisterType<QQuickTextEdit, 7>(uri, 2, 7, "TextEdit"); -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView, 7>(uri, 2, 7, "PathView"); -#endif -#if QT_CONFIG(quick_itemview) - qmlRegisterUncreatableType<QQuickItemView, 7>(uri, 2, 7, itemViewName, itemViewMessage); + qmlRegisterTypesAndRevisions< + QQuickViewSection, + QQuickListView + >(uri, major); #endif - qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); - - qmlRegisterUncreatableType<QQuickGraphicsInfo>(uri, 2, 8,"GraphicsInfo", QQuickGraphicsInfo::tr("GraphicsInfo is only available via attached properties")); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickBorderImageMesh>("QtQuick", 2, 8, "BorderImageMesh"); +#if QT_CONFIG(quick_path) + qmlRegisterTypesAndRevisions< + QQuickCurve, + QQuickPath, + QQuickPathAngleArc, + QQuickPathAnimation, + QQuickPathArc, + QQuickPathAttribute, + QQuickPathCatmullRomCurve, + QQuickPathCubic, + QQuickPathElement, + QQuickPathInterpolator, + QQuickPathLine, + QQuickPathMove, + QQuickPathMultiline, + QQuickPathPercent, + QQuickPathPolyline, + QQuickPathQuad, + QQuickPathSvg + >(uri, major); #endif - qmlRegisterType<QQuickFlickable, 9>(uri, 2, 9, "Flickable"); - qmlRegisterType<QQuickMouseArea, 9>(uri, 2, 9, "MouseArea"); - -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathArc, 9>(uri, 2, 9, "PathArc"); - qmlRegisterType<QQuickPathMove>(uri, 2, 9, "PathMove"); +#if QT_CONFIG(quick_pathview) + qmlRegisterTypesAndRevisions<QQuickPathView>(uri, major); #endif - qmlRegisterType<QQuickText, 9>(uri, 2, 9, "Text"); - qmlRegisterType<QQuickTextInput, 9>(uri, 2, 9, "TextInput"); - qmlRegisterType<QQuickTouchPoint>(uri, 2, 9, "TouchPoint"); - qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); - qmlRegisterUncreatableType<QPointingDeviceUniqueId>(uri, 2, 9, "PointingDeviceUniqueId", QQuickTouchPoint::tr("PointingDeviceUniqueId is only available via read-only properties")); -#if QT_CONFIG(quick_positioners) - qmlRegisterUncreatableType<QQuickBasePositioner, 9>(uri, 2, 9, "Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); +#if QT_CONFIG(quick_repeater) + qmlRegisterTypesAndRevisions<QQuickRepeater>(uri, major); #endif #if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource, 9>(uri, 2, 9, "ShaderEffectSource"); + qmlRegisterTypesAndRevisions< + QQuickBorderImageMesh, + QQuickGridMesh, + QQuickItemLayer, + QQuickShaderEffect, + QQuickShaderEffectMesh, + QQuickShaderEffectSource + >(uri, major); #endif - qmlRegisterType<QQuickFlickable, 10>(uri, 2, 10, "Flickable"); - qmlRegisterType<QQuickTextEdit, 10>(uri, 2, 10, "TextEdit"); - qmlRegisterType<QQuickText, 10>(uri, 2, 10, "Text"); - -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathAngleArc>(uri, 2, 11, "PathAngleArc"); +#if QT_CONFIG(quick_sprite) + qmlRegisterTypesAndRevisions< + QQuickAnimatedSprite, + QQuickSprite, + QQuickSpriteSequence + >(uri, major); #endif -#if QT_CONFIG(quick_animatedimage) - qmlRegisterType<QQuickAnimatedImage, 11>(uri, 2, 11,"AnimatedImage"); -#endif - qmlRegisterType<QQuickItem, 11>(uri, 2, 11,"Item"); - qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); - - // classes related to Input Handlers which are newly exposed since 5.12 - qmlRegisterUncreatableType<QQuickPointerEvent>(uri, 2, 12, "PointerEvent", - QQuickPointerHandler::tr("PointerEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickPointerMouseEvent>(uri, 2, 12, "PointerMouseEvent", - QQuickPointerHandler::tr("PointerMouseEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickPointerTouchEvent>(uri, 2, 12, "PointerTouchEvent", - QQuickPointerHandler::tr("PointerTouchEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickEventPoint>(uri, 2, 12, "EventPoint", - QQuickPointerHandler::tr("EventPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickEventTouchPoint>(uri, 2, 12, "EventTouchPoint", - QQuickPointerHandler::tr("EventTouchPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickPointerDevice>(uri, 2, 12, "PointerDevice", - QQuickPointerHandler::tr("PointerDevice is only available as a property of PointerEvent")); - - // Input Handlers are part of QtQuick, not a separate module, since 5.12 - qmlRegisterUncreatableType<QQuickPointerHandler>(uri, 2, 12, "PointerHandler", - QQuickPointerHandler::tr("PointerHandler is an abstract base class")); - qmlRegisterType<QQuickPointHandler>(uri, 2, 12, "PointHandler"); - qmlRegisterType<QQuickDragHandler>(uri, 2, 12, "DragHandler"); - qmlRegisterUncreatableType<QQuickDragAxis>(uri, 2, 12, "DragAxis", - QQuickDragHandler::tr("DragAxis is only available as a grouped property of DragHandler")); - qmlRegisterType<QQuickHoverHandler>(uri, 2, 12, "HoverHandler"); - qmlRegisterType<QQuickPinchHandler>(uri, 2, 12, "PinchHandler"); - qmlRegisterType<QQuickTapHandler>(uri, 2, 12, "TapHandler"); - qRegisterMetaType<QQuickHandlerPoint>(); - - // The rest of the 5.12 revisions - qmlRegisterType<QQuickAnimatedSprite, 12>("QtQuick", 2, 12, "AnimatedSprite"); - qmlRegisterType<QQuickGradient, 12>(uri, 2, 12, "Gradient"); - qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); - qmlRegisterType<QQuickText, 12>(uri, 2, 12, "Text"); #if QT_CONFIG(quick_tableview) - qmlRegisterType<QQuickTableView>(uri, 2, 12, "TableView"); + qmlRegisterTypesAndRevisions<QQuickTableView>(uri, major); #endif -#if QT_CONFIG(quick_itemview) - qmlRegisterUncreatableType<QQuickItemView, 13>(uri, 2, 13, itemViewName, itemViewMessage); -#endif -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView, 13>(uri, 2, 13, "PathView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 13>(uri, 2, 13, "GridView"); -#endif -#if QT_CONFIG(quick_tableview) - qmlRegisterType<QQuickTableView, 14>(uri, 2, 14, "TableView"); +#if QT_CONFIG(quick_viewtransitions) + qmlRegisterTypesAndRevisions<QQuickViewTransitionAttached>(uri, major); #endif + #if QT_CONFIG(wheelevent) - qmlRegisterType<QQuickWheelHandler>(uri, 2, 14, "WheelHandler"); + qmlRegisterTypesAndRevisions<QQuickWheelHandler>(uri, major); #endif - qmlRegisterUncreatableType<QQuickImageBase, 14>(uri, 2, 14, "ImageBase", - QQuickPointerHandler::tr("ImageBase is an abstract base class")); - qmlRegisterType<QQuickImage, 14>(uri, 2, 14, "Image"); - qmlRegisterType<QQuickDragHandler, 14>(uri, 2, 14, "DragHandler"); - - qmlRegisterUncreatableType<QQuickPointerHandler, 15>(uri, 2, 15, "PointerHandler", - QQuickPointerHandler::tr("PointerHandler is an abstract base class")); } static void initResources() @@ -512,12 +399,7 @@ QT_BEGIN_NAMESPACE void QQuickItemsModule::defineModule() { initResources(); - - QByteArray name = "QtQuick"; - int majorVersion = 2; - int minorVersion = 0; - - qt_quickitems_defineModule(name, majorVersion, minorVersion); + qt_quickitems_defineModule(); } QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule_p.h b/src/quick/items/qquickitemsmodule_p.h index cd79efe256..6ceb0d56e6 100644 --- a/src/quick/items/qquickitemsmodule_p.h +++ b/src/quick/items/qquickitemsmodule_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/qevent.h> #include <qqml.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,15 @@ public: static void defineModule(); }; +struct QPointingDeviceUniqueIdForeign +{ + Q_GADGET + QML_FOREIGN(QPointingDeviceUniqueId) + QML_NAMED_ELEMENT(PointingDeviceUniqueId) + QML_ADDED_IN_MINOR_VERSION(9) + QML_UNCREATABLE("PointingDeviceUniqueId is only available via read-only properties.") +}; + QT_END_NAMESPACE #endif // QQUICKITEMSMODULE_P_H diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 66e09f9ed1..6bc00411f0 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -110,6 +110,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickItemView : public QQuickFlickable Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd) Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) + QML_NAMED_ELEMENT(ItemView) + QML_UNCREATABLE("ItemView is an abstract base class.") + QML_ADDED_IN_MINOR_VERSION(1) + public: // this holds all layout enum values so they can be referred to by other enums // to ensure consistent values - e.g. QML references to GridView.TopToBottom flow diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index 0c7a9cad75..5f4e74171e 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -194,6 +194,10 @@ class QQuickViewTransitionAttached : public QObject Q_PROPERTY(QList<int> targetIndexes READ targetIndexes NOTIFY targetIndexesChanged) Q_PROPERTY(QQmlListProperty<QObject> targetItems READ targetItems NOTIFY targetItemsChanged) + QML_NAMED_ELEMENT(ViewTransition) + QML_UNCREATABLE("ViewTransition is only available via attached properties.") + QML_ATTACHED(QQuickViewTransitionAttached) + public: QQuickViewTransitionAttached(QObject *parent); @@ -227,6 +231,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickViewTransitionAttached) -QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKITEMVIEWTRANSITION_P_P_H diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index f2bab9e018..1c72a10190 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -70,6 +70,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickViewSection : public QObject Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged) Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int labelPositioning READ labelPositioning WRITE setLabelPositioning NOTIFY labelPositioningChanged) + QML_NAMED_ELEMENT(ViewSection) public: QQuickViewSection(QQuickListView *parent=nullptr); @@ -130,6 +131,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickListView : public QQuickItemView Q_PROPERTY(FooterPositioning footerPositioning READ footerPositioning WRITE setFooterPositioning NOTIFY footerPositioningChanged REVISION 4) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(ListView) + QML_ATTACHED(QQuickListViewAttached) public: QQuickListView(QQuickItem *parent=nullptr); @@ -216,7 +219,6 @@ public: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickListView, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickListView) QML_DECLARE_TYPE(QQuickViewSection) diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h index de1dfa9da5..2d560fb856 100644 --- a/src/quick/items/qquickloader_p.h +++ b/src/quick/items/qquickloader_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickLoader : public QQuickImplicitSizeItem Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) + QML_NAMED_ELEMENT(Loader) public: QQuickLoader(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h index 0e01fa7915..3d4d113215 100644 --- a/src/quick/items/qquickmousearea_p.h +++ b/src/quick/items/qquickmousearea_p.h @@ -85,6 +85,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem #endif Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION 4) Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION 9) + QML_NAMED_ELEMENT(MouseArea) public: QQuickMouseArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 634ea1c2e2..7506be10a1 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -83,6 +83,7 @@ class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject Q_PROPERTY(qreal previousY READ previousY NOTIFY previousYChanged) Q_PROPERTY(qreal sceneX READ sceneX NOTIFY sceneXChanged) Q_PROPERTY(qreal sceneY READ sceneY NOTIFY sceneYChanged) + QML_NAMED_ELEMENT(TouchPoint) public: QQuickTouchPoint(bool qmlDefined = true) @@ -187,6 +188,9 @@ class QQuickGrabGestureEvent : public QObject Q_OBJECT Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints CONSTANT) Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT) + QML_NAMED_ELEMENT(GestureEvent) + QML_UNCREATABLE("GestureEvent is only available in the context of handling the gestureStarted signal from MultiPointTouchArea.") + public: QQuickGrabGestureEvent() : _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} @@ -213,6 +217,7 @@ class Q_AUTOTEST_EXPORT QQuickMultiPointTouchArea : public QQuickItem Q_PROPERTY(int minimumTouchPoints READ minimumTouchPoints WRITE setMinimumTouchPoints NOTIFY minimumTouchPointsChanged) Q_PROPERTY(int maximumTouchPoints READ maximumTouchPoints WRITE setMaximumTouchPoints NOTIFY maximumTouchPointsChanged) Q_PROPERTY(bool mouseEnabled READ mouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) + QML_NAMED_ELEMENT(MultiPointTouchArea) public: QQuickMultiPointTouchArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickopenglinfo_p.h b/src/quick/items/qquickopenglinfo_p.h index 86683d5348..b733d205e3 100644 --- a/src/quick/items/qquickopenglinfo_p.h +++ b/src/quick/items/qquickopenglinfo_p.h @@ -70,6 +70,11 @@ class QQuickOpenGLInfo : public QObject Q_PROPERTY(ContextProfile profile READ profile NOTIFY profileChanged FINAL) Q_PROPERTY(RenderableType renderableType READ renderableType NOTIFY renderableTypeChanged FINAL) + QML_NAMED_ELEMENT(OpenGLInfo) + QML_UNCREATABLE("OpenGLInfo is only available via attached properties.") + QML_ADDED_IN_MINOR_VERSION(4) + QML_ATTACHED(QQuickOpenGLInfo) + public: QQuickOpenGLInfo(QQuickItem *item = 0); @@ -116,6 +121,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickOpenGLInfo, QML_HAS_ATTACHED_PROPERTIES) - #endif // QQUICKOPENGLINFO_P_H diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h index ddc1fd99d9..4821a409be 100644 --- a/src/quick/items/qquickpainteditem.h +++ b/src/quick/items/qquickpainteditem.h @@ -56,6 +56,9 @@ class Q_QUICK_EXPORT QQuickPaintedItem : public QQuickItem Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged) Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged) + QML_NAMED_ELEMENT(PaintedItem) + QML_UNCREATABLE("Cannot create instance of abstract class PaintedItem.") + public: explicit QQuickPaintedItem(QQuickItem *parent = nullptr); ~QQuickPaintedItem() override; diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h index 66be7fa6ff..c12358e4f6 100644 --- a/src/quick/items/qquickpathview_p.h +++ b/src/quick/items/qquickpathview_p.h @@ -100,6 +100,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathView : public QQuickItem Q_PROPERTY(MovementDirection movementDirection READ movementDirection WRITE setMovementDirection NOTIFY movementDirectionChanged REVISION 7) Q_PROPERTY(int cacheItemCount READ cacheItemCount WRITE setCacheItemCount NOTIFY cacheItemCountChanged) + QML_NAMED_ELEMENT(PathView) + QML_ATTACHED(QQuickPathViewAttached) public: QQuickPathView(QQuickItem *parent = nullptr); @@ -299,6 +301,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickPathView) -QML_DECLARE_TYPEINFO(QQuickPathView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKPATHVIEW_P_H diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h index cf21555823..d7f814cc8a 100644 --- a/src/quick/items/qquickpincharea_p.h +++ b/src/quick/items/qquickpincharea_p.h @@ -70,6 +70,7 @@ class Q_AUTOTEST_EXPORT QQuickPinch : public QObject Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged) Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged) Q_PROPERTY(bool active READ active NOTIFY activeChanged) + QML_NAMED_ELEMENT(Pinch) public: QQuickPinch(); @@ -210,6 +211,7 @@ class Q_AUTOTEST_EXPORT QQuickPinchEvent : public QObject Q_PROPERTY(QPointF startPoint2 READ startPoint2) Q_PROPERTY(int pointCount READ pointCount) Q_PROPERTY(bool accepted READ accepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickPinchEvent(QPointF c, qreal s, qreal a, qreal r) @@ -268,6 +270,7 @@ class Q_AUTOTEST_EXPORT QQuickPinchArea : public QQuickItem Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(QQuickPinch *pinch READ pinch CONSTANT) + QML_NAMED_ELEMENT(PinchArea) public: QQuickPinchArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index 94a737e1f1..b924cb9c12 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -112,6 +112,11 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBasePositioner : public QQuickImplicitSizeIte Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged REVISION 6) Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6) Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) + + QML_NAMED_ELEMENT(Positioner) + QML_UNCREATABLE("Positioner is an abstract type that is only available as an attached property.") + QML_ATTACHED(QQuickPositionerAttached) + public: enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; @@ -230,6 +235,7 @@ private: class Q_AUTOTEST_EXPORT QQuickColumn : public QQuickBasePositioner { Q_OBJECT + QML_NAMED_ELEMENT(Column) public: QQuickColumn(QQuickItem *parent=nullptr); @@ -246,6 +252,8 @@ class Q_AUTOTEST_EXPORT QQuickRow: public QQuickBasePositioner Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) + QML_NAMED_ELEMENT(Row) + public: QQuickRow(QQuickItem *parent=nullptr); @@ -279,6 +287,7 @@ class Q_AUTOTEST_EXPORT QQuickGrid : public QQuickBasePositioner Q_PROPERTY(HAlignment horizontalItemAlignment READ hItemAlign WRITE setHItemAlign NOTIFY horizontalAlignmentChanged REVISION 1) Q_PROPERTY(HAlignment effectiveHorizontalItemAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalItemAlignment READ vItemAlign WRITE setVItemAlign NOTIFY verticalAlignmentChanged REVISION 1) + QML_NAMED_ELEMENT(Grid) public: QQuickGrid(QQuickItem *parent=nullptr); @@ -359,6 +368,7 @@ class Q_AUTOTEST_EXPORT QQuickFlow: public QQuickBasePositioner Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) + QML_NAMED_ELEMENT(Flow) public: QQuickFlow(QQuickItem *parent=nullptr); @@ -395,6 +405,5 @@ QML_DECLARE_TYPE(QQuickGrid) QML_DECLARE_TYPE(QQuickFlow) QML_DECLARE_TYPE(QQuickBasePositioner) -QML_DECLARE_TYPEINFO(QQuickBasePositioner, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKPOSITIONERS_P_H diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h index d56a03d22d..934300b63b 100644 --- a/src/quick/items/qquickrectangle_p.h +++ b/src/quick/items/qquickrectangle_p.h @@ -66,6 +66,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPen : public QObject Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY penChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged) Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY penChanged) + QML_ANONYMOUS public: QQuickPen(QObject *parent=nullptr); @@ -96,6 +97,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradientStop : public QObject Q_PROPERTY(qreal position READ position WRITE setPosition) Q_PROPERTY(QColor color READ color WRITE setColor) + QML_NAMED_ELEMENT(GradientStop) public: QQuickGradientStop(QObject *parent=nullptr); @@ -121,6 +123,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradient : public QObject Q_PROPERTY(QQmlListProperty<QQuickGradientStop> stops READ stops) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged REVISION 12) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(Gradient) Q_ENUMS(QGradient::Preset) public: @@ -161,6 +164,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem Q_PROPERTY(QJSValue gradient READ gradient WRITE setGradient RESET resetGradient) Q_PROPERTY(QQuickPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) + QML_NAMED_ELEMENT(Rectangle) public: QQuickRectangle(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickrepeater_p.h b/src/quick/items/qquickrepeater_p.h index dbe3cd0c55..20984fa23e 100644 --- a/src/quick/items/qquickrepeater_p.h +++ b/src/quick/items/qquickrepeater_p.h @@ -70,6 +70,7 @@ class Q_AUTOTEST_EXPORT QQuickRepeater : public QQuickItem Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_CLASSINFO("DefaultProperty", "delegate") + QML_NAMED_ELEMENT(Repeater) public: QQuickRepeater(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickscalegrid_p_p.h b/src/quick/items/qquickscalegrid_p_p.h index f5187a8eea..56b0ee86ab 100644 --- a/src/quick/items/qquickscalegrid_p_p.h +++ b/src/quick/items/qquickscalegrid_p_p.h @@ -69,6 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickScaleGrid : public QObject Q_PROPERTY(int top READ top WRITE setTop NOTIFY topBorderChanged) Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightBorderChanged) Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomBorderChanged) + QML_ANONYMOUS public: QQuickScaleGrid(QObject *parent=nullptr); diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index 10e524e4a0..9d9f9a1567 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -86,6 +86,10 @@ class Q_AUTOTEST_EXPORT QQuickScreenInfo : public QObject Q_PROPERTY(int virtualX READ virtualX NOTIFY virtualXChanged REVISION 3) Q_PROPERTY(int virtualY READ virtualY NOTIFY virtualYChanged REVISION 3) + QML_NAMED_ELEMENT(ScreenInfo) + QML_ADDED_IN_MINOR_VERSION(3) + QML_UNCREATABLE("ScreenInfo can only be used via the attached property.") + public: QQuickScreenInfo(QObject *parent = nullptr, QScreen *wrappedScreen = nullptr); @@ -161,13 +165,16 @@ private: class Q_AUTOTEST_EXPORT QQuickScreen : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(Screen) + QML_UNCREATABLE("Screen can only be used via the attached property.") + QML_ATTACHED(QQuickScreenAttached) + public: static QQuickScreenAttached *qmlAttachedProperties(QObject *object){ return new QQuickScreenAttached(object); } }; QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickScreen, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickScreenInfo) #endif diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 6e2f35882b..c14907092c 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -75,6 +75,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffect : public QQuickItem Q_PROPERTY(QString log READ log NOTIFY logChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(bool supportsAtlasTextures READ supportsAtlasTextures WRITE setSupportsAtlasTextures NOTIFY supportsAtlasTexturesChanged REVISION 4) + QML_NAMED_ELEMENT(ShaderEffect) public: enum CullMode { diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index 79e05a5f9f..710d37c275 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -49,6 +49,7 @@ QT_REQUIRE_CONFIG(quick_shadereffect); #include <QtCore/qsize.h> #include <QtCore/qvector.h> #include <QtCore/qbytearray.h> +#include <QtQml/qqml.h> #ifndef QQUICKSHADEREFFECTMESH_P_H #define QQUICKSHADEREFFECTMESH_P_H @@ -75,6 +76,10 @@ class QRectF; class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMesh : public QObject { Q_OBJECT + + QML_NAMED_ELEMENT(ShaderEffectMesh) + QML_UNCREATABLE("Cannot create instance of abstract class ShaderEffectMesh.") + public: QQuickShaderEffectMesh(QObject *parent = nullptr); virtual bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) = 0; @@ -96,6 +101,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGridMesh : public QQuickShaderEffectMesh { Q_OBJECT Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged) + QML_NAMED_ELEMENT(GridMesh) public: QQuickGridMesh(QObject *parent = nullptr); bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override; @@ -123,6 +129,10 @@ class QQuickBorderImageMesh : public QQuickShaderEffectMesh Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged) Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) + + QML_NAMED_ELEMENT(BorderImageMesh) + QML_ADDED_IN_MINOR_VERSION(8) + public: QQuickBorderImageMesh(QObject *parent = nullptr); diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index d612d1179f..c0a1ccab78 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -89,6 +89,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectSource : public QQuickItem, publi Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged) Q_PROPERTY(TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged REVISION 6) Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged REVISION 9) + QML_NAMED_ELEMENT(ShaderEffectSource) public: enum WrapMode { diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index fab9e75190..98e5b82db8 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -86,6 +86,7 @@ class Q_QUICK_EXPORT QQuickSprite : public QQuickStochasticState Q_PROPERTY(qreal frameRateVariation READ frameRateVariation WRITE setFrameRateVariation NOTIFY frameRateVariationChanged) Q_PROPERTY(int frameDuration READ frameDuration WRITE setFrameDuration NOTIFY frameDurationChanged RESET resetFrameDuration) Q_PROPERTY(int frameDurationVariation READ frameDurationVariation WRITE setFrameDurationVariation NOTIFY frameDurationVariationChanged) + QML_NAMED_ELEMENT(Sprite) public: explicit QQuickSprite(QObject *parent = nullptr); diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h index 12c80d6a27..8361f7832a 100644 --- a/src/quick/items/qquickspritesequence_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickSpriteSequence : public QQuickItem //###try to share similar spriteEngines for less overhead? Q_PROPERTY(QQmlListProperty<QQuickSprite> sprites READ sprites) Q_CLASSINFO("DefaultProperty", "sprites") + QML_NAMED_ELEMENT(SpriteSequence) public: explicit QQuickSpriteSequence(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h index e947b2213f..c207a055cd 100644 --- a/src/quick/items/qquickstateoperations_p.h +++ b/src/quick/items/qquickstateoperations_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public Q_PROPERTY(QQmlScriptString height READ height WRITE setHeight) Q_PROPERTY(QQmlScriptString scale READ scale WRITE setScale) Q_PROPERTY(QQmlScriptString rotation READ rotation WRITE setRotation) + QML_NAMED_ELEMENT(ParentChange) public: QQuickParentChange(QObject *parent=nullptr); ~QQuickParentChange(); @@ -136,6 +137,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject Q_PROPERTY(QQmlScriptString bottom READ bottom WRITE setBottom RESET resetBottom) Q_PROPERTY(QQmlScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) Q_PROPERTY(QQmlScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline) + QML_ANONYMOUS public: QQuickAnchorSet(QObject *parent=nullptr); @@ -185,6 +187,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, publi Q_PROPERTY(QQuickItem *target READ object WRITE setObject) Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT) + QML_NAMED_ELEMENT(AnchorChanges) public: QQuickAnchorChanges(QObject *parent=nullptr); diff --git a/src/quick/items/qquicktableview_p.h b/src/quick/items/qquicktableview_p.h index 3b113efa4f..2208891f50 100644 --- a/src/quick/items/qquicktableview_p.h +++ b/src/quick/items/qquicktableview_p.h @@ -82,6 +82,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTableView : public QQuickFlickable Q_PROPERTY(QQuickTableView *syncView READ syncView WRITE setSyncView NOTIFY syncViewChanged REVISION 14) Q_PROPERTY(Qt::Orientations syncDirection READ syncDirection WRITE setSyncDirection NOTIFY syncDirectionChanged REVISION 14) + QML_NAMED_ELEMENT(TableView) + QML_ADDED_IN_MINOR_VERSION(12) + QML_ATTACHED(QQuickTableViewAttached) + public: QQuickTableView(QQuickItem *parent = nullptr); ~QQuickTableView() override; @@ -186,6 +190,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickTableView) -QML_DECLARE_TYPEINFO(QQuickTableView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKTABLEVIEW_P_H diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h index 45f387cb12..394ea25b83 100644 --- a/src/quick/items/qquicktext_p.h +++ b/src/quick/items/qquicktext_p.h @@ -100,6 +100,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem Q_PROPERTY(QJSValue fontInfo READ fontInfo NOTIFY fontInfoChanged REVISION 9) Q_PROPERTY(QSizeF advance READ advance NOTIFY contentSizeChanged REVISION 10) + QML_NAMED_ELEMENT(Text) public: QQuickText(QQuickItem *parent=nullptr); @@ -329,6 +330,7 @@ class QQuickTextLine : public QObject Q_PROPERTY(qreal height READ height WRITE setHeight) Q_PROPERTY(qreal x READ x WRITE setX) Q_PROPERTY(qreal y READ y WRITE setY) + QML_ANONYMOUS public: QQuickTextLine(); diff --git a/src/quick/items/qquicktextdocument.h b/src/quick/items/qquicktextdocument.h index affa0ab4d6..bf9162755c 100644 --- a/src/quick/items/qquicktextdocument.h +++ b/src/quick/items/qquicktextdocument.h @@ -49,6 +49,7 @@ class QQuickTextDocumentPrivate; class Q_QUICK_EXPORT QQuickTextDocument : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickTextDocument(QQuickItem *parent); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 2d1b6c7f9c..227d8cbf51 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -112,6 +112,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) Q_PROPERTY(QString preeditText READ preeditText NOTIFY preeditTextChanged REVISION 7) Q_PROPERTY(qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance NOTIFY tabStopDistanceChanged REVISION 10) + QML_NAMED_ELEMENT(TextEdit) public: QQuickTextEdit(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 92f3aa62ce..e95717cf8c 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -113,6 +113,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged REVISION 6) Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6) Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) + QML_NAMED_ELEMENT(TextInput) public: QQuickTextInput(QQuickItem * parent=nullptr); diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h index b6ea43342c..aeda6ca589 100644 --- a/src/quick/items/qquicktranslate_p.h +++ b/src/quick/items/qquicktranslate_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickTranslate : public QQuickTransform Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) + QML_NAMED_ELEMENT(Translate) public: QQuickTranslate(QObject *parent = nullptr); @@ -95,6 +96,7 @@ class Q_AUTOTEST_EXPORT QQuickScale : public QQuickTransform Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged) Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged) Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged) + QML_NAMED_ELEMENT(Scale) public: QQuickScale(QObject *parent = nullptr); ~QQuickScale(); @@ -132,6 +134,7 @@ class Q_AUTOTEST_EXPORT QQuickRotation : public QQuickTransform Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged) Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged) + QML_NAMED_ELEMENT(Rotation) public: QQuickRotation(QObject *parent = nullptr); ~QQuickRotation(); @@ -163,6 +166,8 @@ class Q_AUTOTEST_EXPORT QQuickMatrix4x4 : public QQuickTransform Q_OBJECT Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged) + QML_NAMED_ELEMENT(Matrix4x4) + QML_ADDED_IN_MINOR_VERSION(3) public: QQuickMatrix4x4(QObject *parent = nullptr); ~QQuickMatrix4x4(); diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 9dbff88f0d..db382de459 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -76,6 +76,9 @@ class Q_QUICK_EXPORT QQuickWindow : public QWindow Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT) Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION 1) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(Window) + QML_ADDED_IN_MINOR_VERSION(0) + QML_REMOVED_IN_MINOR_VERSION(1) Q_DECLARE_PRIVATE(QQuickWindow) public: enum CreateTextureOption { diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index 4b2b8f498d..0f952d194c 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -199,22 +199,13 @@ void QQuickWindowModule::defineModule() { const char uri[] = "QtQuick.Window"; - qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window"); + // Cannot automatically register these. They are from QtGui. qmlRegisterRevision<QWindow,1>(uri, 2, 1); qmlRegisterRevision<QWindow,2>(uri, 2, 2); - qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members - qmlRegisterRevision<QQuickWindow,2>(uri, 2, 2); - qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window"); - qmlRegisterType<QQuickWindowQmlImpl,2>(uri, 2, 2, "Window"); - qmlRegisterType<QQuickWindowQmlImpl,3>(uri, 2, 3, "Window"); - qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreen,3>(uri, 2, 3, "Screen", QStringLiteral("Screen can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreenInfo,3>(uri, 2, 3, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreenInfo,10>(uri, 2, 10, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property.")); qmlRegisterRevision<QWindow,13>(uri, 2, 13); - qmlRegisterRevision<QQuickWindow,13>(uri, 2, 13); - qmlRegisterType<QQuickWindowQmlImpl,13>(uri, 2, 13, "Window"); - qmlRegisterRevision<QQuickWindow,14>(uri, 2, 14); + + qmlRegisterTypesAndRevisions<QQuickWindow, QQuickWindowQmlImpl, + QQuickScreen, QQuickScreenInfo>(uri, 2); } QT_END_NAMESPACE diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h index 1dcf1a1021..1769e5aeb4 100644 --- a/src/quick/items/qquickwindowmodule_p.h +++ b/src/quick/items/qquickwindowmodule_p.h @@ -68,6 +68,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public Q Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) Q_PROPERTY(QObject *screen READ screen WRITE setScreen NOTIFY screenChanged REVISION 3) + QML_NAMED_ELEMENT(Window) + QML_ADDED_IN_MINOR_VERSION(1) + QML_ATTACHED(QQuickWindowAttached) public: QQuickWindowQmlImpl(QWindow *parent = nullptr); @@ -106,6 +109,5 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickWindowQmlImpl) -QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) #endif diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 7a04c2146c..527742ab8a 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -185,8 +185,6 @@ void QQmlQtQuick2Module::defineModule() QQuickUtilModule::defineModule(); QQuickItemsModule::defineModule(); - qmlRegisterUncreatableType<QQuickApplication>("QtQuick",2,0,"Application", QQuickApplication::tr("Application is an abstract class")); - QQuickValueTypes::registerValueTypes(); #if QT_CONFIG(accessibility) 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 += \ |