diff options
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 37 |
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); |