Reputation: 457
I need to get list of UI elements on the application main window (all windows, doesn't matter).
The problem is that there is no topLevelWidgets()
function in QGuiApplication
, it is in QApplication
. Of course I could use QApplication
instead of QGuiApplication
, but the application already exists and I can't change source codes. I'm writing plugin.
I think if Qt
allows you to write place UI elements for application using QGuiApplication
class, it should give some way to get those elements, but maybe I'm wrong.
Any ideas?
Upvotes: 1
Views: 1874
Reputation: 626
QList<QWidget *> widgets = centralWidget::findChildren<QWidget *>();
This will get all of the widgets of the MainWindow.
Upvotes: 1