QGraphicsView: Fix clipping bug for rectangular custom items
If an item's shape() path described a rectangle not starting at the top left corner, the code setting up clipping would correctly identify and attempt to use it as a rectangle. However the conversion to a QRectF would produce a non-normalized rectangle, which could lead to unexpected clipping results. Fix by ensuring the rect is normalized. Fixes: QTBUG-128488 Change-Id: Icbd17a95dde46a1969994f5eac021ac7b8ac5689 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 0cba6115605f586109a9b167a7d220670c5cda03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
298ea22e98
commit
93e8e2dc4b
@ -4772,7 +4772,7 @@ static inline void setClip(QPainter *painter, QGraphicsItem *item)
|
||||
QRectF clipRect;
|
||||
const QPainterPath clipPath(item->shape());
|
||||
if (QPathClipper::pathToRect(clipPath, &clipRect))
|
||||
painter->setClipRect(clipRect, Qt::IntersectClip);
|
||||
painter->setClipRect(clipRect.normalized(), Qt::IntersectClip);
|
||||
else
|
||||
painter->setClipPath(clipPath, Qt::IntersectClip);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user