How to make a modal dialog?
-
I am trying to make a modal dialog. I have the below code. If I use ldlg.show(), the dialog never appears. If I use ldlg.exec_(), the dialog is not modal. What am I doing wrong? I have the dialog properties set to ApplicationModal.
@
self.action_Legend.triggered.connect(self.show_legend)def show_legend(self): """Display the Legend dialog.""" class LegendDialog(QDialog, legendDlg.Ui_dlgLegend): def __init__(self, parent=None): super(LegendDialog, self).__init__(parent) self.setupUi(self) ldlg = LegendDialog() ldlg.exec_()
@
-
Please check out how to use "code wrappings.":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 They make your code section readable. I introduced them for you this time.
-
Thankfully, I found the answer "somewhere else":http://stackoverflow.com/questions/5874025/pyqt4-how-to-show-a-modeless-dialog...
@ ldlg = LegendDialog(self)
ldlg.show()@