[PyQt] stuck on non-modal dialog

Phil Thompson phil at riverbankcomputing.co.uk
Wed May 23 08:22:41 BST 2007


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.

>     @QtCore.pyqtSignature("")
>     def on_closeButton_clicked(self): self.hide()
>     @QtCore.pyqtSignature("")
>     def on_searchButton_clicked(self): self.search()

Phil


More information about the PyQt mailing list