[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: *** GMX Spamverdacht *** [PyQt] pyqt4 signal/slot using PyObject*
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-04-27 14:45:08
Message-ID: 20070427144508.GA3988 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 27.04.07 11:30:04, Pradnyesh Sawant wrote:
>    def run(self):
>        cntr = 0
>        while cntr < 10:
>            cntr += 1
>            self.emit(QtCore.SIGNAL("showCntr1(PyObject*)"), (cntr,
> "a"))   # line 1
>            self.emit(QtCore.SIGNAL("showCntr2"), (cntr, "a"))
>          # line 2
>            time.sleep(0.2)
...
> if __name__ == "__main__":
>    app = QtGui.QApplication(sys.argv)
>    dialog = Gui()
>    cntr = Counter()
>    cntr.start()
>    QtCore.QObject.connect(cntr, QtCore.SIGNAL("showCntr1(PyObject*)"),
>            dialog.showCntr1, QtCore.Qt.QueuedConnection)
>    QtCore.QObject.connect(cntr, QtCore.SIGNAL("showCntr2"),
>            dialog.showCntr1, QtCore.Qt.QueuedConnection)
>    sys.exit(dialog.exec_())
> #################################################################
> If i comment out "line 1", then i get the following output:

You don't keep a reference to the object that you send via the signal.
You need to do that, as a queued connection behaves different from a
direct connection (which is a direct function call). Thats why you see
all kinds of weird results.

I couldn't make the line 1 work though, it always tells me that argument
0 of the signal has an invalid type.

Andreas

-- 
Don't hate yourself in the morning -- sleep till noon.
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic