I have a QMainWindow which spawns a few wizards. The QMainWindow has a QFrame class that lists a collection of objects. I want to launch this window from within my wizard's QWizardPages.
Basically, I need to connect a signal to a slot in the grand parent. The most obvious way to do this would be:
MyMainWindow *mainWindow = qobject_cast<MyMainWindow *>(parent->parent());
if(mainWindow)
{
connect(button, SIGNAL(clicked()), mainWindow, SLOT(launchWidgetOne()));
} else
{
qDebug() << "Super informative debug message";
}
Being new to qt4, I'm wondering if traversing the parent tree and qobject_cast are best practice or if there's a another means of doing this that is more recommended?