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

List:       pykde
Subject:    Re: [PyQt] QVariant conversion toInt()
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2008-07-27 17:41:06
Message-ID: 20080727174106.GA7286 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 27.07.08 09:23:48, lj wrote:
> And furthermore I read where string can be converted to just
> about everything... except Point, Rect and Size so to check 
> I ran the script below.
> 
> qv = QVariant(QString("255"))   # qv contains QString "255"
> print "\n Expect False"
> print qv.canConvert(QVariant.Point)
> print qv.canConvert(QVariant.Rect)
> print qv.canConvert(QVariant.Size)
> 
> print "\n Expect True"
> print qv.canConvert(QVariant.Bool)
> print qv.canConvert(QVariant.ByteArray)
> print qv.canConvert(QVariant.Char)      #!!! Prints False !!!

Well, the string has a length larger than 1 so its not possible to
convert it into a single character without loosing data.

Andreas

-- 
Look afar and see the end from the beginning.
_______________________________________________
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