Please nominate your Qt Champions for 2021!

[SOLVED] Showing a DialogBox instead of Exec.

  • Here is the issue, I am currently trying to show a Dialog box by creating an instance of the dialog box, then showing the box.


    void mainWindow::dialogShow()
    randomDialog dialog;;

    randomDialog is a dialog box I designed in Qt Designer and all header files are linked in the beginning of the .cpp file (including the ui_randomDialog.h file).

    dialogShow() is connected to a button.

    So, this fails to show the dialog box, but using .exec() works perfectly. Yet, exec does not allow both boxes to run simultaneously, aka once the dialog box is open, the other form cannot execute any code.

    I was linked this previously when I had this issue and used exec to get by. This time I would like to use modeless dialogs instead of modal. Any ideas on how to get the .show() to work?

  • Try

    @void mainWindow::dialogShow()
    randomDialog *dialog = new randomDialog(this);

    and not forget make "delete" for this object

  • Ha! That worked, thank you!

Log in to reply