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

Nikos Chantziaras realnc at arcor.de
Tue Jul 20 07:33:37 CEST 2010


On 07/20/2010 08:21 AM, Mandeep Sandhu wrote:
>[...]
> The QPixmap doc mentions an operator which is used for this purpose:
>
> <snip>
> QPixmap::operator QVariant () const
>
> Returns the pixmap as a QVariant.
> </snip>
>
> I didn't quite understand this! Which "operator" are we talking about
> here? Why doesn't it have a return value or is the QVariant the return
> value?

This is typecast operator overloading.  You cannot specify a return type 
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.



More information about the Qt-interest-old mailing list