QObject::dumpObject*: add const overloads
They don't modify "this", so they should be const. Mark the existing non-const overloads for removal in Qt 6. [ChangeLog][QtCore][QObject] QObject::dumpObjectInfo and QObject::dumpObjectTree now have const overloads. Change-Id: If9fb15692d2d1536930f86d043d688236d4b778a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
770f090a6c
commit
e02adc3e68
@ -3941,7 +3941,7 @@ QList<QByteArray> QObject::dynamicPropertyNames() const
|
|||||||
QObject debugging output routines.
|
QObject debugging output routines.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
static void dumpRecursive(int level, QObject *object)
|
static void dumpRecursive(int level, const QObject *object)
|
||||||
{
|
{
|
||||||
if (object) {
|
if (object) {
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
@ -3974,17 +3974,36 @@ static void dumpRecursive(int level, QObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\overload
|
||||||
|
\obsolete
|
||||||
|
|
||||||
Dumps a tree of children to the debug output.
|
Dumps a tree of children to the debug output.
|
||||||
|
|
||||||
\sa dumpObjectInfo()
|
\sa dumpObjectInfo()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void QObject::dumpObjectTree()
|
void QObject::dumpObjectTree()
|
||||||
|
{
|
||||||
|
const_cast<const QObject *>(this)->dumpObjectTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Dumps a tree of children to the debug output.
|
||||||
|
|
||||||
|
\note before Qt 5.9, this function was not const.
|
||||||
|
|
||||||
|
\sa dumpObjectInfo()
|
||||||
|
*/
|
||||||
|
|
||||||
|
void QObject::dumpObjectTree() const
|
||||||
{
|
{
|
||||||
dumpRecursive(0, this);
|
dumpRecursive(0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\overload
|
||||||
|
\obsolete
|
||||||
|
|
||||||
Dumps information about signal connections, etc. for this object
|
Dumps information about signal connections, etc. for this object
|
||||||
to the debug output.
|
to the debug output.
|
||||||
|
|
||||||
@ -3992,11 +4011,25 @@ void QObject::dumpObjectTree()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void QObject::dumpObjectInfo()
|
void QObject::dumpObjectInfo()
|
||||||
|
{
|
||||||
|
const_cast<const QObject *>(this)->dumpObjectInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Dumps information about signal connections, etc. for this object
|
||||||
|
to the debug output.
|
||||||
|
|
||||||
|
\note before Qt 5.9, this function was not const.
|
||||||
|
|
||||||
|
\sa dumpObjectTree()
|
||||||
|
*/
|
||||||
|
|
||||||
|
void QObject::dumpObjectInfo() const
|
||||||
{
|
{
|
||||||
qDebug("OBJECT %s::%s", metaObject()->className(),
|
qDebug("OBJECT %s::%s", metaObject()->className(),
|
||||||
objectName().isEmpty() ? "unnamed" : objectName().toLocal8Bit().data());
|
objectName().isEmpty() ? "unnamed" : objectName().toLocal8Bit().data());
|
||||||
|
|
||||||
Q_D(QObject);
|
Q_D(const QObject);
|
||||||
QMutexLocker locker(signalSlotLock(this));
|
QMutexLocker locker(signalSlotLock(this));
|
||||||
|
|
||||||
// first, look for connections where this object is the sender
|
// first, look for connections where this object is the sender
|
||||||
|
@ -375,8 +375,12 @@ public:
|
|||||||
#endif //Q_QDOC
|
#endif //Q_QDOC
|
||||||
|
|
||||||
|
|
||||||
void dumpObjectTree();
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
void dumpObjectInfo();
|
void dumpObjectTree(); // ### Qt 6: remove
|
||||||
|
void dumpObjectInfo(); // ### Qt 6: remove
|
||||||
|
#endif
|
||||||
|
void dumpObjectTree() const;
|
||||||
|
void dumpObjectInfo() const;
|
||||||
|
|
||||||
#ifndef QT_NO_PROPERTIES
|
#ifndef QT_NO_PROPERTIES
|
||||||
bool setProperty(const char *name, const QVariant &value);
|
bool setProperty(const char *name, const QVariant &value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user