QProperty: improve QPropertyAlias deprecation

Use QT_DEPRECATED_VERSION_X_6_6 and provide reasons for deprecation
for the enum value and for the QPropertyObserver constructor.

Change-Id: I0f9b4c6dc8bb9fd5eac692a6953c90059f3c77ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit aaa8c3835303e6eb3579df300e06ea6696ca769f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2023-07-18 13:16:54 +02:00 committed by Qt Cherry-pick Bot
parent 392131feb4
commit 7050aec00b
3 changed files with 13 additions and 4 deletions

View File

@ -678,8 +678,10 @@ QPropertyObserver::QPropertyObserver(ChangeHandler changeHandler)
#if QT_DEPRECATED_SINCE(6, 6)
QPropertyObserver::QPropertyObserver(QUntypedPropertyData *data)
{
QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
aliasData = data;
next.setTag(ObserverIsAlias);
QT_WARNING_POP
}
#endif

View File

@ -229,7 +229,7 @@ public:
ObserverNotifiesChangeHandler, // observer is a change handler, which runs on every change
ObserverIsPlaceholder, // the observer before this one is currently evaluated in QPropertyObserver::notifyObservers.
#if QT_DEPRECATED_SINCE(6, 6)
ObserverIsAlias
ObserverIsAlias QT_DEPRECATED_VERSION_X_6_6("Use QProperty and add a binding to the target.")
#endif
};
protected:
@ -271,7 +271,8 @@ public:
protected:
QPropertyObserver(ChangeHandler changeHandler);
#if QT_DEPRECATED_SINCE(6, 6)
QT_DEPRECATED QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr);
QT_DEPRECATED_VERSION_X_6_6("This constructor was only meant for internal use. Use QProperty and add a binding to the target.")
QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr);
#endif
QUntypedPropertyData *aliasedProperty() const
@ -889,7 +890,7 @@ public:
#if QT_DEPRECATED_SINCE(6, 6)
template<typename T>
class QT_DEPRECATED_X("Class was only meant for internal use, use a QProperty and add a binding to the target")
class QT_DEPRECATED_VERSION_X_6_6("Class was only meant for internal use, use a QProperty and add a binding to the target")
QPropertyAlias : public QPropertyObserver
{
Q_DISABLE_COPY_MOVE(QPropertyAlias)
@ -1014,7 +1015,7 @@ public:
}
QT_WARNING_POP
};
#endif
#endif // QT_DEPRECATED_SINCE(6, 6)
template<typename Class, typename T, auto Offset, auto Signal = nullptr>
class QObjectBindableProperty : public QPropertyData<T>

View File

@ -126,15 +126,19 @@ struct QPropertyObserverPointer
{
unlink_common();
#if QT_DEPRECATED_SINCE(6, 6)
QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
if (ptr->next.tag() == QPropertyObserver::ObserverIsAlias)
ptr->aliasData = nullptr;
QT_WARNING_POP
#endif
}
void unlink_fast()
{
#if QT_DEPRECATED_SINCE(6, 6)
QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
Q_ASSERT(ptr->next.tag() != QPropertyObserver::ObserverIsAlias);
QT_WARNING_POP
#endif
unlink_common();
}
@ -884,8 +888,10 @@ inline void QPropertyObserverPointer::notify(QUntypedPropertyData *propertyDataP
// recursion is already properly handled somewhere else
break;
#if QT_DEPRECATED_SINCE(6, 6)
QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
case QPropertyObserver::ObserverIsAlias:
break;
QT_WARNING_POP
#endif
default: Q_UNREACHABLE();
}