KModifierKeyInfo

Search for usage in LXR

KModifierKeyInfo Class Reference

#include <KModifierKeyInfo>

Inheritance diagram for KModifierKeyInfo:

Signals

void buttonPressed (Qt::MouseButton button, bool pressed)
 
void keyAdded (Qt::Key key)
 
void keyLatched (Qt::Key key, bool latched)
 
void keyLocked (Qt::Key key, bool locked)
 
void keyPressed (Qt::Key key, bool pressed)
 
void keyRemoved (Qt::Key key)
 

Public Member Functions

 KModifierKeyInfo (QObject *parent=nullptr)
 
 ~KModifierKeyInfo () override
 
bool isButtonPressed (Qt::MouseButton button) const
 
bool isKeyLatched (Qt::Key key) const
 
bool isKeyLocked (Qt::Key key) const
 
bool isKeyPressed (Qt::Key key) const
 
const QList< Qt::KeyknownKeys () const
 
bool knowsKey (Qt::Key key) const
 
bool setKeyLatched (Qt::Key key, bool latched)
 
bool setKeyLocked (Qt::Key key, bool locked)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Get information about the state of the keyboard's modifier keys.

This class provides cross-platform information about the state of the keyboard's modifier keys and the mouse buttons and allows to change the state as well.

It recognizes two states a key can be in:

  • locked: eg. caps-locked (a.k.a. toggled)
  • latched the key is temporarily locked but will be unlocked upon the next keypress.

An application can either query the states synchronously (isKeyLatched(), isKeyLocked()) or connect to KModifierKeyInfo's signals to be notified about changes (keyLatched(), keyLocked()).

Definition at line 35 of file kmodifierkeyinfo.h.

Constructor & Destructor Documentation

◆ KModifierKeyInfo()

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

Default constructor.

Definition at line 41 of file kmodifierkeyinfo.cpp.

◆ ~KModifierKeyInfo()

KModifierKeyInfo::~KModifierKeyInfo ( )
override

Destructor.

Definition at line 53 of file kmodifierkeyinfo.cpp.

Member Function Documentation

◆ buttonPressed

void KModifierKeyInfo::buttonPressed ( Qt::MouseButton button,
bool pressed )
signal

This signal is emitted whenever the pressed state of a mouse button changes (mouse button press or release).

Parameters
buttonThe mouse button that changed state
pressedtrue if the mouse button is now pressed, false if is released.

◆ isButtonPressed()

bool KModifierKeyInfo::isButtonPressed ( Qt::MouseButton button) const

Synchronously check if a mouse button is pressed.

Parameters
buttonThe mouse button to check
Returns
true if the mouse button is pressed, false if the mouse button is not pressed or its state is unknown.

Definition at line 92 of file kmodifierkeyinfo.cpp.

◆ isKeyLatched()

bool KModifierKeyInfo::isKeyLatched ( Qt::Key key) const

Synchronously check if a key is latched.

Parameters
keyThe key to check
Returns
true if the key is latched, false if the key is not latched or unknown.
See also
isKeyPressed,
isKeyLocked,
keyLatched

Definition at line 72 of file kmodifierkeyinfo.cpp.

◆ isKeyLocked()

bool KModifierKeyInfo::isKeyLocked ( Qt::Key key) const

Synchronously check if a key is locked.

Parameters
keyThe key to check
Returns
true if the key is locked, false if the key is not locked or unknown.
See also
isKeyPressed,
isKeyLatched,
keyLocked

Definition at line 82 of file kmodifierkeyinfo.cpp.

◆ isKeyPressed()

bool KModifierKeyInfo::isKeyPressed ( Qt::Key key) const

Synchronously check if a key is pressed.

Parameters
keyThe key to check
Returns
true if the key is pressed, false if the key is not pressed or unknown.
See also
isKeyLatched,
isKeyLocked,
keyPressed

Definition at line 67 of file kmodifierkeyinfo.cpp.

◆ keyAdded

void KModifierKeyInfo::keyAdded ( Qt::Key key)
signal

This signal is emitted whenever a new modifier is found due to the keyboard mapping changing.

Parameters
keyThe key that was discovered

◆ keyLatched

void KModifierKeyInfo::keyLatched ( Qt::Key key,
bool latched )
signal

This signal is emitted whenever the latched state of a key changes.

Parameters
keyThe key that changed state
latchedtrue if the key is now latched, false if it isn't

◆ keyLocked

void KModifierKeyInfo::keyLocked ( Qt::Key key,
bool locked )
signal

This signal is emitted whenever the locked state of a key changes.

Parameters
keyThe key that changed state
lockedtrue if the key is now locked, false if it isn't

◆ keyPressed

void KModifierKeyInfo::keyPressed ( Qt::Key key,
bool pressed )
signal

This signal is emitted whenever the pressed state of a key changes (key press or key release).

Parameters
keyThe key that changed state
pressedtrue if the key is now pressed, false if is released.

◆ keyRemoved

void KModifierKeyInfo::keyRemoved ( Qt::Key key)
signal

This signal is emitted whenever a previously known modifier no longer exists due to the keyboard mapping changing.

Parameters
keyThe key that vanished

◆ knownKeys()

const QList< Qt::Key > KModifierKeyInfo::knownKeys ( ) const

Get a list of known keys.

Returns
A list of known keys of which states will be reported.

Definition at line 62 of file kmodifierkeyinfo.cpp.

◆ knowsKey()

bool KModifierKeyInfo::knowsKey ( Qt::Key key) const

Check if a key is known by the underlying window system and can be queried.

Parameters
keyThe key to check
Returns
true if the key is available, false if it is unknown

Definition at line 57 of file kmodifierkeyinfo.cpp.

◆ setKeyLatched()

bool KModifierKeyInfo::setKeyLatched ( Qt::Key key,
bool latched )

Set the latched state of a key.

Parameters
keyThe key to latch
latchedtrue to latch the key, false to unlatch it.
Returns
false if the key is unknown. true doesn't guarantee you the operation worked.

Definition at line 77 of file kmodifierkeyinfo.cpp.

◆ setKeyLocked()

bool KModifierKeyInfo::setKeyLocked ( Qt::Key key,
bool locked )

Set the locked state of a key.

Parameters
keyThe key to lock
latchedtrue to lock the key, false to unlock it.
Returns
false if the key is unknown. true doesn't guarantee you the operation worked.

Definition at line 87 of file kmodifierkeyinfo.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.