QObject: add a macro for conveniently setting the object name
authorMarc Mutz <marc.mutz@kdab.com>
Wed, 4 Jul 2012 15:18:22 +0000 (17:18 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 25 Jul 2012 12:57:08 +0000 (14:57 +0200)
commit0e8279b7bcad4c639562bb034a20866d9b2e8192
treecbe4ce14eac1518aac2a9103ed57885432392ce4
parent06e8682cb7c29d15a2c49fbc442a1a4509876abb
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>
src/corelib/kernel/qobject.cpp
src/corelib/kernel/qobject.h
tests/auto/corelib/kernel/qobject/tst_qobject.cpp