Extract Method QObjectPrivate::ensureExtraData()
... to centralize the creation of QObjectPrivate::extraData. Change-Id: I04e97779ceb0168fa7660e77e0dab2ed3e1ad03e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
de699decb4
commit
6313a1adf5
@ -1272,8 +1272,7 @@ void QObject::setObjectName(const QString &name)
|
|||||||
{
|
{
|
||||||
Q_D(QObject);
|
Q_D(QObject);
|
||||||
|
|
||||||
if (!d->extraData)
|
d->ensureExtraData();
|
||||||
d->extraData = new QObjectPrivate::ExtraData(d);
|
|
||||||
|
|
||||||
d->extraData->objectName.removeBindingUnlessInWrapper();
|
d->extraData->objectName.removeBindingUnlessInWrapper();
|
||||||
|
|
||||||
@ -1287,8 +1286,7 @@ QBindable<QString> QObject::bindableObjectName()
|
|||||||
{
|
{
|
||||||
Q_D(QObject);
|
Q_D(QObject);
|
||||||
|
|
||||||
if (!d->extraData)
|
d->ensureExtraData();
|
||||||
d->extraData = new QObjectPrivate::ExtraData(d);
|
|
||||||
|
|
||||||
return QBindable<QString>(&d->extraData->objectName);
|
return QBindable<QString>(&d->extraData->objectName);
|
||||||
}
|
}
|
||||||
@ -1817,8 +1815,7 @@ int QObject::startTimer(int interval, Qt::TimerType timerType)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int timerId = thisThreadData->eventDispatcher.loadRelaxed()->registerTimer(interval, timerType, this);
|
int timerId = thisThreadData->eventDispatcher.loadRelaxed()->registerTimer(interval, timerType, this);
|
||||||
if (!d->extraData)
|
d->ensureExtraData();
|
||||||
d->extraData = new QObjectPrivate::ExtraData(d);
|
|
||||||
d->extraData->runningTimers.append(timerId);
|
d->extraData->runningTimers.append(timerId);
|
||||||
return timerId;
|
return timerId;
|
||||||
}
|
}
|
||||||
@ -2278,8 +2275,7 @@ void QObject::installEventFilter(QObject *obj)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->extraData)
|
d->ensureExtraData();
|
||||||
d->extraData = new QObjectPrivate::ExtraData(d);
|
|
||||||
|
|
||||||
// clean up unused items in the list
|
// clean up unused items in the list
|
||||||
d->extraData->eventFilters.removeAll((QObject *)nullptr);
|
d->extraData->eventFilters.removeAll((QObject *)nullptr);
|
||||||
@ -4101,8 +4097,7 @@ bool QObject::setProperty(const char *name, const QVariant &value)
|
|||||||
|
|
||||||
int id = meta->indexOfProperty(name);
|
int id = meta->indexOfProperty(name);
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
if (!d->extraData)
|
d->ensureExtraData();
|
||||||
d->extraData = new QObjectPrivate::ExtraData(d);
|
|
||||||
|
|
||||||
const int idx = d->extraData->propertyNames.indexOf(name);
|
const int idx = d->extraData->propertyNames.indexOf(name);
|
||||||
|
|
||||||
|
@ -125,6 +125,12 @@ public:
|
|||||||
QObjectPrivate *parent;
|
QObjectPrivate *parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ensureExtraData()
|
||||||
|
{
|
||||||
|
if (!extraData)
|
||||||
|
extraData = new ExtraData(this);
|
||||||
|
}
|
||||||
|
|
||||||
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
|
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
|
||||||
struct Connection;
|
struct Connection;
|
||||||
struct SignalVector;
|
struct SignalVector;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user