diff options
author | Fabian Kosmale <[email protected]> | 2021-06-13 20:11:22 +0200 |
---|---|---|
committer | Fabian Kosmale <[email protected]> | 2021-09-30 10:23:19 +0200 |
commit | a51dcbb4c77e89a924cbfa592411ed830387aeab (patch) | |
tree | f906b5d2f12d4b99c8551470bf775e2db852843e /src/quick/items/qquickdroparea_p.h | |
parent | 1a5a092d381fb7e7bc6447704ae9bf5be84c300f (diff) |
Make DragEvent a public type again
It is a documented type, and naming signal parameter types allows easier
composition of QML types:
// MyCustomDropArea.qml
Item {
id: root
signal dropped(event: DragEvent) // with named type
// signal dropped(event: QtObject) without we could only use QtObject
DropArea { onDropped: (ev) => root.dropped(ev) }
}
Pick-to: 6.2
Change-Id: I751fec7356b5f1bb58e61e4f8de72c9b8d9d5c60
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/quick/items/qquickdroparea_p.h')
-rw-r--r-- | src/quick/items/qquickdroparea_p.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index ece9f361e7..a3fd8a81fd 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -62,7 +62,7 @@ QT_REQUIRE_CONFIG(quick_draganddrop); QT_BEGIN_NAMESPACE class QQuickDropAreaPrivate; -class QQuickDropEvent : public QObject +class QQuickDragEvent : public QObject { Q_OBJECT Q_PROPERTY(qreal x READ x) @@ -82,10 +82,11 @@ 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 + QML_NAMED_ELEMENT(DragEvent) + QML_UNCREATABLE("DragEvent is only meant to be created by DropArea") QML_ADDED_IN_VERSION(2, 0) public: - QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {} + QQuickDragEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {} qreal x() const { return event->position().x(); } qreal y() const { return event->position().y(); } @@ -177,10 +178,10 @@ Q_SIGNALS: void keysChanged(); void sourceChanged(); - void entered(QQuickDropEvent *drag); + void entered(QQuickDragEvent *drag); void exited(); - void positionChanged(QQuickDropEvent *drag); - void dropped(QQuickDropEvent *drop); + void positionChanged(QQuickDragEvent *drag); + void dropped(QQuickDragEvent *drop); protected: void dragMoveEvent(QDragMoveEvent *event) override; @@ -195,7 +196,6 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickDropEvent) QML_DECLARE_TYPE(QQuickDropArea) #endif // QQUICKDROPAREA_P_H |