summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorOlli Werwolff <qt-info@nokia.com>2011-07-07 09:07:19 +0200
committerOliver Wolff <oliver.wolff@nokia.com>2011-07-07 14:20:07 +0200
commitf9f04ea63d2489bd2ecb91c5a6bee4c4a869ac20 (patch)
tree5914b51c5bbe09f7e191d3a4d6ae52092225697f /src/widgets/styles
parentd677aac93443a8e57955e4a0b9f09368090f6848 (diff)
Use PlatformNativeInterface to obtain handles
Change-Id: I8cdf3d5477e72e89bcde46ccb6670320bf4dd797 Reviewed-on: http://codereview.qt.nokia.com/1270 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp5
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp37
2 files changed, 35 insertions, 7 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index da484bafe1..55e83f79fa 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -43,6 +43,8 @@
#include "qwindowsvistastyle_p.h"
#include <private/qstylehelper_p.h>
#include <private/qsystemlibrary_p.h>
+#include <private/qapplication_p.h>
+#include <qplatformnativeinterface_qpa.h>
#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
@@ -2606,7 +2608,8 @@ QWidget *QWindowsVistaStylePrivate::treeViewHelper()
{
if (!m_treeViewHelper) {
m_treeViewHelper = new QWidget(0);
- pSetWindowTheme(m_treeViewHelper->winId(), L"explorer", NULL);
+ HWND handle = QApplicationPrivate::getHWNDForWidget(m_treeViewHelper);
+ pSetWindowTheme(handle, L"explorer", NULL);
}
return m_treeViewHelper;
}
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 83d47db20f..36e0852462 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -46,6 +46,7 @@
#include <private/qobject_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qapplication_p.h>
+#include <qplatformnativeinterface_qpa.h>
#include <private/qstylehelper_p.h>
#include <private/qwidget_p.h>
#include <private/qsystemlibrary_p.h>
@@ -295,9 +296,10 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
*/
HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
{
- if (widget && widget->internalWinId())
- return widget->internalWinId();
-
+ if (widget && widget->internalWinId()) {
+ QWidget *w = const_cast<QWidget *>(widget);
+ return QApplicationPrivate::getHWNDForWidget(w);
+ }
if (!limboWidget) {
limboWidget = new QWidget(0);
limboWidget->createWinId();
@@ -307,7 +309,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
QWidgetPrivate::allWidgets->remove(limboWidget);
}
- return limboWidget->winId();
+ return QApplicationPrivate::getHWNDForWidget(limboWidget);
}
/*! \internal
@@ -466,8 +468,31 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData)
QRegion region;
- if (success)
- region = qt_region_from_HRGN(dest);
+ if (success) {
+ int numBytes = GetRegionData(dest, 0, 0);
+ if (numBytes == 0)
+ return QRegion();
+
+ char *buf = new char[numBytes];
+ if (buf == 0)
+ return QRegion();
+
+ RGNDATA *rd = reinterpret_cast<RGNDATA*>(buf);
+ if (GetRegionData(dest, numBytes, rd) == 0) {
+ delete [] buf;
+ return QRegion();
+ }
+
+ RECT *r = reinterpret_cast<RECT*>(rd->Buffer);
+ for (uint i = 0; i < rd->rdh.nCount; ++i) {
+ QRect rect;
+ rect.setCoords(r->left, r->top, r->right - 1, r->bottom - 1);
+ ++r;
+ region |= rect;
+ }
+
+ delete [] buf;
+ }
DeleteObject(hRgn);
DeleteObject(dest);