Added possibleKeys(QKeyEvent *) to QWindowsIntegration
Task-number: QTBUG-26902 Change-Id: I08d244816eae8794b52f244f049ee1fb825dac8b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
889444b403
commit
9e44b76093
@ -331,6 +331,11 @@ bool QWindowsContext::useRTLExtensions() const
|
|||||||
return d->m_keyMapper.useRTLExtensions();
|
return d->m_keyMapper.useRTLExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<int> QWindowsContext::possibleKeys(const QKeyEvent *e) const
|
||||||
|
{
|
||||||
|
return d->m_keyMapper.possibleKeys(e);
|
||||||
|
}
|
||||||
|
|
||||||
void QWindowsContext::setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx)
|
void QWindowsContext::setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx)
|
||||||
{
|
{
|
||||||
d->m_creationContext = ctx;
|
d->m_creationContext = ctx;
|
||||||
|
@ -60,6 +60,7 @@ class QWindowsMimeConverter;
|
|||||||
struct QWindowCreationContext;
|
struct QWindowCreationContext;
|
||||||
struct QWindowsContextPrivate;
|
struct QWindowsContextPrivate;
|
||||||
class QPoint;
|
class QPoint;
|
||||||
|
class QKeyEvent;
|
||||||
|
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
struct QWindowsUser32DLL
|
struct QWindowsUser32DLL
|
||||||
@ -170,6 +171,7 @@ public:
|
|||||||
unsigned systemInfo() const;
|
unsigned systemInfo() const;
|
||||||
|
|
||||||
bool useRTLExtensions() const;
|
bool useRTLExtensions() const;
|
||||||
|
QList<int> possibleKeys(const QKeyEvent *e) const;
|
||||||
|
|
||||||
QWindowsMimeConverter &mimeConverter() const;
|
QWindowsMimeConverter &mimeConverter() const;
|
||||||
QWindowsScreenManager &screenManager();
|
QWindowsScreenManager &screenManager();
|
||||||
|
@ -447,6 +447,11 @@ Qt::KeyboardModifiers QWindowsIntegration::queryKeyboardModifiers() const
|
|||||||
return QWindowsKeyMapper::queryKeyboardModifiers();
|
return QWindowsKeyMapper::queryKeyboardModifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<int> QWindowsIntegration::possibleKeys(const QKeyEvent *e) const
|
||||||
|
{
|
||||||
|
return d->m_context.possibleKeys(e);
|
||||||
|
}
|
||||||
|
|
||||||
QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const
|
QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const
|
||||||
{
|
{
|
||||||
return &d->m_nativeInterface;
|
return &d->m_nativeInterface;
|
||||||
|
@ -81,6 +81,7 @@ public:
|
|||||||
virtual QVariant styleHint(StyleHint hint) const;
|
virtual QVariant styleHint(StyleHint hint) const;
|
||||||
|
|
||||||
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
||||||
|
virtual QList<int> possibleKeys(const QKeyEvent *e) const;
|
||||||
|
|
||||||
static QWindowsIntegration *instance();
|
static QWindowsIntegration *instance();
|
||||||
|
|
||||||
|
@ -1119,4 +1119,30 @@ Qt::KeyboardModifiers QWindowsKeyMapper::queryKeyboardModifiers()
|
|||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
|
||||||
|
{
|
||||||
|
QList<int> result;
|
||||||
|
|
||||||
|
KeyboardLayoutItem *kbItem = keyLayout[e->nativeVirtualKey()];
|
||||||
|
if (!kbItem)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
quint32 baseKey = kbItem->qtKey[0];
|
||||||
|
Qt::KeyboardModifiers keyMods = e->modifiers();
|
||||||
|
if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) {
|
||||||
|
result << int(Qt::Key_Enter + keyMods);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result << int(baseKey + keyMods); // The base key is _always_ valid, of course
|
||||||
|
|
||||||
|
for (int i = 1; i < 9; ++i) {
|
||||||
|
Qt::KeyboardModifiers neededMods = ModsTbl[i];
|
||||||
|
quint32 key = kbItem->qtKey[i];
|
||||||
|
if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
|
||||||
|
result << int(key + (keyMods & ~neededMods));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QKeyEvent;
|
||||||
class QWindow;
|
class QWindow;
|
||||||
|
|
||||||
struct KeyboardLayoutItem;
|
struct KeyboardLayoutItem;
|
||||||
@ -70,6 +71,7 @@ public:
|
|||||||
void setKeyGrabber(QWindow *w) { m_keyGrabber = w; }
|
void setKeyGrabber(QWindow *w) { m_keyGrabber = w; }
|
||||||
|
|
||||||
static Qt::KeyboardModifiers queryKeyboardModifiers();
|
static Qt::KeyboardModifiers queryKeyboardModifiers();
|
||||||
|
QList<int> possibleKeys(const QKeyEvent *e) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab);
|
bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user