• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
KKey Class Reference

#include <tdeshortcut.h>

Public Types

enum  { MOD_FLAG_COUNT = 4 }
 
enum  { QtWIN = (TQt::META) }
 
enum  ModFlag { SHIFT = 0x01 , CTRL = 0x02 , ALT = 0x04 , WIN = 0x08 }
 

Public Member Functions

 KKey ()
 
 KKey (int keyQt)
 
 KKey (const TQKeySequence &keySeq)
 
 KKey (const TQKeyEvent *keyEvent)
 
 KKey (const KKey &key)
 
 KKey (const TQString &key)
 
 KKey (uint key, uint mod)
 
void clear ()
 
bool init (int keyQt)
 
bool init (const TQKeySequence &keySeq)
 
bool init (const TQKeyEvent *keyEvent)
 
bool init (const KKey &key)
 
bool init (const TQString &key)
 
bool init (uint key, uint mod)
 
KKey & operator= (const KKey &key)
 
bool isNull () const
 
uint sym () const
 
uint modFlags () const
 
int compare (const KKey &key) const
 
bool operator== (const KKey &key) const
 
bool operator!= (const KKey &key) const
 
bool operator< (const KKey &key) const
 
int keyCodeQt () const
 
TQString toString () const
 
TQString toStringInternal () const
 
void simplify ()
 

Static Public Member Functions

static KKey & null ()
 
static TQString modFlagLabel (ModFlag f)
 

Friends

class KKeyNative
 

Detailed Description

A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).

It can represent both keys which are understood by Qt as well as those which are additionally supported by the underlying system (e.g. X11).

See also
KKeyNative
KKeySequence
TDEShortcut

Definition at line 40 of file tdeshortcut.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The number of flags.

See also
ModFlag

Definition at line 47 of file tdeshortcut.h.

◆ anonymous enum

anonymous enum

Definition at line 48 of file tdeshortcut.h.

◆ ModFlag

enum KKey::ModFlag

Flags to represent the modifiers.

You can combine modifiers by ORing them.

Definition at line 53 of file tdeshortcut.h.

Constructor & Destructor Documentation

◆ KKey() [1/7]

KKey::KKey ( )

Creates a new null KKey.

See also
clear()
isNull()
null()

Definition at line 42 of file tdeshortcut.cpp.

◆ KKey() [2/7]

KKey::KKey ( int  keyQt)

Creates a new key for the given Qt key code.

Parameters
keyQtthe qt keycode
See also
TQt::Key

Definition at line 44 of file tdeshortcut.cpp.

◆ KKey() [3/7]

KKey::KKey ( const TQKeySequence &  keySeq)

Creates a new key from the first key code of the given key sequence.

Parameters
keySeqthe key sequence that contains the key

Definition at line 45 of file tdeshortcut.cpp.

◆ KKey() [4/7]

KKey::KKey ( const TQKeyEvent *  keyEvent)

Extracts the key from the given key event.

Parameters
keyEventthe key event to get the key from

Definition at line 46 of file tdeshortcut.cpp.

◆ KKey() [5/7]

KKey::KKey ( const KKey &  key)

Copy constructor.

Definition at line 47 of file tdeshortcut.cpp.

◆ KKey() [6/7]

KKey::KKey ( const TQString &  key)

Creates a new key from the given description.

The form of the description is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.

Parameters
keythe description of the key
See also
KKeyServer::Sym::init()

Definition at line 48 of file tdeshortcut.cpp.

◆ KKey() [7/7]

KKey::KKey ( uint  key,
uint  mod 
)

Definition at line 43 of file tdeshortcut.cpp.

◆ ~KKey()

KKey::~KKey ( )

Definition at line 50 of file tdeshortcut.cpp.

Member Function Documentation

◆ clear()

void KKey::clear ( )

Clears the key.

The key is null after calling this function.

See also
isNull()

Definition at line 54 of file tdeshortcut.cpp.

◆ compare()

int KKey::compare ( const KKey &  key) const

Compares this key with the given KKey object.

Returns a negative number if the given KKey is larger, 0 if they are equal and a positive number this KKey is larger. The returned value is the difference between the symbol or, if the symbols are equal, the difference between the encoded modifiers.

Parameters
keythe key to compare with this key
Returns
a negative number if the given KKey is larger, 0 if they are equal and a positive number this KKey is larger

Definition at line 153 of file tdeshortcut.cpp.

◆ init() [1/6]

bool KKey::init ( const KKey &  key)

Copies the given key.

Parameters
keythe key to copy
Returns
true if successful, false otherwise

Definition at line 99 of file tdeshortcut.cpp.

◆ init() [2/6]

bool KKey::init ( const TQKeyEvent *  keyEvent)

Initializes the key by extracting the code from the given key event.

Parameters
keyEventthe key event to get the key from
Returns
true if successful, false otherwise

Definition at line 89 of file tdeshortcut.cpp.

◆ init() [3/6]

bool KKey::init ( const TQKeySequence &  keySeq)

Initializes the key with the first key code of the given key sequence.

Parameters
keySeqthe key sequence that contains the key
Returns
true if successful, false otherwise

Definition at line 83 of file tdeshortcut.cpp.

◆ init() [4/6]

bool KKey::init ( const TQString &  key)

Initializes the key with the given description.

The form of the description is "[modifier+[modifier+]]+key", for example "e", "CTRL+q" or "CTRL+ALT+DEL". Allowed modifiers are "SHIFT", "CTRL", "ALT", "WIN" and "META". "WIN" and "META" are equivalent. Modifiers are not case-sensitive.

Parameters
keythe description of the key
Returns
true if successful, false otherwise
See also
KKeyServer::Sym::init()

Definition at line 106 of file tdeshortcut.cpp.

◆ init() [5/6]

bool KKey::init ( int  keyQt)

Initializes the key with the given Qt key code.

Parameters
keyQtthe qt keycode
Returns
true if successful, false otherwise
See also
TQt::Key

Definition at line 67 of file tdeshortcut.cpp.

◆ init() [6/6]

bool KKey::init ( uint  key,
uint  mod 
)

Definition at line 60 of file tdeshortcut.cpp.

◆ isNull()

bool KKey::isNull ( ) const

Returns true if the key is null (after clear() or empty constructor).

Returns
true if the key is null
See also
clear()
null()

Definition at line 149 of file tdeshortcut.cpp.

◆ keyCodeQt()

int KKey::keyCodeQt ( ) const

Returns the qt key code.

Returns
the qt key code or 0 if there is no key set.
See also
TQt::Key

Definition at line 162 of file tdeshortcut.cpp.

◆ modFlagLabel()

TQString KKey::modFlagLabel ( ModFlag  f)
static

Returns a user-readable representation of the given modifiers.

Parameters
fthe modifiers to convert
Returns
the string representation of the modifiers

Definition at line 202 of file tdeshortcut.cpp.

◆ modFlags()

uint KKey::modFlags ( ) const

Definition at line 151 of file tdeshortcut.cpp.

◆ null()

KKey & KKey::null ( )
static

Returns a null key.

Returns
the null key
See also
isNull()
clear()

Definition at line 193 of file tdeshortcut.cpp.

◆ operator!=()

bool KKey::operator!= ( const KKey &  key) const
inline

Compares the symbol and modifiers of both keys.

See also
compare()

Definition at line 207 of file tdeshortcut.h.

◆ operator<()

bool KKey::operator< ( const KKey &  key) const
inline

Compares the symbol and modifiers of both keys.

See also
compare()

Definition at line 213 of file tdeshortcut.h.

◆ operator=()

KKey & KKey::operator= ( const KKey &  key)
inline

Copies the key.

Definition at line 162 of file tdeshortcut.h.

◆ operator==()

bool KKey::operator== ( const KKey &  key) const
inline

Compares the symbol and modifiers of both keys.

See also
compare()

Definition at line 201 of file tdeshortcut.h.

◆ sym()

uint KKey::sym ( ) const

Definition at line 150 of file tdeshortcut.cpp.

◆ toString()

TQString KKey::toString ( ) const

Returns a human-readable representation of the key in the form "modifier+key".

Note that the representation is localised, use toStringInternal() for cases like saving to configuration files.

Returns
the string representation of the key
See also
toStringInternal()

Definition at line 167 of file tdeshortcut.cpp.

◆ toStringInternal()

TQString KKey::toStringInternal ( ) const

Returns an untranslated text representation of the key in the form "modifier+key", suitable e.g.

for saving in configuration files.

Definition at line 179 of file tdeshortcut.cpp.

Friends And Related Function Documentation

◆ KKeyNative

friend class KKeyNative
friend

Definition at line 278 of file tdeshortcut.h.


The documentation for this class was generated from the following files:
  • tdeshortcut.h
  • tdeshortcut.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.