I'm trying to test with QTest a GUI application. I can access to all the UI elements across the ui_class.h. The problem is, that I've created several QMessageBox on the main program as local variable and I need them to use QTest::mouseClick() when anyone of them appears.
I'm trying to avoid to realocate those QMessageBox if possible, so I tried to get the Widgets with QApplication::topLevelWidgets() and QApplication::allWidgets(), but they were not working because I cannot find any QWidget which inheriths to QMessageBox. Neither is working QApplication::activeWindow() to make click (or press enter, I just wanna go further after clicking or pressing enter).
So, I would need to know how to select that QMessageBox stored as local variable on my GUI application I'm testing, to select it as QWidget.
My stored variables are QMessageBox::StandardButton and QMessageBox::warning
Thanks in advance for the help.
Could you show more code, please? It's not clear: do you use
constructor or something else. May be you might use
obj->findChild<T>(name)orqobject_cast()? If you post your code I may try to test it.