[Interest] QVariant equality

Thiago Macieira thiago.macieira at intel.com
Thu Apr 4 19:51:07 CEST 2013


On quinta-feira, 4 de abril de 2013 08.35.41, Rainer Wiesenfarth wrote:
> From: Thiago Macieira
> 
> > [...]
> > Finally, note that QVariant's equality operator compares *values*, not
> 
> types.
> 
> > 	QVariant(0LL) == QVariant(0.0) == QVariant(0) == QVariant("0")
> 
> Are you sure about the QVariant(0) == QVariant("0")?

Yes. QVariant("0").toInt() == 0 whereas QVariant("\0").toInt() is a failure of 
conversion.

> I would expect
> QVariant(0) == QVariant("\0") and/or QVariant(0) == QVariant(""), but
> otherwise assume that QVariant (48) == QVariant('0') == QVariant("0").

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130404/78935c5c/attachment.sig>


More information about the Interest mailing list