Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

So, the exec( ) should be abandoned ?



  • I thind most of Qter know these three articles:

    • Unpredictable exec()
    • QtQuarterly30 : New Ways of Using Dialogs
    • How to crash (almost) every Qt/KDE Application and how to fix it

    It is seems that the exec() to be a little evil . So , If we overloading of QDialog, we should avoiding using the exec() ?


  • Moderators

    Please post links to these articles, I do not know them.

    Without reading them, I'd say exec() is OK, especially for small and simple things (like getting a save file name, displaying a popup message etc.), as long as you remember that main event loop will be spinning in the background.



  • @cyberpunker
    I have read various articles on this. Meanwhile I have used exec() just as you would expect happily for years, and found no ill effects. So up to you, but especially as I think you are learning I would use QDialog::exec() where appropriate and not worry about it :)

    [Moved in from a duplicate topic ~kshegunov]


  • Lifetime Qt Champion

    Hi
    if exec( ) should be abandoned i will surely burn in hell as my main Qt project is
    mainly QDialogs using exec(). :)


  • Lifetime Qt Champion

    If you are heavily processing custom events or using threading, you may have unexpected behavior because it's not the same event loop that will be processing these events while exec is running hence the recommendation of using open and a slot for the result handling.


Log in to reply