diff options
author | Lauri Laanmets <lauri.laanmets@eesti.ee> | 2021-09-30 19:09:16 +0300 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-11-09 10:28:35 +0100 |
commit | 92392b471cbcfcf386cd0ba7c99fc4a9297f018a (patch) | |
tree | 4104a06c5b2ad48a4085ecb3f046cddd31f00315 /src/location/declarativemaps | |
parent | e7af7ba73dfce236ff2627aacd6d261b25b125f4 (diff) | |
download | qtlocation-92392b471cbcfcf386cd0ba7c99fc4a9297f018a.tar.gz |
Remove QAbstractDeclarativeData::parentChanged
This method was removed from qtbase in
e8b7e4e96a23b87011abeb1e4f5f694654866e3f.
This commit removes the usage of this method from qtlocation
and attempts to achieve the same behavior by introducing a
custom setParentAndNotify() method which emits the
parentChanged() signal.
The code is also updated to make use of the new method.
This is part of a bigger work to port QtLocation maps to Qt6.
Task-number: QTBUG-96795
Change-Id: I4523cf567b4510fc17473a37c689c689ee53130e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/location/declarativemaps')
-rw-r--r-- | src/location/declarativemaps/qparameterizableobject.cpp | 13 | ||||
-rw-r--r-- | src/location/declarativemaps/qparameterizableobject_p.h | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/location/declarativemaps/qparameterizableobject.cpp b/src/location/declarativemaps/qparameterizableobject.cpp index 25c535e0..b1e588e6 100644 --- a/src/location/declarativemaps/qparameterizableobject.cpp +++ b/src/location/declarativemaps/qparameterizableobject.cpp @@ -94,11 +94,9 @@ public: static bool initialized = false; if (!initialized) { initialized = true; - QAbstractDeclarativeData::parentChanged = parentChanged; } } - static void parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p); }; Q_GLOBAL_STATIC(QParameterizableObjectData, parametrizableObjectData) @@ -109,13 +107,12 @@ QParameterizableObject::QParameterizableObject(QObject *parent) QObjectPrivate::get(this)->declarativeData = parametrizableObjectData; } -void QParameterizableObjectData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p) +void QParameterizableObject::setParentAndNotify(QObject *parent) { - Q_UNUSED(p); - Q_UNUSED(d); - QParameterizableObject *po = qobject_cast<QParameterizableObject *>(o); - if (po) - po->parentChanged(); + QObject *oldParent = this->parent(); + QObject::setParent(parent); + if (parent != oldParent) + emit parentChanged(); } QT_END_NAMESPACE diff --git a/src/location/declarativemaps/qparameterizableobject_p.h b/src/location/declarativemaps/qparameterizableobject_p.h index cf393aee..21a096e0 100644 --- a/src/location/declarativemaps/qparameterizableobject_p.h +++ b/src/location/declarativemaps/qparameterizableobject_p.h @@ -77,6 +77,8 @@ public: return res; } + void setParentAndNotify(QObject *parent); + Q_SIGNALS: void parentChanged(); |