summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-03-11 15:25:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-18 21:59:43 +0100
commit2fa3d365ac60aba43ad09e5239ec61d740c8704d (patch)
tree5d16e755161921e64e75f3321f19bea9848aa0dc
parent8d720bff2d2da6a607d0f985376a9e5e2029b718 (diff)
Windows: Fix class name generation for Qt Quick Controls.
New combinations of settings need to be handled (for example, GL + drop shadows for menus). Generate the class name depending on style settings. Introduce new dynamic property for drop shadows. Change-Id: I438f7bdd87f09d3c99076ebf825a12d862948ec1 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp81
1 files changed, 39 insertions, 42 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index f824666a54..7e6b55dead 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -368,56 +368,53 @@ void QWindowsContext::setKeyGrabber(QWindow *w)
}
// Window class registering code (from qapplication_win.cpp)
-// If 0 is passed as the widget pointer, register a window class
-// for QWidget as default. This is used in QGLTemporaryContext
-// during GL initialization, where we don't want to use temporary
-// QWidgets or QGLWidgets, neither do we want to have separate code
-// to register window classes.
QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
{
- const Qt::WindowFlags flags = w ? w->flags() : (Qt::WindowFlags)0;
+ Q_ASSERT(w);
+ const Qt::WindowFlags flags = w->flags();
const Qt::WindowFlags type = flags & Qt::WindowType_Mask;
-
- uint style = 0;
- bool icon = false;
- QString cname = QStringLiteral("Qt5");
- if (w && isGL) {
- cname += QStringLiteral("QGLWindow");
- style = CS_DBLCLKS|CS_OWNDC;
- icon = true;
- } else if (w && (flags & Qt::MSWindowsOwnDC)) {
- cname += QStringLiteral("QWindowOwnDC");
- style = CS_DBLCLKS|CS_OWNDC;
- icon = true;
- } else if (w && (type == Qt::Tool || type == Qt::ToolTip)) {
- style = CS_DBLCLKS;
- if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) {
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
- style |= CS_DROPSHADOW;
- }
- cname += QStringLiteral("QToolTip");
- } else {
- cname += QStringLiteral("QTool");
- }
- style |= CS_SAVEBITS;
- icon = false;
- } else if (w && (type == Qt::Popup)) {
- cname += QStringLiteral("QPopup");
- style = CS_DBLCLKS|CS_SAVEBITS;
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
- style |= CS_DROPSHADOW;
+ // Determine style and icon.
+ uint style = CS_DBLCLKS;
+ bool icon = true;
+ if (isGL || (flags & Qt::MSWindowsOwnDC))
+ style |= CS_OWNDC;
+ if ((QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
+ && (type == Qt::Popup || w->property("_q_windowsDropShadow").toBool())) {
+ style |= CS_DROPSHADOW;
+ }
+ if (type == Qt::Tool || type == Qt::ToolTip || type == Qt::Popup) {
+ style |= CS_SAVEBITS; // Save/restore background
icon = false;
- } else {
- cname += QStringLiteral("QWindow");
- style = CS_DBLCLKS;
- icon = true;
}
+ // Create a unique name for the flag combination
+ QString cname = QStringLiteral("Qt5QWindow");
+ switch (type) {
+ case Qt::Tool:
+ cname += QStringLiteral("Tool");
+ break;
+ case Qt::ToolTip:
+ cname += QStringLiteral("ToolTip");
+ break;
+ case Qt::Popup:
+ cname += QStringLiteral("Popup");
+ break;
+ default:
+ break;
+ }
+ if (isGL)
+ cname += QStringLiteral("GL");
+ if (style & CS_DROPSHADOW)
+ cname += QStringLiteral("DropShadow");
+ if (style & CS_SAVEBITS)
+ cname += QStringLiteral("SaveBits");
+ if (style & CS_OWNDC)
+ cname += QStringLiteral("OwnDC");
+ if (icon)
+ cname += QStringLiteral("Icon");
HBRUSH brush = 0;
- if (w && !isGL)
+ if (!isGL)
brush = GetSysColorBrush(COLOR_WINDOW);
return registerWindowClass(cname, qWindowsWndProc, style, brush, icon);
}