[Qt-interest] Getting QVariant from QPixmap...and a strange operator!

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Tue Jul 20 08:05:19 CEST 2010


> This is typecast operator overloading.  You cannot specify a return type

Oh. Ok, I didn't know this.

> and it's the same as the target type, in this case QVariant.  The above
> gets called whenever a QPixmap is casted into a QVariant.

Then this is wrong:
...
return QVariant(*pix);

It should be instead:
...
return (QVariant)(*pix);

Since the former looked like creating a new QVariant object passing it
a QPixmap as an arg.

Thanks,
-mandeep


> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>




More information about the Qt-interest-old mailing list