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

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Jul 20 08:07:16 CEST 2010


Actually, just store the QPixmap not a pointer to it, will make your life a  lot easier...

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Mandeep Sandhu
> Sent: Monday, July 19, 2010 11:05 PM
> To: Nikos Chantziaras
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Getting QVariant from QPixmap...and a
> strangeoperator!
> 
> > 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
> >
> 
> _______________________________________________
> 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