[Development] QList

Marc Mutz marc.mutz at kdab.com
Mon Mar 27 08:55:53 CEST 2017

On Sunday 26 March 2017 22:53:59 Martin Smith wrote:
> >Yes, using vector for an array type was not Stepanov's best choice of
> >terms (he says so himself), but what you're doing is like arguing that
> >"debt" should be spelled "det". Yes, it should. No, it isn't. :)
> I disagree, but if we have accepted that a vector is a collection, then a
> polygon is a vector. Or it at least has a vector.

No and no. A vector is a collection of points and so is a polygon. Both are 
even ordered. But there are good reasons for a polygon to be represented as 
something else than a vector. E.g. a BSP. Or a platform-specific data type. On 
some platforms, where everything is a path, it might even make some sense to 
back QPolygon with QPainterPath. Cf. several paint engine implementations 
which first have to convert to QPP.

(the API is lying here, btw: QPainer::drawPolygon(const QPoint *, int) 
suggests that you can manage the storage youself to avoid using the heap. But 
you do that only to have the paint engine create something expensive as a 
QPainterPath first chance it gets).

You just rubberducked me into realizing that QPolygon shouldn't even inherit a 
QBasicVector. It should probably contain a QPlatformPolygon instead.


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, C++ and OpenGL Experts

More information about the Development mailing list