summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-22 11:16:56 (GMT)
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-22 11:16:56 (GMT)
commit120252acef2d81d0046b421ad2cc1455975c0052 (patch)
treee7d518de87de63c542c8f9b899638dbe0dce6c19
parent684c43db2b5b0eda94c6893075146fa0e44f2f22 (diff)
parent5281f264dc605766ba82c36fc2c88055234824ff (diff)
downloadQt-120252acef2d81d0046b421ad2cc1455975c0052.zip
Qt-120252acef2d81d0046b421ad2cc1455975c0052.tar.gz
Qt-120252acef2d81d0046b421ad2cc1455975c0052.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r--src/gui/painting/qbackingstore.cpp5
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp28
2 files changed, 32 insertions, 1 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 0f7933c..3bbdf7f 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -258,7 +258,10 @@ void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn)
bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget)
{
const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
- return windowSurface->scroll(QRect(pos, rect.size()), dx, dy);
+ const QRect tlwRect(QRect(pos, rect.size()));
+ if (dirty.intersects(tlwRect))
+ return false; // We don't want to scroll junk.
+ return windowSurface->scroll(tlwRect, dx, dy);
}
void QWidgetBackingStore::releaseBuffer()
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index a6458a5..e65fef1 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -252,6 +252,7 @@ private slots:
void moveChild_data();
void moveChild();
+ void showAndMoveChild();
void subtractOpaqueSiblings();
@@ -5303,6 +5304,33 @@ void tst_QWidget::moveChild()
parent.color);
}
+void tst_QWidget::showAndMoveChild()
+{
+ QWidget parent(0, Qt::FramelessWindowHint);
+ parent.resize(300, 300);
+ parent.setPalette(Qt::red);
+ parent.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&parent);
+#endif
+ QTest::qWait(200);
+
+ const QPoint tlwOffset = parent.geometry().topLeft();
+ QWidget child(&parent);
+ child.resize(100, 100);
+ child.setPalette(Qt::blue);
+ child.setAutoFillBackground(true);
+
+ // Ensure that the child is repainted correctly when moved right after show.
+ // NB! Do NOT processEvents() (or qWait()) in between show() and move().
+ child.show();
+ child.move(150, 150);
+ qApp->processEvents();
+
+ VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue);
+ VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red);
+}
+
void tst_QWidget::subtractOpaqueSiblings()
{
#ifdef QT_MAC_USE_COCOA