I have an application with QMainWindow
as the UI which is in minimized state, after some time the application throws a message by calling messageDlg->show()
(messageDlg
is a QDialog
object). Something like this
void MainWindow::WarningDialog()
{
m_messageDialog = new QDialog(this);
m_messageDialog ->show();
}
This results in my QMainWindow
in normal mode which I don't want to happen i.e. am trying to keep the application in minimized window even if any QDialog.show()
is called.
I don't want the keep checking if the application in minimized mode every time a QDialog->show()
is called.
I've tracked all events posted to QMainWindow::event()
but the only event I see happening before restoring my window is a QEvent::WindowStateChange
i.e. the window state has already changed from minimized mode.
Is there a way to keep the QMainWindow
minimized even if any QDialog
s are shown?
QWidget
has slotshowMinimized()
. You should createQDialog
without parent asQMainWindow
. In yourQDialog
set attribute (e.g.), then you can set
showMinimized()
forQMainWindow
in time when yourQDialog
had start.