Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Answer of exercise: Qt hide and show #1

 

Answer of exercise: Qt hide and show #1 is the answer of the exercise Qt hide and show #1.

 

 

 

 

 

Solution

 

 

The uninteded behavior is coded in main:

 

#include <QtGui/QApplication>
#include "firstdialog.h"

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  FirstDialog w;
  w.exec();
}

 

I think that this means, that at the moment when FirstDialog is hidden (for showing the second dialog) and the second dialog closes, FirstDialog::exec finishes with an error code of zero.

 

Instead, I want that that moment is bridged until the first dialog closes. In that case main should be:

 

main.cpp

 

#include <QtGui/QApplication>
#include "firstdialog.h"

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  FirstDialog w;
  w.show();
  a.exec();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml