From 8fae676fb0bd36f507ffa0815fa824370eb06a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 26 Jun 2009 17:26:15 +0200 Subject: Fix painting errors in QScrollArea on Mac (Carbon) This is mainly a stop-gap solution for 4.5.x. It trades painting performance for correct painting. Commit 7988d05da changed the opaque test from q->testAttribute(Qt::WA_OpaquePaintEvent) to qt_widget_private(w)->isOpaque in qt_mac_update_widget_posisiton. This means we'll do optimized moves in more cases. Unfortunately it also causes painting errors in some cases (see the task). Revert the commit for now to put the 4.5 branch in a god shape. Task-number: 252295 Reviewed-by: nrc --- src/gui/kernel/qwidget_mac.mm | 4 ++-- tests/auto/qwidget/tst_qwidget.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index d2b059e..8f04b89 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3749,7 +3749,7 @@ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newR // Perform a normal (complete repaint) update in some cases: if ( // move-by-scroll requires QWidgetPrivate::isOpaque set - (isMove && qd->isOpaque == false) || + (isMove && q->testAttribute(Qt::WA_OpaquePaintEvent) == false) || // limited update on resize requires WA_StaticContents. (isResize && q->testAttribute(Qt::WA_StaticContents) == false) || @@ -4273,7 +4273,7 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) HIRect bounds = CGRectMake(w->data->crect.x(), w->data->crect.y(), w->data->crect.width(), w->data->crect.height()); HIViewRef hiview = qt_mac_nativeview_for(w); - const bool opaque = qt_widget_private(w)->isOpaque; + const bool opaque = q->testAttribute(Qt::WA_OpaquePaintEvent); if (opaque) HIViewSetDrawingEnabled(hiview, false); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index e65fef1..7b68732 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -3964,6 +3964,7 @@ public: :QWidget(parent) { setAttribute(Qt::WA_StaticContents); + setAttribute(Qt::WA_OpaquePaintEvent); setPalette(Qt::red); // Make sure we have an opaque palette. setAutoFillBackground(true); gotPaintEvent = false; -- cgit v0.12