Dump all properties of a QObject derived object
问题 How to dump all properties of a Qt object? For debugging purpose, e.g. when analyzing objects returned by a factory. 回答1: Properties of objects derived from QObject are registered via Qt's meta object system. Thus, it can be used to introspect them, i.e. list all properties and their content, e.g.: #include <QDebug> #include <QMetaProperty> #include <vector> #include <utility> #include <algorithm> static void dump_props(QObject *o) { auto mo = o->metaObject(); qDebug() << "## Properties of" <