Skip to content

Latest commit

 

History

History
83 lines (48 loc) · 1.95 KB

CppExerciseQtHideAndShow1Answer.md

File metadata and controls

83 lines (48 loc) · 1.95 KB

 

 

 

 

 

 

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(); }