PDA

View Full Version : PyQt5 button.clicked slot called TWICE, no matter what I do to fix it...



enjoysmath
17th November 2015, 18:26
The code is half generated in QtDesigner.

I have a button called placeImageButton, and am programatically connecting it
with
self.toolBox.placeImageButton.clicked.connect(self .placeImage)

I've tried renaming the button and the slot to obscure names.

I've tried commenting out connectSlotsByName() call in QtDesigner-generated code.

The slot gets called twice and has no call stack to find out where from.

The second call also seems to crash the application when I have a QFileDialog.getOpenFileName() call in it and the user clicks 'Cancel'.

This is such a bug that my app is useless for now until it is fixed. :'(

Added after 15 minutes:

I AM THE MASTER BUG FIXER OF THE UNIVERSE!!!!!!!

I think I found the bug. I have two instances of GraphicsScene, each making the connection.

So I have to reroute the call to a mother class that dispatches to the correct GraphicsScene.

(I have multiple projects allowed open in my app)