summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_qpa.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2012-07-03 12:19:38 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-03 13:31:20 +0200
commit3037525530fa47c35cdcb492bf3e42d36e85e6c3 (patch)
tree3675db05e4bbda1e39090ee9068a0d2f42757050 /src/widgets/kernel/qwidget_qpa.cpp
parent8ccab9b029ed2a2444d89a9cfc6c4a1866b8e82d (diff)
revive the noPaintOnScreen fix on Windows
The original commit message follows. Fixes: Fix the windows PaintOnScreen issue once and for all Details: To allow both the case where X11 people accidentally set PaintOnScreen (which should not have any effect on windows) and where people set it and subclass with paintEngine() { return 0 } to use GDI / DirectX we do this rather nasty hack. Original commit in Qt4: 07a2f68bd5869152471e4ffc4a63c683ef141ae8 Autotest: tst_QWidget::paintOnScreenPossible Change-Id: Ifbb7dc4611959be3ecc362c29a1c3436b0e0fa82 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index c524491d22..ef3d7a16d9 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -980,6 +980,25 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
QPaintEngine *QWidget::paintEngine() const
{
qWarning("QWidget::paintEngine: Should no longer be called");
+
+#ifdef Q_OS_WIN
+ // We set this bit which is checked in setAttribute for
+ // Qt::WA_PaintOnScreen. We do this to allow these two scenarios:
+ //
+ // 1. Users accidentally set Qt::WA_PaintOnScreen on X and port to
+ // Windows which would mean suddenly their widgets stop working.
+ //
+ // 2. Users set paint on screen and subclass paintEngine() to
+ // return 0, in which case we have a "hole" in the backingstore
+ // allowing use of GDI or DirectX directly.
+ //
+ // 1 is WRONG, but to minimize silent failures, we have set this
+ // bit to ignore the setAttribute call. 2. needs to be
+ // supported because its our only means of embedding native
+ // graphics stuff.
+ const_cast<QWidgetPrivate *>(d_func())->noPaintOnScreen = 1;
+#endif
+
return 0; //##### @@@
}