summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp16
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h5
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
3 files changed, 17 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 425031f..120ca05 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -9939,9 +9939,19 @@ QRectF QGraphicsItemEffectSourcePrivate::boundingRect(bool deviceCoordinates) co
void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter)
{
- QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
- scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion,
- info->widget, info->opacity, 0, info->wasDirtySceneTransform, info->drawItem);
+ if (painter == info->painter) {
+ QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
+ scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion,
+ info->widget, info->opacity, 0, info->wasDirtySceneTransform,
+ info->drawItem);
+ } else {
+ QTransform effectTransform = painter->worldTransform();
+ effectTransform *= info->transformPtr->inverted();
+ QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
+ scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion,
+ info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform,
+ info->drawItem);
+ }
}
QPixmap QGraphicsItemEffectSourcePrivate::pixmap(bool deviceCoordinates, QPoint *offset) const
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index db79e07..c6161bf 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -514,9 +514,9 @@ struct QGraphicsItemPaintInfo
{
inline QGraphicsItemPaintInfo(const QTransform *const xform1, QTransform *xform2,
QRegion *r, QWidget *w, QStyleOptionGraphicsItem *opt,
- qreal o, bool b1, bool b2)
+ QPainter *p, qreal o, bool b1, bool b2)
: viewTransform(xform1), transformPtr(xform2), exposedRegion(r), widget(w),
- option(opt), opacity(o), wasDirtySceneTransform(b1), drawItem(b2)
+ option(opt), painter(p), opacity(o), wasDirtySceneTransform(b1), drawItem(b2)
{}
const QTransform *viewTransform;
@@ -524,6 +524,7 @@ struct QGraphicsItemPaintInfo
QRegion *exposedRegion;
QWidget *widget;
QStyleOptionGraphicsItem *option;
+ QPainter *painter;
qreal opacity;
quint32 wasDirtySceneTransform : 1;
quint32 drawItem : 1;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 3a899ff..99aa347 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4310,7 +4310,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
}
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, exposedRegion, widget, &styleOptionTmp,
- opacity, wasDirtyParentSceneTransform, drawItem);
+ painter, opacity, wasDirtyParentSceneTransform, drawItem);
QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source;
QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *>
(source->d_func());