[Qt-interest] QGraphicsItem::shape() -> how to let it return a rectangle?
Christophe Oosterlynck
tiftof at gmail.com
Tue Aug 9 11:33:17 CEST 2011
Hi,
I'm having performance problems in QGraphicsView/QGraphicsScene because of
using clipping by QGraphicsItem::ItemClipsChildrenToShape. The parents that
should clip their children are QGraphicsRectItems. I set the rect by
setRect() and that's it, but calling shape() afterwards will return a
PainterPath with 27 elements, a rectangle should only have 5 => slow
clipping (in OpenGL) is used because the clipping will be a stencil buffer.
It seems to be qt_graphicsItem_shapeFromPath in the shape() method that adds
extra elements to the painterpath because of it taking the pen into account.
I have tried setting no pen, using QPen(Qt::NoPen) and a manual invisble pen
QPen(QBrush(Qt::NoBrush), 0, Qt::NoPen, Qt::FlatCap, Qt::MiterJoin). I even
tried with setting the width of the pen to (qreal)(DBL_MIN) because of the
patch I saw in qt_graphicsItem_shapeFromPath which sets a width of 0 to
0.00000001. The best I get is path with 15 elements, but this will still
cause slow clipping.
How can I get the QGraphicsRectItem::shape() function to return a rectangle
without having to override the shape() method myself?
Regards,
Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110809/cfa5b2c5/attachment.html
More information about the Qt-interest-old
mailing list