All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::KeyEvent Class Reference

This class describes a key event. More...

#include <Radiant/KeyEvent.hpp>

Public Member Functions

bool isAutoRepeat () const
 Returns boolean indicating a repeating event. More...
 
int key () const
 Key code of the event (from Qt::Key) More...
 
 KeyEvent (const QKeyEvent &event)
 Constructs a new key event from a QKeyEvent. More...
 
 KeyEvent (int key, QEvent::Type type=QEvent::KeyPress, Qt::KeyboardModifiers modifiers=Qt::NoModifier, const QString &text="", bool autoRepeat=false)
 Constructs a new key event. More...
 
 KeyEvent (KeyEvent &&)=default
 
Qt::KeyboardModifiers modifiers () const
 Active keyboard modifiers. More...
 
KeyEventoperator= (KeyEvent &&)=default
 
const QKeyEvent & qKeyEvent () const
 Returns this event as QKeyEvent.
 
QString text () const
 Returns the unicode text representation of the key event. More...
 
QEvent::Type type () const
 Returns the type of the keyboard event. More...
 
virtual ~KeyEvent ()
 Destructor.
 

Static Public Member Functions

static KeyEvent createKeyPress (int key, bool isautorepeat=false)
 Creates a key press KeyEvent object with the specified key code. More...
 
static KeyEvent createKeyRelease (int key)
 Creates a key release KeyEvent object with the specified key code. More...
 

Detailed Description

This class describes a key event.

Key events are sent from virtual keyboard or actual keyboard.

Constructor & Destructor Documentation

Radiant::KeyEvent::KeyEvent ( const QKeyEvent &  event)

Constructs a new key event from a QKeyEvent.

Parameters
eventQt key event
Radiant::KeyEvent::KeyEvent ( int  key,
QEvent::Type  type = QEvent::KeyPress,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier,
const QString &  text = "",
bool  autoRepeat = false 
)

Constructs a new key event.

Parameters
keykey code of the event (from Qt::Key)
typetype of the event. Must be KeyPress or KeyRelease.
modifiersactive keyboard modifiers for the event
textUnicode representation of the text generated by the event
autoRepeatis the event generated by keyboard auto-repeat

Member Function Documentation

static KeyEvent Radiant::KeyEvent::createKeyPress ( int  key,
bool  isautorepeat = false 
)
static

Creates a key press KeyEvent object with the specified key code.

Parameters
keykey code of the event
isautorepeatis the event generated by keyboard auto-repeat
Returns
key event
static KeyEvent Radiant::KeyEvent::createKeyRelease ( int  key)
static

Creates a key release KeyEvent object with the specified key code.

Parameters
keykey code of the event
Returns
key event
bool Radiant::KeyEvent::isAutoRepeat ( ) const

Returns boolean indicating a repeating event.

Returns
true if this is a repeating event
int Radiant::KeyEvent::key ( ) const

Key code of the event (from Qt::Key)

Returns
key code
Qt::KeyboardModifiers Radiant::KeyEvent::modifiers ( ) const

Active keyboard modifiers.

Returns
bit field of active modifiers
QString Radiant::KeyEvent::text ( ) const

Returns the unicode text representation of the key event.

Returns
Unicode represenation of the key event
QEvent::Type Radiant::KeyEvent::type ( ) const

Returns the type of the keyboard event.

Returns
type of the event