What is the difference between these two methods? Both display window ...
What is the difference between these two methods? Both display window ...
Qt 5.3 Opensource & Creator 3.1.2
exec() blocks the application flow while show() doesn't.
exec is mainly used for modal dialogs.
So, then:
Qt Code:
To copy to clipboard, switch view to plain text mode
and
are identical?
Qt 5.3 Opensource & Creator 3.1.2
Not really.
After calling show() the program flow will continue.
When you call exec() it will not return until you close the dialog.
BTW, exec is available only for QDialog.
Why don't you check the docs about exec and show? They explain it very well.
Yes, I am checking now, but just final question. So show method initiates its own thread or not?
Qt 5.3 Opensource & Creator 3.1.2
no it doesn't.
Actually as far as I understand, QDialog::exec() does not either - it just intervenes in the vent loop and does not allow new events to get in - but I didn't check QDialogs code, so I am not 100% sure about this.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
No, you're right. No thread is started by QDialog::exec nor show(). That would make no sense. The event loop of the parent window is used to process the dialog events.
MarkoSan (18th October 2007)
Bookmarks