[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.

    i.e.

    @
    void mainWindow::dialogShow()
    {
    randomDialog dialog;
    dialog.show();
    }
    @

    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 http://developer.qt.nokia.com/doc/qt-4.7/qdialog.html#id-8f49114e-2fb8-4525-8a9d-af84f69df7e6 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);
    dialog->show();
    }@

    and not forget make "delete" for this object



  • Ha! That worked, thank you!


Log in to reply
 

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