.show(); does move on with the following code but the program stucks (without displaying the Msgbox)
The difference is that exec() shows the window and blocks untill it's closed, where show() just posts show event to widget and continues without blocking.
consider the following examples:
1)
box.show();
while(1);
QMessageBox box;
box.show();
while(1);
To copy to clipboard, switch view to plain text mode
2)
box.exec();
while(1);
QMessageBox box;
box.exec();
while(1);
To copy to clipboard, switch view to plain text mode
3)
box.show();
qApp->processEvents();
while(1);
QMessageBox box;
box.show();
qApp->processEvents();
while(1);
To copy to clipboard, switch view to plain text mode
All of them will eventualy loop forever, but thats not important right now.
In 1) you probably wont see the message box at all, because the "show" event will not be delivered to message box, program enters while(1) loop and happily loops.
In 2) message box will be displayed and program will wait untill you'll close it or click the default "ok" button.
3) will render the box properly, but you will be unable to do anything, because the while(1) loop will start running.
Its because processing the events will show your message box before moving on.
I hope its clear enough.
Bookmarks