aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmousearea_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/qquickmousearea_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/qquickmousearea_p.h')
-rw-r--r--src/quick/items/qquickmousearea_p.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 9ce57bcf60..a4439ad885 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -30,25 +30,25 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged)
- Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged)
- Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
- Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged REVISION(2, 5))
- Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged)
- Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
- Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged FINAL)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged FINAL)
+ Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
+ Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged REVISION(2, 5) FINAL)
+ Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged FINAL)
+ Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged FINAL)
+ Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged FINAL)
#if QT_CONFIG(quick_draganddrop)
- Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT) //### add flicking to QQuickDrag or add a QQuickFlick ???
+ Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT FINAL) //### add flicking to QQuickDrag or add a QQuickFlick ???
#endif
- Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
- Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged)
+ Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged FINAL)
+ Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged FINAL)
#if QT_CONFIG(cursor)
- Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET unsetCursor NOTIFY cursorShapeChanged)
+ Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET unsetCursor NOTIFY cursorShapeChanged FINAL)
#endif
- Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION(2, 4))
- Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION(2, 9))
+ Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION(2, 4) FINAL)
+ Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION(2, 9) FINAL)
QML_NAMED_ELEMENT(MouseArea)
QML_ADDED_IN_VERSION(2, 0)