summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-11-28 13:05:33 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-01 17:46:57 +0100
commitba635d7e74472f3a54c0c4686966af46d9035c6f (patch)
tree70fb0b7e41cc1d0a9a5f3959eaf0cc771e9e74ca /src/corelib/kernel/qobject.cpp
parentc7f80420649d8d37e25514bcd2859de1e21166d6 (diff)
Add QObject::objectNameChanged(const QString &objectName) signal
This is sent when the object's name changes. tst_moc must be updated since the method count of QObject has changed. The test assumed that there were 4 invokable methods in QObject. The new signal is the 5th, which breaks the test's assumptions. Fix this as well. tst_QObject must be updated since the QObjectPrivate::isSignalConnected() method only supports the first 64 signals. With the addition of this new signal, sig61() in the test becomes the 65th signal, and will always appear connected now. Task-number: QTBUG-13999 (related) Change-Id: Ie87893c71a231fafa7ccf2f16102238a7be8327a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index b1d2463737..bdf833bc48 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1096,13 +1096,20 @@ QString QObject::objectName() const
void QObject::setObjectName(const QString &name)
{
Q_D(QObject);
- bool objectNameChanged = d->declarativeData && d->objectName != name;
+ if (d->objectName != name) {
+ d->objectName = name;
+ if (d->declarativeData)
+ d->declarativeData->objectNameChanged(d->declarativeData, this);
+ emit objectNameChanged(d->objectName);
+ }
+}
- d->objectName = name;
+/*! \fn void QObject::objectNameChanged(const QString &objectName)
- if (objectNameChanged)
- d->declarativeData->objectNameChanged(d->declarativeData, this);
-}
+ This signal is emitted after the object's name has been changed. The new object name is passed as \a objectName.
+
+ \sa QObject::objectName
+*/
/*!
\fn bool QObject::isWidgetType() const