diff options
author | Bjoern Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-04-29 14:42:07 (GMT) |
---|---|---|
committer | Bjoern Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-04-29 15:43:57 (GMT) |
commit | 5a9623cb54c598aa4226883076fb413ef88215e5 (patch) | |
tree | 05ef92a0b9409d3eb93567d21c3c07baa88987ec /src/gui/kernel | |
parent | 48d9f395a2d2d0e9e4ff61b69c8c7e725aa3e3fd (diff) | |
download | Qt-5a9623cb54c598aa4226883076fb413ef88215e5.zip Qt-5a9623cb54c598aa4226883076fb413ef88215e5.tar.gz Qt-5a9623cb54c598aa4226883076fb413ef88215e5.tar.bz2 |
Wrong clip in QWidget::render(QPainter *, ...) when using Qt::(Replace|No)Clip.
The problem was that we didn't take the painter's clip into account
when setting the system viewport ("hard clip"). We only used the system
clip, but we have to use system clip + painter clip, which is the
current engine clip. Unfortunately, we have to calculate it again
since there's no cross-platform way of retrieving it.
This was only a problem with Qt::(Replace|No)Clip, since we
in all other cases combine the old clip with the new one.
(Uber cool) auto test included.
Task-number: 250482
Reviewed-by: Samuel
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f612601..fb9c8cb 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4824,8 +4824,13 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, const QRegion oldSystemClip = enginePriv->systemClip; const QRegion oldSystemViewport = enginePriv->systemViewport; - // This ensures that transformed system clips are inside the current system clip. - enginePriv->setSystemViewport(oldSystemClip); + // This ensures that all painting triggered by render() is clipped to the current engine clip. + if (painter->hasClipping()) { + const QRegion painterClip = painter->deviceTransform().map(painter->clipRegion()); + enginePriv->setSystemViewport(oldSystemClip.isEmpty() ? painterClip : oldSystemClip & painterClip); + } else { + enginePriv->setSystemViewport(oldSystemClip); + } render(target, targetOffset, toBePainted, renderFlags); |