[PyQt] Multiple Signals Emitted

Rapczak, Jesse jrapczak at soe.sony.com
Fri Jan 27 23:24:08 GMT 2012


Nevermind, I was calling setupUi and then explicitly connecting the slots, so they were being connected twice.

Oops!

--
Jesse

-----Original Message-----
From: pyqt-bounces at riverbankcomputing.com [mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Rapczak, Jesse
Sent: Friday, January 27, 2012 5:05 PM
To: pyqt at riverbankcomputing.com
Subject: [PyQt] Multiple Signals Emitted

I've been loading Designer UI's using uic.loadUiType and noticed that my slots were getting called twice. After some digging I discovered the use of the pyqtSlot() decorator and the possibility that all signal types are being automatically connected to the same slot. From the PyQt4 docs:

	For example, QtGui.QAbstractButton has the following signal:

		void clicked(bool checked = false);

	Qt implements this as the following:

		void clicked();
		void clicked(bool checked);

	The pyqtSlot() decorator can be used to specify which of the signals should be connected to the slot.

Am I on the right track, here? I can't seem to get pyqtSlot() to behave in the simple example of a button:


	    self.testBtn.clicked.connect(self.testFunc)


    @QtCore.pyqtSlot(bool)
    def testFunc(self, b):
        # Do what I really want

    @QtCore.pyqtSlot()
    def testFunc(self):
        pass

In the above example, the bottom function gets called twice. 

Am I on the right track? Is this why my slots are getting called twice? Any help would be greatly appreciated!

--
Jesse Rapczak
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list