summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-07-04 17:18:22 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-25 14:57:08 +0200
commit0e8279b7bcad4c639562bb034a20866d9b2e8192 (patch)
treecbe4ce14eac1518aac2a9103ed57885432392ce4 /tests/auto
parent06e8682cb7c29d15a2c49fbc442a1a4509876abb (diff)
QObject: add a macro for conveniently setting the object name
This is a simplified port of KDTools' KDAB_SET_OBJECT_NAME. It simply assigns the variable name as the objectName of a QObject, uic-style. It uses a small helper function so that it works on references as well as pointer variables. QLabel label; QLabel *pLabel = new QLabel(); Q_SET_OBJECT_NAME(label); Q_SET_OBJECT_NAME(pLabel); Change-Id: I25fec0c90f33249a3ea5d2dd622ab708019fd101 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 479cdd3ca8..9adc191135 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -563,14 +563,14 @@ void tst_QObject::findChildren()
QTimer t121(&o12);
QTimer emptyname(&o);
- o.setObjectName("o");
- o1.setObjectName("o1");
- o2.setObjectName("o2");
- o11.setObjectName("o11");
- o12.setObjectName("o12");
- o111.setObjectName("o111");
- t1.setObjectName("t1");
- t121.setObjectName("t121");
+ Q_SET_OBJECT_NAME(o);
+ Q_SET_OBJECT_NAME(o1);
+ Q_SET_OBJECT_NAME(o2);
+ Q_SET_OBJECT_NAME(o11);
+ Q_SET_OBJECT_NAME(o12);
+ Q_SET_OBJECT_NAME(o111);
+ Q_SET_OBJECT_NAME(t1);
+ Q_SET_OBJECT_NAME(t121);
emptyname.setObjectName("");
QObject *op = 0;