aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickdrag_p.h
diff options
context:
space:
mode:
authorWang Zichong <wangzichong@uniontech.com>2023-11-16 15:49:11 +0800
committerShawn Rutledge <shawn.rutledge@qt.io>2024-02-24 00:58:04 -0700
commit0290e0fd5285cd48809ade02ce2e67a423ba3152 (patch)
tree60e3b6a2d9d4b89941c1b257c0899223c34ff46a /src/quick/items/qquickdrag_p.h
parentdb5eefc33cec9197e46a8affbca540f45125f8c3 (diff)
Add imageSourceSize property to QQuickDrag
Currently we can only assign an image URL to QQuickDrag to represent the data during the drag and drop operation. We made it easier to load arbitrary images in ac78bf7074c4aa2414b4da38db5b574bec9e4b71 : it does not have to come from Item.grabToImage(). But the image size depended only on the image provider's default behavior. Now we give developers the ability to set a preferred image size when needed. The revision of this new property and its signal is omitted because of QTBUG-33179. [ChangeLog][Qt Quick][Drag] The attaching type Drag has a new imageSourceSize property, which can be used like Image.sourceSize to scale the drag image during loading. Fixes: QTBUG-122705 Task-number: QTBUG-120489 Task-number: QTBUG-33179 Change-Id: I92996b8f70b7ca1c9ab783d7ed9f21649d512ab9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickdrag_p.h')
-rw-r--r--src/quick/items/qquickdrag_p.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h
index 9504d49bd1..cc08a03ccc 100644
--- a/src/quick/items/qquickdrag_p.h
+++ b/src/quick/items/qquickdrag_p.h
@@ -221,6 +221,8 @@ class Q_QUICK_EXPORT QQuickDragAttached : public QObject
Q_PROPERTY(QObject *target READ target NOTIFY targetChanged FINAL)
Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot NOTIFY hotSpotChanged FINAL)
Q_PROPERTY(QUrl imageSource READ imageSource WRITE setImageSource NOTIFY imageSourceChanged FINAL)
+ // imageSourceSize is new in Qt 6.8; revision omitted because of QTBUG-33179
+ Q_PROPERTY(QSize imageSourceSize READ imageSourceSize WRITE setImageSourceSize NOTIFY imageSourceSizeChanged FINAL)
Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged FINAL)
Q_PROPERTY(QVariantMap mimeData READ mimeData WRITE setMimeData NOTIFY mimeDataChanged FINAL)
Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged FINAL)
@@ -249,6 +251,9 @@ public:
QUrl imageSource() const;
void setImageSource(const QUrl &url);
+ QSize imageSourceSize() const;
+ void setImageSourceSize(const QSize &size);
+
QStringList keys() const;
void setKeys(const QStringList &keys);
@@ -282,6 +287,7 @@ Q_SIGNALS:
void targetChanged();
void hotSpotChanged();
void imageSourceChanged();
+ void imageSourceSizeChanged(); // new in Qt 6.8
void keysChanged();
void mimeDataChanged();
void supportedActionsChanged();