[Solved] Confused about how to start a modeless dialog



  • Hello. I have a working Qt app (PyQt4, Qt 4.8.5) that creates a main window with various things in it. Now I would like to add a feature as a modeless dialog: a separate independent window, and the user can interact with either it or with the main window.

    I understand the dialog would be based on a QWidget with parent=0, so an independent window. And within the code of that widget, it can terminate by calling self.close(). What I do not see is how to launch it so that the main window does not wait for it. If the main window code calls the dialog object's exec() method, does the main window not hang until the dialog ends?

    There is probably a simple answer but I have not found it in the docs.


  • Lifetime Qt Champion

    Hi,

    The dialog should be based on QDialog not QWidget. Call the open() method and you should be good.

    Hope it helps



  • Thank you. From the QDialog page, "Modeless dialogs are displayed using show(), which returns control to the caller immediately."


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.