summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qwindowsxpstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qwindowsxpstyle.cpp')
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index a24f42c5f1..5aab69983c 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -339,7 +339,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
// Find top level with native window (there might be dialogs that do not have one).
foreach (const QWidget *toplevel, QApplication::topLevelWidgets())
- if (toplevel->windowHandle())
+ if (toplevel->windowHandle() && toplevel->windowHandle()->handle())
if (const HWND topLevelHwnd = QApplicationPrivate::getHWNDForWidget(toplevel))
return topLevelHwnd;
@@ -698,7 +698,10 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
}
// Draw on backing store DC only for real widgets.
- const bool useFallback = !themeData.widget || painter->device()->devType() != QInternal::Widget
+ // 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)