summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
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/dialogs
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/dialogs')
-rw-r--r--src/widgets/dialogs/dialogs.pri4
-rw-r--r--src/widgets/dialogs/qfiledialog_win.cpp9
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp28
3 files changed, 27 insertions, 14 deletions
diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri
index 472787a20c..fdbca9122f 100644
--- a/src/widgets/dialogs/dialogs.pri
+++ b/src/widgets/dialogs/dialogs.pri
@@ -50,6 +50,8 @@ HEADERS += \
}
win32 {
+ qpa:DEFINES += QT_NO_PRINTDIALOG
+
HEADERS += dialogs/qwizard_win_p.h \
dialogs/qfiledialog_win_p.h
SOURCES += dialogs/qdialogsbinarycompat_win.cpp \
@@ -61,7 +63,7 @@ win32 {
!win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library
}
-!mac:!symbian:unix|qpa {
+!mac:!symbian:unix|qpa:!win32 {
HEADERS += dialogs/qpagesetupdialog_unix_p.h
SOURCES += dialogs/qprintdialog_unix.cpp \
dialogs/qpagesetupdialog_unix.cpp
diff --git a/src/widgets/dialogs/qfiledialog_win.cpp b/src/widgets/dialogs/qfiledialog_win.cpp
index de8e33d897..cdf8cd39cf 100644
--- a/src/widgets/dialogs/qfiledialog_win.cpp
+++ b/src/widgets/dialogs/qfiledialog_win.cpp
@@ -54,6 +54,7 @@
#include <qstringlist.h>
#include <private/qsystemlibrary_p.h>
#include "qfiledialog_win_p.h"
+#include "qplatformnativeinterface_qpa.h"
#ifndef QT_NO_THREAD
# include <private/qmutexpool_p.h>
@@ -217,7 +218,7 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
memset(ofn, 0, sizeof(OPENFILENAME));
ofn->lStructSize = sizeof(OPENFILENAME);
- ofn->hwndOwner = parent ? parent->winId() : 0;
+ ofn->hwndOwner = QApplicationPrivate::getHWNDForWidget(parent);
ofn->lpstrFilter = (wchar_t*)tFilters.utf16();
ofn->lpstrFile = tInitSel;
ofn->nMaxFile = maxLen;
@@ -522,7 +523,7 @@ static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args,
else
parentWindow = QApplication::activeWindow();
// Show the file dialog.
- hr = pfd->Show(parentWindow ? parentWindow->winId() : 0);
+ hr = pfd->Show(QApplicationPrivate::getHWNDForWidget(parentWindow));
if (SUCCEEDED(hr)) {
// Retrieve the results.
IShellItemArray *psiaResults;
@@ -611,7 +612,7 @@ QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args)
parentWindow = QApplication::activeWindow();
// Show the file dialog.
- hr = pfd->Show(parentWindow ? parentWindow->winId() : 0);
+ hr = pfd->Show(QApplicationPrivate::getHWNDForWidget(parentWindow));
if (SUCCEEDED(hr)) {
// Retrieve the result
IShellItem *psi = 0;
@@ -786,7 +787,7 @@ QString qt_win_get_existing_directory(const QFileDialogArgs &args)
qt_BROWSEINFO bi;
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
- bi.hwndOwner = (parent ? parent->winId() : 0);
+ bi.hwndOwner = QApplicationPrivate::getHWNDForWidget(parent);
bi.pidlRoot = NULL;
//### This does not seem to be respected? - the dialog always displays "Browse for folder"
bi.lpszTitle = (wchar_t*)tTitle.utf16();
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 32fc3dfe46..ab59e0109a 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -44,6 +44,8 @@
#include "qwizard_win_p.h"
#include <private/qsystemlibrary_p.h>
+#include <private/qapplication_p.h>
+#include "qplatformnativeinterface_qpa.h"
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
@@ -286,7 +288,8 @@ QVistaHelper::VistaState QVistaHelper::vistaState()
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
- HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW");
+ HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
+ HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
pGetThemeColor(
hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE,
wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT,
@@ -306,7 +309,8 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
mar.cyTopHeight = 0;
else
mar.cyTopHeight = titleBarSize() + topOffset();
- HRESULT hr = pDwmExtendFrameIntoClientArea(wizard->winId(), &mar);
+ HWND wizardHandle = QApplicationPrivate::getHWNDForWidget(wizard);
+ HRESULT hr = pDwmExtendFrameIntoClientArea(wizardHandle, &mar);
value = SUCCEEDED(hr);
}
return value;
@@ -314,7 +318,7 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
void QVistaHelper::drawTitleBar(QPainter *painter)
{
- HDC hdc = painter->paintEngine()->getDC();
+ HDC hdc = static_cast<QRasterPaintEngine *>(painter->paintEngine())->getDC();
if (vistaState() == VistaAero)
drawBlackRect(QRect(0, 0, wizard->width(),
@@ -360,7 +364,8 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
opt.dwMask = 0;
else
opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
- pSetWindowThemeAttribute(wizard->winId(), WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
+ HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
+ pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
}
}
@@ -437,7 +442,8 @@ void QVistaHelper::setWindowPosHack()
const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE
const int w = wizard->width();
const int h = wizard->height();
- SetWindowPos(wizard->winId(), 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
+ HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
+ SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
// The following hack allows any QWidget subclass to access
@@ -575,7 +581,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- msg.hwnd = wizard->winId();
+ HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
+ msg.hwnd = handle;
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCMOUSEMOVE;
@@ -587,7 +594,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- msg.hwnd = wizard->winId();
+ HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
+ msg.hwnd = handle;
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONDOWN;
@@ -599,7 +607,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- msg.hwnd = wizard->winId();
+ HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
+ msg.hwnd = handle;
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONUP;
@@ -628,7 +637,8 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
{
bool value = false;
if (vistaState() == VistaAero) {
- HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW");
+ HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
+ HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
if (!hTheme) return false;
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;