aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicklayouts
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2023-05-26 16:52:59 +0200
committerOliver Eftevaag <oliver.eftevaag@qt.io>2023-06-07 16:26:23 +0200
commitb949315427a7da1e91462fa4fce0ad35abaea2d4 (patch)
treeaa963d8f1ca6ac17fecf5c471ba3f2cf419a44f5 /src/quicklayouts
parentbec0b8a05d349a052504b9c11caa259a63012210 (diff)
Make properties in Qt Quick Layouts FINAL
Without setting the FINAL flag, properties can be shadowed by users. This can both cause confusion for non-experienced users, and it causes issues with qmlsc. [ChangeLog][Important Behavior Changes][Layouts] Properties for types in the Qt Quick Layouts module are now FINAL, meaning they can no longer be shadowed by declaring new properties with the same names in QML. A warning will be printed out to the console, when a FINAL property is being shadowed. We recommend that users rename those properties to avoid potential unexpected behavior changes. Pick-to: 6.6 Task-number: QTBUG-108739 Change-Id: If09b220775ff2a20a84bccd78d39f5114472e151 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quicklayouts')
-rw-r--r--src/quicklayouts/qquicklayout_p.h42
-rw-r--r--src/quicklayouts/qquicklinearlayout_p.h21
-rw-r--r--src/quicklayouts/qquickstacklayout_p.h10
3 files changed, 36 insertions, 37 deletions
diff --git a/src/quicklayouts/qquicklayout_p.h b/src/quicklayouts/qquicklayout_p.h
index 85fb0ae7c0..bced440e4c 100644
--- a/src/quicklayouts/qquicklayout_p.h
+++ b/src/quicklayouts/qquicklayout_p.h
@@ -159,27 +159,27 @@ protected:
class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickLayoutAttached : public QObject
{
Q_OBJECT
- Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
- Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
- Q_PROPERTY(qreal preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged)
- Q_PROPERTY(qreal preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged)
- Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
- Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
- Q_PROPERTY(bool fillHeight READ fillHeight WRITE setFillHeight NOTIFY fillHeightChanged)
- Q_PROPERTY(bool fillWidth READ fillWidth WRITE setFillWidth NOTIFY fillWidthChanged)
- Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged)
- Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged)
- Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan NOTIFY rowSpanChanged)
- Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan NOTIFY columnSpanChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
- Q_PROPERTY(int horizontalStretchFactor READ horizontalStretchFactor WRITE setHorizontalStretchFactor NOTIFY horizontalStretchFactorChanged)
- Q_PROPERTY(int verticalStretchFactor READ verticalStretchFactor WRITE setVerticalStretchFactor NOTIFY verticalStretchFactorChanged)
-
- Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
- Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin RESET resetLeftMargin NOTIFY leftMarginChanged)
- Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin RESET resetTopMargin NOTIFY topMarginChanged)
- Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin RESET resetRightMargin NOTIFY rightMarginChanged)
- Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin RESET resetBottomMargin NOTIFY bottomMarginChanged)
+ Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged FINAL)
+ Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged FINAL)
+ Q_PROPERTY(qreal preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged FINAL)
+ Q_PROPERTY(qreal preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged FINAL)
+ Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged FINAL)
+ Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged FINAL)
+ Q_PROPERTY(bool fillHeight READ fillHeight WRITE setFillHeight NOTIFY fillHeightChanged FINAL)
+ Q_PROPERTY(bool fillWidth READ fillWidth WRITE setFillWidth NOTIFY fillWidthChanged FINAL)
+ Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged FINAL)
+ Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged FINAL)
+ Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan NOTIFY rowSpanChanged FINAL)
+ Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan NOTIFY columnSpanChanged FINAL)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged FINAL)
+ Q_PROPERTY(int horizontalStretchFactor READ horizontalStretchFactor WRITE setHorizontalStretchFactor NOTIFY horizontalStretchFactorChanged FINAL)
+ Q_PROPERTY(int verticalStretchFactor READ verticalStretchFactor WRITE setVerticalStretchFactor NOTIFY verticalStretchFactorChanged FINAL)
+
+ Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged FINAL)
+ Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin RESET resetLeftMargin NOTIFY leftMarginChanged FINAL)
+ Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin RESET resetTopMargin NOTIFY topMarginChanged FINAL)
+ Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin RESET resetRightMargin NOTIFY rightMarginChanged FINAL)
+ Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin RESET resetBottomMargin NOTIFY bottomMarginChanged FINAL)
public:
QQuickLayoutAttached(QObject *object);
diff --git a/src/quicklayouts/qquicklinearlayout_p.h b/src/quicklayouts/qquicklinearlayout_p.h
index 461b7b1e66..7e7208a4db 100644
--- a/src/quicklayouts/qquicklinearlayout_p.h
+++ b/src/quicklayouts/qquicklinearlayout_p.h
@@ -33,7 +33,7 @@ class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickGridLayoutBase : public QQuickLayout
Q_OBJECT
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection
- NOTIFY layoutDirectionChanged REVISION(1, 1))
+ NOTIFY layoutDirectionChanged REVISION(1, 1) FINAL)
QML_ANONYMOUS
QML_ADDED_IN_VERSION(1, 1)
@@ -115,16 +115,15 @@ class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickGridLayout : public QQuickGridLayoutBa
{
Q_OBJECT
- Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
- Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
- Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
- Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
- Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
+ Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged FINAL)
+ Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged FINAL)
+ Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged FINAL)
+ Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged FINAL)
+ Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged FINAL)
Q_PROPERTY(bool uniformCellWidths READ uniformCellWidths WRITE setUniformCellWidths
- NOTIFY uniformCellWidthsChanged REVISION(6, 6))
+ NOTIFY uniformCellWidthsChanged REVISION(6, 6) FINAL)
Q_PROPERTY(bool uniformCellHeights READ uniformCellHeights WRITE setUniformCellHeights
- NOTIFY uniformCellHeightsChanged REVISION(6, 6))
-
+ NOTIFY uniformCellHeightsChanged REVISION(6, 6) FINAL)
QML_NAMED_ELEMENT(GridLayout)
QML_ADDED_IN_VERSION(1, 0)
public:
@@ -186,9 +185,9 @@ class QQuickLinearLayoutPrivate;
class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickLinearLayout : public QQuickGridLayoutBase
{
Q_OBJECT
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
+ Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged FINAL)
Q_PROPERTY(bool uniformCellSizes READ uniformCellSizes WRITE setUniformCellSizes
- NOTIFY uniformCellSizesChanged REVISION(6, 6))
+ NOTIFY uniformCellSizesChanged REVISION(6, 6) FINAL)
public:
explicit QQuickLinearLayout(Qt::Orientation orientation,
QQuickItem *parent = nullptr);
diff --git a/src/quicklayouts/qquickstacklayout_p.h b/src/quicklayouts/qquickstacklayout_p.h
index 96ed06656f..0ecc3326e4 100644
--- a/src/quicklayouts/qquickstacklayout_p.h
+++ b/src/quicklayouts/qquickstacklayout_p.h
@@ -26,8 +26,8 @@ class QQuickStackLayoutAttached;
class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickStackLayout : public QQuickLayout
{
Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
QML_NAMED_ELEMENT(StackLayout)
QML_ADDED_IN_VERSION(1, 3)
QML_ATTACHED(QQuickStackLayoutAttached)
@@ -102,9 +102,9 @@ private:
class Q_QUICKLAYOUTS_PRIVATE_EXPORT QQuickStackLayoutAttached : public QObject
{
Q_OBJECT
- Q_PROPERTY(int index READ index NOTIFY indexChanged)
- Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged)
- Q_PROPERTY(QQuickStackLayout *layout READ layout NOTIFY layoutChanged)
+ Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
+ Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
+ Q_PROPERTY(QQuickStackLayout *layout READ layout NOTIFY layoutChanged FINAL)
public:
QQuickStackLayoutAttached(QObject *object);