PDA

View Full Version : Navigate between QWidgets and MainWindow



pcaeiro
5th August 2009, 12:23
Hello,

I'm developing an application in Qt4.5 with QTCreator.

My main idea is to have a MainWindow and various Qwidget classes that could be loaded to MainWindow centralWidget.

My problem is to have access to MainWindow centralWidget from a Qwidget class, that i suppose it is possible but i am not shore about that.

here is an example how i show a Qwidget class on MainWindow centralWidget from mainwindow.cpp


void MainWindow::open_Edificio()
{
ui->centralwidget->hide();
static Edificio *edif = new Edificio(this);
ui->centralwidget = edif;
ui->centralwidget->show();
}


How can i do the same from a Qwidget class like Edificio in edificio.cpp for instance?

thanks for the atention

Paulo

wagmare
5th August 2009, 12:44
simple
emit your custom signal from child QWidget to mainWindow .. through signals and slot u can communicate to base class

pcaeiro
5th August 2009, 13:05
Yes that was very simple, thanks for the help...

:D

Paulo