diff options
author | Chris Colbert <sccolbert@gmail.com> | 2013-12-01 16:47:30 -0500 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-04 15:59:05 +0100 |
commit | 6060dab13a3b3d0c3c5c3d45a1eb3273fb753313 (patch) | |
tree | 9433fefb8f13b52fe0cb7658531c7a24d7d0b31c /tests/auto/widgets | |
parent | 26cf0f0d5a81907b5ee5c4ffb3aeb13c6d681d89 (diff) |
Fix issue where revealed widget children do not receive paint event.
When a child of a widget is spontaneously revealed due to a call to
the parent 'resize' method, the child will not receive a paint event
if it has the WA_StaticContents and WA_OpaquePaintEvent flags set.
This is caused by the backing store being pre-emptively resized by the
call to setGeometry_sys, which causes QWidgetBackingStore::sync to skip
the block which handles the static contents.
There doesn't appear to be any reason to preemptively resize the backing
store, since it is always resized as-needed during the the 'sync' method.
This change-set removes the code which preemptively resizes the backing
store.
Task-number: QTBUG-35282
Change-Id: Ie9942854ca5322dfe0f98ed8100810161576be80
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 21e0286086..dd3d041f56 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -441,6 +441,8 @@ private slots: void mouseDoubleClickBubbling_QTBUG29680(); void largerThanScreen_QTBUG30142(); + void resizeStaticContentsChildWidget_QTBUG35282(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10220,5 +10222,26 @@ void tst_QWidget::largerThanScreen_QTBUG30142() QVERIFY(widget2.frameGeometry().x() >= 0); } +void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282() +{ + QWidget widget; + widget.resize(200,200); + + UpdateWidget childWidget(&widget); + childWidget.setAttribute(Qt::WA_StaticContents); + childWidget.setAttribute(Qt::WA_OpaquePaintEvent); + childWidget.setGeometry(250, 250, 500, 500); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(childWidget.numPaintEvents == 0); + childWidget.reset(); + + widget.resize(1000,1000); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QGuiApplication::sync(); + QVERIFY(childWidget.numPaintEvents >= 1); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |