aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickdroparea_p.h
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2023-05-26 16:49:20 +0200
committerOliver Eftevaag <oliver.eftevaag@qt.io>2023-06-08 12:21:28 +0200
commit351979e05ad2a861fc3e6f8d1de6197a751316a8 (patch)
tree5a3c81ff5d547cf0418eebf9f10e325f260d49d8 /src/quick/items/qquickdroparea_p.h
parentb80f0383ab99a92e0470800ea1b1382453a7e9aa (diff)
Make properties in Qt Quick FINAL to prevent shadowing
Without setting the FINAL flag, properties can be shadowed by users. In the following example: Image { property string source: "Shadowing QQuickImage::source" } The source property of QQuickImage, will be shadowed by a new property with the same name. This can both cause confusion for non-experienced users, and it causes issues with qmlsc. Shadowing a property is usually unwanted. But there are some situations where it might be intended. The QML Object Attributes doc page demonstrates that you can override the color property in QQuickRectangle, for instance. [ChangeLog][Important Behavior Changes][QtQuick] Most properties for types in the QtQuick module are now FINAL, meaning that they can no longer be shadowed by declaring new properties with the same names. With few exceptions. A warning will be printed out to the console, when a FINAL property is shadowed. We recommend that users rename those properties to avoid potential unexpected behavior changes. Task-number: QTBUG-108739 Pick-to: 6.6 Change-Id: I1070926606f4d88ef7edf088ff80fb3ec82305c8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickdroparea_p.h')
-rw-r--r--src/quick/items/qquickdroparea_p.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index 35d295f5aa..89441c9eb2 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -29,23 +29,23 @@ class QQuickDropAreaPrivate;
class QQuickDragEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x)
- Q_PROPERTY(qreal y READ y)
- Q_PROPERTY(QObject *source READ source)
- Q_PROPERTY(QStringList keys READ keys)
- Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions)
- Q_PROPERTY(Qt::DropActions proposedAction READ proposedAction)
- Q_PROPERTY(Qt::DropAction action READ action WRITE setAction RESET resetAction)
- Q_PROPERTY(bool accepted READ accepted WRITE setAccepted)
- Q_PROPERTY(bool hasColor READ hasColor)
- Q_PROPERTY(bool hasHtml READ hasHtml)
- Q_PROPERTY(bool hasText READ hasText)
- Q_PROPERTY(bool hasUrls READ hasUrls)
- Q_PROPERTY(QVariant colorData READ colorData)
- Q_PROPERTY(QString html READ html)
- Q_PROPERTY(QString text READ text)
- Q_PROPERTY(QList<QUrl> urls READ urls)
- Q_PROPERTY(QStringList formats READ formats)
+ Q_PROPERTY(qreal x READ x FINAL)
+ Q_PROPERTY(qreal y READ y FINAL)
+ Q_PROPERTY(QObject *source READ source FINAL)
+ Q_PROPERTY(QStringList keys READ keys FINAL)
+ Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions FINAL)
+ Q_PROPERTY(Qt::DropActions proposedAction READ proposedAction FINAL)
+ Q_PROPERTY(Qt::DropAction action READ action WRITE setAction RESET resetAction FINAL)
+ Q_PROPERTY(bool accepted READ accepted WRITE setAccepted FINAL)
+ Q_PROPERTY(bool hasColor READ hasColor FINAL)
+ Q_PROPERTY(bool hasHtml READ hasHtml FINAL)
+ Q_PROPERTY(bool hasText READ hasText FINAL)
+ Q_PROPERTY(bool hasUrls READ hasUrls FINAL)
+ Q_PROPERTY(QVariant colorData READ colorData FINAL)
+ Q_PROPERTY(QString html READ html FINAL)
+ Q_PROPERTY(QString text READ text FINAL)
+ Q_PROPERTY(QList<QUrl> urls READ urls FINAL)
+ Q_PROPERTY(QStringList formats READ formats FINAL)
QML_NAMED_ELEMENT(DragEvent)
QML_UNCREATABLE("DragEvent is only meant to be created by DropArea")
QML_ADDED_IN_VERSION(2, 0)
@@ -92,9 +92,9 @@ private:
class QQuickDropAreaDrag : public QObject
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x NOTIFY positionChanged)
- Q_PROPERTY(qreal y READ y NOTIFY positionChanged)
- Q_PROPERTY(QObject *source READ source NOTIFY sourceChanged)
+ Q_PROPERTY(qreal x READ x NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal y READ y NOTIFY positionChanged FINAL)
+ Q_PROPERTY(QObject *source READ source NOTIFY sourceChanged FINAL)
QML_ANONYMOUS
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -120,9 +120,9 @@ class QQuickDropAreaPrivate;
class Q_QUICK_PRIVATE_EXPORT QQuickDropArea : public QQuickItem
{
Q_OBJECT
- 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)
+ Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged FINAL)
+ Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged FINAL)
+ Q_PROPERTY(QQuickDropAreaDrag *drag READ drag CONSTANT FINAL)
QML_NAMED_ELEMENT(DropArea)
QML_ADDED_IN_VERSION(2, 0)