AntiMicroX
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes
AntKeyMapper Class Reference

Singleton facade for platform key mapping selection. More...

#include <antkeymapper.h>

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

Public Member Functions

void deleteInstance ()
 
int returnVirtualKey (int qkey)
 Translate a Qt key to a platform virtual key code.
 
int returnQtKey (int key, int scancode=0)
 Translate a platform virtual key to a Qt key.
 
bool isModifierKey (int qkey)
 Check if a given Qt key is treated as a modifier key.
 
QtKeyMapperBasegetNativeKeyMapper () const
 
QtKeyMapperBasegetKeyMapper () const
 
bool hasNativeKeyMapper ()
 

Static Public Member Functions

static AntKeyMappergetInstance (QString handler="")
 Obtain the singleton instance.
 

Static Protected Attributes

static AntKeyMapper_instance = nullptr
 

Private Member Functions

 AntKeyMapper (QString handler="", QObject *parent=nullptr)
 

Private Attributes

QtKeyMapperBaseinternalMapper
 
QtKeyMapperBasenativeKeyMapper
 

Detailed Description

Singleton facade for platform key mapping selection.

AntKeyMapper chooses and exposes an appropriate platform-specific key mapper implementation (a subclass of QtKeyMapperBase) based on the selected event generator (e.g. "xtest", "uinput" or "sendinput"). It provides convenient wrappers to translate between Qt keys and platform virtual keys and to query whether a native mapper is available.

Constructor & Destructor Documentation

◆ AntKeyMapper()

AntKeyMapper::AntKeyMapper ( QString  handler = "",
QObject *  parent = nullptr 
)
explicitprivate

Member Function Documentation

◆ deleteInstance()

void AntKeyMapper::deleteInstance ( )

◆ getInstance()

AntKeyMapper * AntKeyMapper::getInstance ( QString  handler = "")
static

Obtain the singleton instance.

Parameters
handlerName of the backend handler to use (must be one of the supported event generators). If an instance does not yet exist it will be created using this handler.
Returns
Pointer to the global AntKeyMapper instance.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKeyMapper()

QtKeyMapperBase * AntKeyMapper::getKeyMapper ( ) const
Here is the caller graph for this function:

◆ getNativeKeyMapper()

QtKeyMapperBase * AntKeyMapper::getNativeKeyMapper ( ) const
Here is the caller graph for this function:

◆ hasNativeKeyMapper()

bool AntKeyMapper::hasNativeKeyMapper ( )

◆ isModifierKey()

bool AntKeyMapper::isModifierKey ( int  qkey)

Check if a given Qt key is treated as 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:

◆ returnQtKey()

int AntKeyMapper::returnQtKey ( int  key,
int  scancode = 0 
)

Translate a platform virtual key to a Qt key.

Parameters
keyPlatform virtual key code
scancodeOptional scancode used by some backends
Returns
Qt::Key_* value (or 0 if no mapping exists)
Here is the call graph for this function:

◆ returnVirtualKey()

int AntKeyMapper::returnVirtualKey ( int  qkey)

Translate a Qt key to a platform virtual key code.

Parameters
qkeyQt::Key_* value
Returns
Platform virtual key (or 0 if no mapping exists)
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _instance

AntKeyMapper * AntKeyMapper::_instance = nullptr
staticprotected

◆ internalMapper

QtKeyMapperBase* AntKeyMapper::internalMapper
private

Active mapper used by the app

◆ nativeKeyMapper

QtKeyMapperBase* AntKeyMapper::nativeKeyMapper
private

Optional native mapper for low-level queries


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