aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktranslate_p.h
diff options
context:
space:
mode:
authorOliver Eftevaag <[email protected]>2023-05-26 16:49:20 +0200
committerOliver Eftevaag <[email protected]>2023-06-08 12:21:28 +0200
commit351979e05ad2a861fc3e6f8d1de6197a751316a8 (patch)
tree5a3c81ff5d547cf0418eebf9f10e325f260d49d8 /src/quick/items/qquicktranslate_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 <[email protected]>
Diffstat (limited to 'src/quick/items/qquicktranslate_p.h')
-rw-r--r--src/quick/items/qquicktranslate_p.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h
index 3dc3310da1..f311eaa982 100644
--- a/src/quick/items/qquicktranslate_p.h
+++ b/src/quick/items/qquicktranslate_p.h
@@ -28,8 +28,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTranslate : public QQuickTransform
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
QML_NAMED_ELEMENT(Translate)
QML_ADDED_IN_VERSION(2, 0)
@@ -57,10 +57,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScale : public QQuickTransform
{
Q_OBJECT
- Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
- 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)
+ Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged FINAL)
+ Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged FINAL)
+ Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged FINAL)
+ Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged FINAL)
QML_NAMED_ELEMENT(Scale)
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -96,9 +96,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotation : public QQuickTransform
{
Q_OBJECT
- 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)
+ Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged FINAL)
+ Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged FINAL)
+ Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged FINAL)
QML_NAMED_ELEMENT(Rotation)
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -130,7 +130,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMatrix4x4 : public QQuickTransform
{
Q_OBJECT
- Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged)
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged FINAL)
QML_NAMED_ELEMENT(Matrix4x4)
QML_ADDED_IN_VERSION(2, 3)
public: