Hello all,

After googling around for a few hours i can't find any example for passing arguments to an user-defined method in pyqt.. The only link i found related to this is http://www.commandprompt.com/community/pyqt/x1408 . In this example we have to make it to emit the signal and pass the argument..

Can u please tell me how can i pass the argument in the below connect

QtCore.QObject.connect(self.dialogBoxButton,QtCore.Signal('clicked()'),self.executeFunction)

In the above example if i want to pass a parameter to executeFunction how can i achieve that??

The signal itself has to emit an argument if you want to connect it to a slot which accepts an argument. Otherwise, you need an intermediate function which adds the parameter in and then calls the appropriate slot with an argument. At least, this is to the best of my knowledge, which is admittedly mostly with Qt 3 in C++. :)

Some links you may find interesting:
http://www.commandprompt.com/community/pyqt/c1267 (pretty much the same as what you already found)
http://web.archive.org/web/20080313110720/http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support (linked to in the previous page, but the link is broken)

The signal itself has to emit an argument if you want to connect it to a slot which accepts an argument. Otherwise, you need an intermediate function which adds the parameter in and then calls the appropriate slot with an argument. At least, this is to the best of my knowledge, which is admittedly mostly with Qt 3 in C++. :)

Some links you may find interesting:
http://www.commandprompt.com/community/pyqt/c1267 (pretty much the same as what you already found)
http://web.archive.org/web/20080313110720/http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support (linked to in the previous page, but the link is broken)

Many thanks for the above two links.. It was really useful..
In this link http://web.archive.org/web/20080313110720/http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support they are talking about passing PyQt_PyObject as a parameter.. In the broad sense everything in python is an object.. Am i right?? String,integer etc., So can i pass this as an argument.. Ihey have not given any examples there.. Can u give me a simple example???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.