[PyQt] stuck on non-modal dialog

David J Brooks daeg at houston.rr.com
Wed May 23 15:18:04 BST 2007


On Wednesday 23 May 2007 02:22:41 am Phil Thompson wrote:
> On Wednesday 23 May 2007 2:20 am, David J Brooks wrote:
> > I'm sure I must be overlooking something obvious, but I don't see it.
> >
> > Ive set up a main window for MDI and added a Find dialog, with signals
> > and slots to activate it. The dialog pops up as expected, but is totally
> > unresponsive. Nothing typing into its lineEdit does nothing, buttons
> > don't seem to 'click'  etc. Worse, it seems to hang the application,
> > requiring a killall -9 python to close it. What am I not seeing?
> >
> > class MainWindow(QtGui.QMainWindow):
> >     def __init__(self, fileName=None, parent=None):
> >         QtGui.QMainWindow.__init__(self, parent)
> >         self.ui=Ui_MainWindow()
> >         self.ui.setupUi(self)
> >         self.workspace=QtGui.QWorkspace(self)
> >         self.setCentralWidget(self.workspace)
> >         self.finder=findDialog()
> >         self.connect(self.ui.actionFind, QtCore.SIGNAL("triggered()"),
> > self.findWord)
> >
> >     def findWord(self):
> >         self.finder.show()
> >         self.workspace.setActiveWindow(self.finder)
> >
> >
> > class findDialog(QtGui.QDialog):
> >     def __init__(self, parent=None):
> >         QtGui.QDialog.__init__(self, parent)
> >         self.ui=Ui_findDialog()
> >         self.ui.setupUi(self)
> >         self.setModal=(False)
>
> You might want to look at the line above.

I'm looking, but I'm not sure what I'm meant to see. setModal(False) shouldn't 
do anything at all, because the dialog should be non-modal by default. 
Removing the line in question does not make the dialog responsive. Setting it 
to True (and changing the show method to exec_) provides a responsive modal 
dialog that still does not return control back to the application. 


-- 
One of the lessons of history is that nothing is often a good thing to
do and always a clever thing to say.
		-- Will Durant


More information about the PyQt mailing list