Programmatically open not modal window under already opened modal window



  • There is MainWindow inherited from QMainWindow. And there is SettingsDialog inherited from QDialog. From MainWindow user can open SettingsDialog as modal dialog by clicking "Settings" button.

    @void MainWindow::showSettingsDialog()
    {
    SettingsDialog settingsDialog(this);
    settingsDialog.exec();
    }@

    App has tray notifications. If user clicks notification ReadWindow (inherited from QWidget) will be opened as not modal window.

    @void MainWindow::onTrayMessageClicked()
    {
    activateWindow();
    ReadWindow *readWindow = new ReadWindow(this);
    readWindow->show();
    }@

    Now if user clicks tray notification when SettingsDialog is opened ReadWindow will be opened in front of SettingsDialog. User can activate ReadWindow, but all UI elements (for example all buttons) in ReadWindow are blocked(i.e. buttons are not clickable) while SettingsDialog is open.

    How to open ReadWindow under SettingsDialog and do it not selectable by user (since SettingsDialog is modal)?

    My goal is: open ReadWindow under any other modal windows and user must not interact with ReadWindow until he closes all modal windows


Log in to reply
 

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