summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-04-26 15:38:17 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-27 10:37:02 +0200
commit4a2942085a4d82e66b001c60e535f3a37808a0e8 (patch)
treec6197e38869ac3385b58017f1fee46bceb390f54 /src/widgets
parentbd2d0d7cbe3e743b0ba5f0e2c76cebd4f7541a03 (diff)
Windows/Vista style: Fix painting of QGroupBox.
QGroupBox in Vista style does not show a frame, currently. drawBackgroundDirectly should also be called if the paintDevice is a backing store. Task-number: QTBUG-25395 Change-Id: Ifa20802dea6c182904f68271ddd0d175007e4b0e Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 288863c478..f9b793978b 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -53,6 +53,7 @@
#include <qpainter.h>
#include <qpaintengine.h>
#include <qwidget.h>
+#include <qbackingstore.>
#include <qapplication.h>
#include <qpixmapcache.h>
@@ -708,24 +709,36 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
+ // Access paintDevice via engine since the painter may
+ // return the clip device which can still be a widget device in case of grabWidget().
+
bool translucentToplevel = false;
- QPaintDevice *pdev = painter->device();
- if (pdev->devType() == QInternal::Widget) {
- QWidget *win = ((QWidget *) pdev)->window();
- translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground);
+ const QPaintDevice *paintDevice = painter->device();
+ if (paintDevice->devType() == QInternal::Widget) {
+ const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
+ translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
}
- // Draw on backing store DC only for real widgets.
- // Access paintDevice via engine since the painter may
- // return the clip device which can still be a widget device in case of grabWidget().
- const bool useFallback = !themeData.widget
- || painter->paintEngine()->paintDevice()->devType() != QInternal::Widget
- || painter->opacity() != 1.0 || themeData.rotate
- || complexXForm || themeData.mirrorVertically
- || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
- || translucentToplevel;
- const HDC dc = useFallback ? HDC(0) : hdcForWidgetBackingStore(themeData.widget);
- if (dc && !useFallback) {
+ bool canDrawDirectly = false;
+ if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
+ && !complexXForm && !themeData.mirrorVertically
+ && (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx)
+ && !translucentToplevel) {
+ // Draw on backing store DC only for real widgets or backing store images.
+ const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice();
+ switch (enginePaintDevice->devType()) {
+ case QInternal::Widget:
+ canDrawDirectly = true;
+ break;
+ case QInternal::Image:
+ if (QBackingStore *bs = backingStoreForWidget(themeData.widget))
+ if (bs->paintDevice() == enginePaintDevice)
+ canDrawDirectly = true;
+ }
+ }
+
+ const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
+ if (dc) {
drawBackgroundDirectly(themeData);
} else {
drawBackgroundThruNativeBuffer(themeData);
@@ -1961,7 +1974,7 @@ case PE_Frame:
break;
}
- XPThemeData theme(0, p, themeNumber, partId, stateId, rect);
+ XPThemeData theme(widget, p, themeNumber, partId, stateId, rect);
if (!theme.isValid()) {
QWindowsStyle::drawPrimitive(pe, option, p, widget);
return;