Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73287

Consider marking QDialog::exec() deprecated

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None

    Description

      The documentation for QDialog::exec says:

      Note: Avoid using this function; instead, use open(). Unlike exec(), open() is asynchronous, and does not spin an additional event loop. This prevents a series of dangerous bugs from happening (e.g. deleting the dialog's parent while the dialog is open via exec()).

      See also https://blog.qt.io/blog/2010/02/23/unpredictable-exec/ .

      However, the main QDialog documentation just says:

      The most common way to display a modal dialog is to call its exec() function.

      …which might lead new users to think QDialog::exec() is just fine, if they don't happen to see the method-specific documentation.

      Would it be appropriate to mark QDialog::exec() deprecated (and remove the mention in the main QDialog documentation), since it's problematic and an alternative API is available?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            smokris Steve Mokris
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes