Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created August 18, 2017 16:15
Show Gist options
  • Save peteristhegreat/f45ca8e562c2ba5e3ad6388d8d784682 to your computer and use it in GitHub Desktop.
Save peteristhegreat/f45ca8e562c2ba5e3ad6388d8d784682 to your computer and use it in GitHub Desktop.
QObject dumpObjectTree alternative
// m_widget->dumpObjectInfo();
// m_widget->dumpObjectTree();
QList <QWidget *> objDmp = m_widget->findChildren<QWidget *>();
foreach (QWidget * w, objDmp)
{
qDebug() << w->objectName() << w->metaObject()->className();//w->staticMetaObject.className();
}
// List all the form elements that the user might be interacting with
QList <QPushButton *> buttons = m_widget->findChildren<QPushButton*>();
foreach(QPushButton * b, buttons)
qDebug() << b->objectName() << b->isVisible() << b->isEnabled() << b->text();
QList <QLineEdit *> lineEdits = m_widget->findChildren<QLineEdit*>();
foreach(QLineEdit * le, lineEdits)
qDebug() << le->objectName() << le->isVisible() << le->isEnabled() << le->text();
QList <QComboBox *> comboBoxes = m_widget->findChildren<QComboBox*>();
foreach(QComboBox * cb, comboBoxes)
qDebug() << cb->objectName() << cb->isVisible() << cb->isEnabled() << cb->currentText();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment