[PyQt] signal with a (python) list

Marcos Dione mdione at grulic.org.ar
Sat Sep 26 11:06:47 BST 2009


    question made on irc:

20:03 < StyXman> can I define a pyqtSignal() with a parameter which is a list?
21:48 < david_boddie> StyXman: Define a signal to emit a list like this: 
    abc = pyqtSignal("list")
21:49 < david_boddie> StyXman: Define a signal to emit a list as one of the 
    parameters like this: abc = pyqtSignal("list", "int", "double")

    but it doesn't work:

QObject::connect: Cannot queue arguments of type 'list'
(Make sure 'list' is registered using qRegisterMetaType().)

    playing a litle more I found the (partial) solution: as my list contains
unicode()s, I used QStringList:

foundSongs= pyqtSignal (QStringList)
...
# pyqt4 cannot make this automatically
self.foundSongs.emit (QStringList (filepaths))

    if the list were of something else, what should one do?

-- 
(Not so) Random fortune:
The Weak Lusethropic Principle states: "As more idiot-proof software becomes
available, more idiots are able to use computers. Idiot-proof software did not
make or cause computer lusers; it simple allowed lusers to use computers where
they could not before." 
	    -- Ben Cantrick


More information about the PyQt mailing list