Allow Close Button on QMainWindow when QDialog is Open
I have one issue with Qt Close Option when there is QMainWindow is open and on Push button Clicked I am opening one QDialog.Now my requirement is to allow close option is QMainWindow to call closevent of QMainWindow .
Now the senario is when I pressed Button on mainwindow, QDialog open and Close button on upper most right is disabled in QmainWindow. So pls let me know how to enable.
So, you don't want to have your GUI blocked while dialog is open, right?
Use a modeless dialog:
void EditorWindow::find()
{
if (!findDialog) {
findDialog = new FindDialog(this);
connect(findDialog, SIGNAL(findNext()), this, SLOT(findNext()));
}
findDialog->show();
findDialog->raise();
findDialog->activateWindow();
}
Note: The code was taken from the Qt documentation. Notice that we are not using a QDialog::exec()
method but just QWidget::show()
.
Thanks for support you are right it was a problem of modeless
I have Just added as per Example above:
findDialog->setModel(false);
findDialog->show();
Before Show I have added setModel(false);
and its then working like a charm !!!
Thanks and Regards Praveen Kumar
链接地址: http://www.djcxy.com/p/39280.html