54 explicit PilotAgent(QObject* parent =
nullptr);
62 int ref(QWidget* widget);
65 int ref(QAction* action);
68 QWidget* widget(
int refId)
const;
71 QAction* action(
int refId)
const;
74 QObject* object(
int refId)
const;
77 std::string objectType(
int refId)
const;
80 bool isValidRef(
int refId)
const;
85 std::string snapshot(
int maxDepth = 8);
88 std::string snapshotOf(QWidget* root,
int maxDepth = 8);
91 QWidget* activeModalDialog()
const;
96 void highlight(QWidget* widget,
int durationMs = 2000);
99 void waitForIdle(
int timeoutMs = 5000);
102 QList<QWidget*> topLevelWidgets()
const;
105 bool triggerAction(QAction* action);
109 QList<QAction*> expandMenu(QMenu* menu);
115 bool eventFilter(QObject* obj, QEvent* event)
override;
119 static bool isWorthReporting(QWidget* w);
120 static bool isInteractive(QWidget* w);
123 void formatWidget(QWidget* w,
int depth, std::ostringstream& out);
124 void formatAction(QAction* a,
int depth, std::ostringstream& out);
125 void walkWidgetTree(QWidget* root,
int depth,
int maxDepth, std::ostringstream& out);
126 void formatWidgetValue(QWidget* w, std::ostringstream& out);
127 static QString statusTags(QWidget* w);
128 static QString friendlyName(QWidget* w);
131 void cleanupRef(
int refId);
133 bool autoSnapshot_ =
false;
136 QHash<QWidget*, int> widgetToRef_;
137 QHash<int, QWidget*> refToWidget_;
138 QHash<QAction*, int> actionToRef_;
139 QHash<int, QAction*> refToAction_;