summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-03-12 17:16:35 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-12 17:33:15 +0100
commitcf36e571eea0c1befda2abfe2a177ee9f7fc2912 (patch)
tree1684556873d0258b0e44e9584a4b9f477d581d02 /src/plugins/platforms
parent6e278b868824db8e24b68d48fa0f6e154de1b2f6 (diff)
Windows: Implement QWindowsIntegration::queryKeyboardModifiers()
Use code from Qt 4.8. Change-Id: I32d220e04d13ee1e692c0c58268b827bcf519dc7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h2
4 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index d03abe1d93..3c2ece58d0 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -56,6 +56,7 @@
#include "qwindowsdrag.h"
#include "qwindowsinputcontext.h"
#include "qwindowsaccessibility.h"
+#include "qwindowskeymapper.h"
#include <QtGui/QPlatformNativeInterface>
#include <QtGui/QWindowSystemInterface>
@@ -321,6 +322,11 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
return QPlatformIntegration::styleHint(hint);
}
+Qt::KeyboardModifiers QWindowsIntegration::queryKeyboardModifiers() const
+{
+ return QWindowsKeyMapper::queryKeyboardModifiers();
+}
+
QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const
{
return &d->m_nativeInterface;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index ba5fafbbb5..6dd65a02e4 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -73,6 +73,8 @@ public:
QPlatformServices *services() const;
virtual QVariant styleHint(StyleHint hint) const;
+ virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
+
static QWindowsIntegration *instance();
inline void emitScreenAdded(QPlatformScreen *s) { screenAdded(s); }
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 7b96603c44..4b5e95824a 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1072,4 +1072,16 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
return result;
}
+Qt::KeyboardModifiers QWindowsKeyMapper::queryKeyboardModifiers()
+{
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+ if (GetKeyState(VK_SHIFT) < 0)
+ modifiers |= Qt::ShiftModifier;
+ if (GetKeyState(VK_CONTROL) < 0)
+ modifiers |= Qt::ControlModifier;
+ if (GetKeyState(VK_MENU) < 0)
+ modifiers |= Qt::AltModifier;
+ return modifiers;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index 483ff57942..b549422966 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -69,6 +69,8 @@ public:
QWindow *keyGrabber() const { return m_keyGrabber; }
void setKeyGrabber(QWindow *w) { m_keyGrabber = w; }
+ static Qt::KeyboardModifiers queryKeyboardModifiers();
+
private:
bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab);
void updateKeyMap(const MSG &msg);