In the application I'm building I need the user to input some information the first time he open the application. So in the widget that is my QMainWindow I checks if the data has been created, otherwise I need to show another widget (SetupView) for the user so he can enter the data. The rest of the application is all in MainWidget.

In the code I'm using now the problem is that the SetupView shows up first as I set it to showMaximized but then right after I use w.showMaximized to show my MainWidget so the SetupView will not show. Can I make the SetupView show up inside MainWidget instead? I should always show the MainWidget fullscreen as this is the main window of the application right?

I am not sure how to make a good solution out of this, but you can see the code below and maybe you find it simplier than me. I have been working with this all morning but can't figure out the best way. What is your idea? Thanks!

In main.cpp:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4. MainWidget w;
  5. w.showMaximized();
  6. return a.exec();
  7. }
To copy to clipboard, switch view to plain text mode 

In MainWidget.cpp:
Qt Code:
  1. MainWidget::MainWidget(QWidget *parent)
  2. : QMainWindow(parent)
  3. {
  4. ui.setupUi(this);
  5.  
  6. DataHolder *data = new DataHolder();
  7. if(!data->hasData())
  8. {
  9. SetupView *setupView = new SetupView();
  10. setupView->showMaximized();
  11. }
  12. }
To copy to clipboard, switch view to plain text mode