Results 1 to 3 of 3

Thread: Navigate between QWidgets and MainWindow

  1. #1

    Default Navigate between QWidgets and MainWindow

    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
    Qt Code:
    1. void MainWindow::open_Edificio()
    2. {
    3. ui->centralwidget->hide();
    4. static Edificio *edif = new Edificio(this);
    5. ui->centralwidget = edif;
    6. ui->centralwidget->show();
    7. }
    To copy to clipboard, switch view to plain text mode 

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

    thanks for the atention

    Paulo

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Navigate between QWidgets and MainWindow

    simple
    emit your custom signal from child QWidget to mainWindow .. through signals and slot u can communicate to base class
    "Behind every great fortune lies a crime" - Balzac

  3. #3

    Default Re: Navigate between QWidgets and MainWindow

    Yes that was very simple, thanks for the help...



    Paulo

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.