[PyQt] auto-connected slots (QAction.triggered) seem to be connected twice

Phil Thompson phil at riverbankcomputing.com
Fri Oct 24 15:50:04 BST 2014


On 23/10/2014 6:11 pm, Alan Ezust wrote:
> I just tried creating a QMainWindow app with Designer integration and I
> wanted to
> use an auto-connected slot. I am attaching the code here.
> The signal is emitted only once, I can see but the auto-connected slot 
> is
> called twice for each trigger of the action.
> 
> I reproduced this in PtQt 5.2.1 as well as PyQt 3.4.2 on windows 7.

Qt implements signals with an optional argument as two signals. Decorate 
the method to tell PyQt which you want. As you are not using the 
extraObj then...

     @pyqtSlot()
     def on_actionOpen_triggered(self):

Phil



More information about the PyQt mailing list