[PyQt] Where is QStringList?

Marcus Ottosson konstruktion at gmail.com
Wed Nov 26 18:53:49 GMT 2014


Oh god, looks like I replied just to a single participant. Here's what I
posted yesterday.

> (bleh, seems like your mail client messed this up...)

Sorry about that. Could you post a screengrab of what it looks like?
Haven't had this issue before, here it looks ok. (I'm on Gmail)

> You can pass a C++ type as a string to pyqtSlot, i.e.:

That does indeed work for passing a list from QML like I was looking for.
It doesn't quite work as I hoped however.

Basically this from QML:

log.debug("Hello", "World")

Should get to Python like this.

@QtCore.pyqtSlot("QStringList")
def debug(*args):
    log.debug(" ".join(args))

I'd like to support an arbitrary amount of arguments to my Python debug
method. Does that make sense?

On 25 November 2014 at 10:29, Florian Bruhin <me at the-compiler.org> wrote:

> * Marcus Ottosson <konstruktion at gmail.com> [2014-11-25 09:59:21 +0000]:
> > Ah, I see. I was trying to use it in a pyqtSlot.
> >
> > Could you have a look at the below example and see I’m thinking about
> this
> > the right way?
> >
> > @QtCore.pyqtSlot(QtCore.QStringList)def warning(self, *msg):
> >     self.log.warning(" ".join(msg))
>
> (bleh, seems like your mail client messed this up...)
>
> You can pass a C++ type as a string to pyqtSlot, i.e.:
>
>     @QtCore.pyqtSlot('QStringList')
>
> should probably work.
>
> Florian
>
> --
> http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
>              GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
>          I love long mails! | http://email.is-not-s.ms/
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
*Marcus Ottosson*
konstruktion at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141126/2979af30/attachment.html>


More information about the PyQt mailing list