[PyQt] Have to close dialog boxes twice

David Boddie david at boddie.org.uk
Sun Oct 21 17:29:29 BST 2007


On Sun Oct 21 09:33:32 BST 2007, Thorsten Kampe wrote:

> Now I tried to separate the layout from the code logic by using Qt 
> Designer and generating and importing an Ui file. This works fine, 
> too. Except that with the modified version I have to click twice on 
> the close or Ok button to close the dialog boxes and I have no idea 
> why. Can anyone give a clueless person a clue?

It sounds like you need to put decorators before the slots that are
invoked when an action is triggered:

    @pyqtSignature("")
    def on_action_About_triggered(self):
        QtGui.QMessageBox.about(self, self.tr('About Application'),
                                self.tr('My Application does something\n'
            'This software comes without warranty, liability or support!'))

This is because there are effectively two forms of the triggered() signal:
one with a boolean parameter and one without. You need to specify which one
of these you want to receive.

David



More information about the PyQt mailing list