[Qt-interest] remove all elements from a QPainterPath
Sean Hayes
sean.t.hayes at vanderbilt.edu
Thu Mar 31 16:34:00 CEST 2011
Markus,
Very clever thought. However, I believe that making assignments to the this
pointer violates the C++ standards and will not compile on most modern
compilers. Therefore, the following statement should not work.
*this = QPainterPath();
I have heard that you can get this functionality in gcc by using
"-fthis-is-variable". However, that would be really bad practice for new
code. Even if it did compile, wouldn't it only change the value of the local
copy of the this pointer? That is, the new value of this would leave scope
when the method returned.
Regards,
Sean
On Thu, Mar 31, 2011 at 8:51 AM, Stephen Chu <stephen at ju-ju.com> wrote:
> In article
> <OF3CD162E1.6EF3F42A-ONC1257864.0026ABC7-C1257864.00291B34 at sebakmt.com>,
> Markus Franke <Franke.M at sebakmt.com> wrote:
>
> > Dear Alex,
> >
> > thanks for your reply. However, this is not really what I want to
> achieve.
> >
> > I would like to inherit from QPainterPath and then clear the path from
> > within a member function of this derived class.
> >
> > Best regards,
> > Markus Franke
>
> How about this?
>
> class MyPath : public QPainterPath {
> MyPath(const QPainterPath & copy) : QPainterPath(copy) {}
> void clear() {
> *this = QPainterPath();
> }
> };
>
> --
> Stephen Chu
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110331/949b5e40/attachment.html
More information about the Qt-interest-old
mailing list