AntiMicroX
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
QtKeyMapperBase Class Referenceabstract

Base class for platform-specific Qt key mappers. More...

#include <qtkeymapperbase.h>

Inheritance diagram for QtKeyMapperBase:
[legend]
Collaboration diagram for QtKeyMapperBase:
[legend]

Data Structures

struct  _charKeyInformation
 Information about a printable character key. More...
 

Public Types

enum  {
  AntKey_Shift_R = Qt::Key_Shift | customQtKeyPrefix , AntKey_Control_R = Qt::Key_Control | customQtKeyPrefix , AntKey_Shift_Lock = 0xffe6 | customKeyPrefix , AntKey_Meta_R = Qt::Key_Meta | customQtKeyPrefix ,
  AntKey_Alt_R = Qt::Key_Alt | customQtKeyPrefix , AntKey_KP_Divide = Qt::Key_Slash | customQtKeyPrefix , AntKey_KP_Multiply = Qt::Key_Asterisk | customQtKeyPrefix , AntKey_KP_Subtract = Qt::Key_Minus | customQtKeyPrefix ,
  AntKey_KP_Add = Qt::Key_Plus | customQtKeyPrefix , AntKey_KP_Decimal = Qt::Key_Period | customQtKeyPrefix , AntKey_KP_Insert = Qt::Key_Insert | customQtKeyPrefix , AntKey_Delete = Qt::Key_Delete | customQtKeyPrefix ,
  AntKey_KP_Delete = 0xff9f | customKeyPrefix , AntKey_KP_End = Qt::Key_End | customQtKeyPrefix , AntKey_KP_Down = Qt::Key_Down | customQtKeyPrefix , AntKey_KP_Prior = Qt::Key_PageUp | customQtKeyPrefix ,
  AntKey_KP_Left = Qt::Key_Left | customQtKeyPrefix , AntKey_KP_Begin = Qt::Key_Clear | customQtKeyPrefix , AntKey_KP_Right = Qt::Key_Right | customQtKeyPrefix , AntKey_KP_Home = Qt::Key_Home | customQtKeyPrefix ,
  AntKey_KP_Up = Qt::Key_Up | customQtKeyPrefix , AntKey_KP_Next = Qt::Key_PageDown | customQtKeyPrefix , AntKey_KP_Enter = 0xff8d | customKeyPrefix , AntKey_KP_0 = 0xffb0 | customKeyPrefix ,
  AntKey_KP_1 = 0xffb1 | customKeyPrefix , AntKey_KP_2 = 0xffb2 | customKeyPrefix , AntKey_KP_3 = 0xffb3 | customKeyPrefix , AntKey_KP_4 = 0xffb4 | customKeyPrefix ,
  AntKey_KP_5 = 0xffb5 | customKeyPrefix , AntKey_KP_6 = 0xffb6 | customKeyPrefix , AntKey_KP_7 = 0xffb7 | customKeyPrefix , AntKey_KP_8 = 0xffb8 | customKeyPrefix ,
  AntKey_KP_9 = 0xffb9 | customKeyPrefix
}
 
typedef struct QtKeyMapperBase::_charKeyInformation charKeyInformation
 Information about a printable character key.
 

Public Member Functions

 QtKeyMapperBase (QObject *parent=nullptr)
 
virtual int returnVirtualKey (int qkey)
 Get platform virtual key for a given Qt key.
 
virtual int returnQtKey (int key, int scancode=0)
 Get Qt key for a given platform virtual key.
 
virtual bool isModifier (int qkey)
 Check whether the given Qt key is a modifier key.
 
charKeyInformation getCharKeyInformation (QChar value)
 Get key information (virtual key + modifiers) for a character.
 
QString getIdentifier ()
 Identifier string for this mapper implementation.
 

Static Public Attributes

static const int customQtKeyPrefix = 0x10000000
 
static const int customKeyPrefix = 0x20000000
 
static const int nativeKeyPrefix = 0x60000000
 

Protected Member Functions

virtual void populateMappingHashes ()=0
 Populate the Qt <-> platform virtual key mappings. Implementations must fill qtKeyToVirtKeyHash (Qt -> VK) and virtKeyToQtKeyHash (VK -> Qt).
 
virtual void populateCharKeyInformation ()=0
 Populate virtkeyToCharKeyInfo with character -> VK+modifier info.
 

Protected Attributes

QHash< int, intqtKeyToVirtKeyHash
 
QHash< int, intvirtKeyToQtKeyHash
 
QHash< int, charKeyInformationvirtkeyToCharKeyInfo
 
QString identifier
 

Detailed Description

Base class for platform-specific Qt key mappers.

QtKeyMapperBase provides an abstract API for mapping between Qt key constants (Qt::Key_*) and platform-specific virtual key codes (for example X11 keysyms). Subclasses implement the mapping population and character information routines and use the provided hash tables to perform lookups.

Typical usage:

Member Typedef Documentation

◆ charKeyInformation

Information about a printable character key.

Contains the required Qt modifiers to produce the character and the platform virtual keycode that generates it.

Member Enumeration Documentation

◆ anonymous enum

Synthetic/custom key values used within the codebase.

Enumerator
AntKey_Shift_R 
AntKey_Control_R 
AntKey_Shift_Lock 
AntKey_Meta_R 
AntKey_Alt_R 
AntKey_KP_Divide 
AntKey_KP_Multiply 
AntKey_KP_Subtract 
AntKey_KP_Add 
AntKey_KP_Decimal 
AntKey_KP_Insert 
AntKey_Delete 
AntKey_KP_Delete 
AntKey_KP_End 
AntKey_KP_Down 
AntKey_KP_Prior 
AntKey_KP_Left 
AntKey_KP_Begin 
AntKey_KP_Right 
AntKey_KP_Home 
AntKey_KP_Up 
AntKey_KP_Next 
AntKey_KP_Enter 
AntKey_KP_0 
AntKey_KP_1 
AntKey_KP_2 
AntKey_KP_3 
AntKey_KP_4 
AntKey_KP_5 
AntKey_KP_6 
AntKey_KP_7 
AntKey_KP_8 
AntKey_KP_9 

Constructor & Destructor Documentation

◆ QtKeyMapperBase()

QtKeyMapperBase::QtKeyMapperBase ( QObject *  parent = nullptr)
explicit

Member Function Documentation

◆ getCharKeyInformation()

QtKeyMapperBase::charKeyInformation QtKeyMapperBase::getCharKeyInformation ( QChar  value)

Get key information (virtual key + modifiers) for a character.

Parameters
valueUnicode character to query
Returns
charKeyInformation with modifier flags and virtual key; if not found, a struct with virtualkey == 0 and NoModifier is returned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIdentifier()

QString QtKeyMapperBase::getIdentifier ( )

Identifier string for this mapper implementation.

Obtain identifier string for key mapper.

Returns
Identifier (e.g. "xtest").
Identifier string.
Here is the caller graph for this function:

◆ isModifier()

bool QtKeyMapperBase::isModifier ( int  qkey)
virtual

Check whether the given Qt key is a modifier key.

Parameters
qkeyQt key value
Returns
true if the key is a modifier (Shift, Control, Alt, Meta)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateCharKeyInformation()

virtual void QtKeyMapperBase::populateCharKeyInformation ( )
protectedpure virtual

Populate virtkeyToCharKeyInfo with character -> VK+modifier info.

Implemented in QtUInputKeyMapper, QtVMultiKeyMapper, QtWinKeyMapper, and QtX11KeyMapper.

◆ populateMappingHashes()

virtual void QtKeyMapperBase::populateMappingHashes ( )
protectedpure virtual

Populate the Qt <-> platform virtual key mappings. Implementations must fill qtKeyToVirtKeyHash (Qt -> VK) and virtKeyToQtKeyHash (VK -> Qt).

Implemented in QtUInputKeyMapper, QtVMultiKeyMapper, QtWinKeyMapper, and QtX11KeyMapper.

◆ returnQtKey()

int QtKeyMapperBase::returnQtKey ( int  key,
int  scancode = 0 
)
virtual

Get Qt key for a given platform virtual key.

Parameters
keyPlatform virtual key code
scancodeOptional scancode (unused by default)
Returns
Qt::Key_* value, or 0 if unmapped.

Reimplemented in QtWinKeyMapper.

Here is the caller graph for this function:

◆ returnVirtualKey()

int QtKeyMapperBase::returnVirtualKey ( int  qkey)
virtual

Get platform virtual key for a given Qt key.

Parameters
qkeyQt::Key_* value (may include custom prefixes)
Returns
Platform virtual key code, or 0 if unmapped.
Here is the caller graph for this function:

Field Documentation

◆ customKeyPrefix

const int QtKeyMapperBase::customKeyPrefix = 0x20000000
static

◆ customQtKeyPrefix

const int QtKeyMapperBase::customQtKeyPrefix = 0x10000000
static

Prefix values for constructing custom key values.

◆ identifier

QString QtKeyMapperBase::identifier
protected

Short identifier for this mapper (set by subclasses)

◆ nativeKeyPrefix

const int QtKeyMapperBase::nativeKeyPrefix = 0x60000000
static

◆ qtKeyToVirtKeyHash

QHash<int, int> QtKeyMapperBase::qtKeyToVirtKeyHash
protected

Map from Qt key to platform virtual key

◆ virtkeyToCharKeyInfo

QHash<int, charKeyInformation> QtKeyMapperBase::virtkeyToCharKeyInfo
protected

Unicode code point -> charKeyInformation (VK + modifiers)

◆ virtKeyToQtKeyHash

QHash<int, int> QtKeyMapperBase::virtKeyToQtKeyHash
protected

Map from platform virtual key to Qt key


The documentation for this class was generated from the following files: