[Development] Is QImage movable

Иван Комиссаров abbapoh at gmail.com
Tue May 26 12:54:25 CEST 2015


Good, that's what i exactly wanted to know.

2015-05-26 14:56 GMT+03:00 Marc Mutz <marc.mutz at kdab.com>:

> On Saturday 23 May 2015 19:47:28 Thiago Macieira wrote:
> > On Saturday 23 May 2015 15:35:23 Иван Комиссаров wrote:
> > > Hi.
> > >
> > > I’ve created a QVector of QImages and tried to insert an image in the
> > > vector: QVector<QImage> images;
> > > images.insert(images.begin(), QImage());
> > >
> > > I got a compiler warning saying
> > >
> > > "qvector.h:649:21: warning: destination for this 'memmove' call is a
> > > pointer to dynamic class 'QImage'; vtable pointer will be overwritten
> > > [-Wdynamic-class-memaccess]»
> > >
> > > This happens because QImage inherits QPaintDevice (which is virtual)
> and
> > > QImage is declared movable using Q_DECLARE_SHARED macro.
> > >
> > > Is this behavior intended?
> >
> > Yes.
>
> In Qt 6, we should probably change that to static polymorphism. E.g.
> anything
> with a
>   QPaintDevice * paintDevice()
> method on can be painted-to. I ran into the polymorphism of what should be
> a
> value class, too, already (when implementing swap).
>
> Thanks,
> Marc
>
> --
> Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
> KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
> Tel: +49-30-521325470
> KDAB - The Qt Experts
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150526/746d4537/attachment.html>


More information about the Development mailing list