From 9b17557f3bbd5135651bcedf9f10e61d7e078ae2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 2 Dec 2011 14:28:00 +1000 Subject: [PATCH] Revert "Add QObject::objectNameChanged(const QString &objectName) signal" This reverts commit ba635d7e74472f3a54c0c4686966af46d9035c6f. Breaks tests in declarative: tst_qdeclarativeecmascript::deleteLater tst_qquickvisualdatamodel::objectListModel Change-Id: I467b45109332e66fc62f3de00f376b1b88ab19ca Reviewed-by: Alan Alpert --- src/corelib/kernel/qobject.cpp | 17 ++++---------- src/corelib/kernel/qobject.h | 3 +-- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 2 ++ tests/auto/tools/moc/tst_moc.cpp | 28 +++++++++++------------ 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index bdf833b..b1d2463 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1096,20 +1096,13 @@ QString QObject::objectName() const void QObject::setObjectName(const QString &name) { Q_D(QObject); - if (d->objectName != name) { - d->objectName = name; - if (d->declarativeData) - d->declarativeData->objectNameChanged(d->declarativeData, this); - emit objectNameChanged(d->objectName); - } -} - -/*! \fn void QObject::objectNameChanged(const QString &objectName) + bool objectNameChanged = d->declarativeData && d->objectName != name; - This signal is emitted after the object's name has been changed. The new object name is passed as \a objectName. + d->objectName = name; - \sa QObject::objectName -*/ + if (objectNameChanged) + d->declarativeData->objectNameChanged(d->declarativeData, this); +} /*! \fn bool QObject::isWidgetType() const diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 1865656..307518d 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -115,7 +115,7 @@ public: class Q_CORE_EXPORT QObject { Q_OBJECT - Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged) + Q_PROPERTY(QString objectName READ objectName WRITE setObjectName) Q_DECLARE_PRIVATE(QObject) public: @@ -313,7 +313,6 @@ public: Q_SIGNALS: void destroyed(QObject * = 0); - void objectNameChanged(const QString &objectName); public: inline QObject *parent() const { return d_ptr->parent; } diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 1ba4e29..b20b98d 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -3487,6 +3487,7 @@ void tst_QObject::isSignalConnected() QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); #endif QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69())); @@ -3541,6 +3542,7 @@ void tst_QObject::isSignalConnected() QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig55()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); #endif emit o.sig00(); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 95d7d2c..6d3ee26 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1091,15 +1091,15 @@ void tst_Moc::invokable() { { const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject; - QCOMPARE(mobj.methodCount(), 6); - QVERIFY(mobj.method(5).signature() == QByteArray("foo()")); + QCOMPARE(mobj.methodCount(), 5); + QVERIFY(mobj.method(4).signature() == QByteArray("foo()")); } { const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 7); - QVERIFY(mobj.method(5).signature() == QByteArray("foo()")); - QVERIFY(mobj.method(6).signature() == QByteArray("bar()")); + QCOMPARE(mobj.methodCount(), 6); + QVERIFY(mobj.method(4).signature() == QByteArray("foo()")); + QVERIFY(mobj.method(5).signature() == QByteArray("bar()")); } } @@ -1107,23 +1107,23 @@ void tst_Moc::singleFunctionKeywordSignalAndSlot() { { const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject; - QCOMPARE(mobj.methodCount(), 7); - QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()")); - QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()")); + QCOMPARE(mobj.methodCount(), 6); + QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()")); + QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()")); } { const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 7); - QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()")); - QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()")); + QCOMPARE(mobj.methodCount(), 6); + QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()")); + QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()")); } { const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject; - QCOMPARE(mobj.methodCount(), 7); - QVERIFY(mobj.method(5).signature() == QByteArray("mySignal()")); - QVERIFY(mobj.method(6).signature() == QByteArray("mySlot()")); + QCOMPARE(mobj.methodCount(), 6); + QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()")); + QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()")); } } -- 2.7.4