\section{KKey Class Reference}
\label{classKKey}\index{KKey@{KKey}}
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).  


{\tt \#include $<$kshortcut.h$>$}

\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum \{ {\bf MOD\_\-FLAG\_\-COUNT} =  4
 \}
\item 
enum \{ {\bf Qt\-WIN} =  (Qt::META)
 \}
\item 
enum {\bf Mod\-Flag} \{ {\bf SHIFT} =  0x01, 
{\bf CTRL} =  0x02, 
{\bf ALT} =  0x04, 
{\bf WIN} =  0x08
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KKey} ()
\item 
{\bf KKey} (int key\-Qt)
\item 
{\bf KKey} (const {\bf QKey\-Sequence} \&key\-Seq)
\item 
{\bf KKey} (const {\bf QKey\-Event} $\ast$key\-Event)
\item 
{\bf KKey} (const {\bf KKey} \&key)
\item 
{\bf KKey} (const {\bf QString} \&key)
\item 
{\bf KKey} (uint key, uint mod)\label{classKKey_a6}

\item 
void {\bf clear} ()
\item 
bool {\bf init} (int key\-Qt)
\item 
bool {\bf init} (const {\bf QKey\-Sequence} \&key\-Seq)
\item 
bool {\bf init} (const {\bf QKey\-Event} $\ast$key\-Event)
\item 
bool {\bf init} (const {\bf KKey} \&key)
\item 
bool {\bf init} (const {\bf QString} \&key)
\item 
bool {\bf init} (uint key, uint mod)\label{classKKey_a14}

\item 
{\bf KKey} \& {\bf operator=} (const {\bf KKey} \&key)
\item 
bool {\bf is\-Null} () const 
\item 
uint {\bf sym} () const \label{classKKey_a17}

\item 
uint {\bf mod\-Flags} () const \label{classKKey_a18}

\item 
int {\bf compare} (const {\bf KKey} \&key) const 
\item 
bool {\bf operator==} (const {\bf KKey} \&key) const 
\item 
bool {\bf operator!=} (const {\bf KKey} \&key) const 
\item 
bool {\bf operator$<$} (const {\bf KKey} \&key) const 
\item 
int {\bf key\-Code\-Qt} () const 
\item 
{\bf QString} {\bf to\-String} () const 
\item 
{\bf QString} {\bf to\-String\-Internal} () const 
\item 
void {\bf simplify} ()\label{classKKey_a26}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KKey} \& {\bf null} ()
\item 
static {\bf QString} {\bf mod\-Flag\-Label} ({\bf Mod\-Flag} f)
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KKey\-Native}\label{classKKey_n0}

\end{CompactItemize}


\subsection{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 {\bf Qt} as well as those which are additionally supported by the underlying system (e.g. X11). \begin{Desc}
\item[See also:]{\bf KKey\-Native}{\rm (p.\,\pageref{classKKeyNative})} 

{\bf KKey\-Sequence}{\rm (p.\,\pageref{classKKeySequence})} 

{\bf KShortcut}{\rm (p.\,\pageref{classKShortcut})} \end{Desc}




Definition at line 40 of file kshortcut.h.

\subsection{Member Enumeration Documentation}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}\label{classKKey_w6}


The number of flags. 

\begin{Desc}
\item[See also:]{\bf Mod\-Flag}{\rm (p.\,\pageref{classKKey_w8})}\end{Desc}


Definition at line 47 of file kshortcut.h.\index{KKey@{KKey}!ModFlag@{ModFlag}}
\index{ModFlag@{ModFlag}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KKey::Mod\-Flag}}\label{classKKey_w8}


Flags to represent the modifiers. 

You can combine modifiers by ORing them.

Definition at line 53 of file kshortcut.h.

\subsection{Constructor \& Destructor Documentation}
\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey ()}\label{classKKey_a0}


Creates a new null KKey. 

\begin{Desc}
\item[See also:]{\bf clear()}{\rm (p.\,\pageref{classKKey_a8})} 

{\bf is\-Null()}{\rm (p.\,\pageref{classKKey_a16})} 

{\bf null()}{\rm (p.\,\pageref{classKKey_e0})}\end{Desc}


Definition at line 42 of file kshortcut.cpp.

References clear().\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey (int {\em key\-Qt})}\label{classKKey_a1}


Creates a new key for the given {\bf Qt} key code. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Qt}]the qt keycode \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]Qt::Key\end{Desc}


Definition at line 44 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey (const {\bf QKey\-Sequence} \& {\em key\-Seq})}\label{classKKey_a2}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Seq}]the key sequence that contains the key\end{description}
\end{Desc}


Definition at line 45 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey (const {\bf QKey\-Event} $\ast$ {\em key\-Event})}\label{classKKey_a3}


Extracts the key from the given key event. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Event}]the key event to get the key from\end{description}
\end{Desc}


Definition at line 46 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey (const {\bf KKey} \& {\em key})}\label{classKKey_a4}


Copy constructor. 



Definition at line 47 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!KKey@{KKey}}
\index{KKey@{KKey}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KKey::KKey (const {\bf QString} \& {\em key})}\label{classKKey_a5}


Creates a new key from the given description. 

The form of the description is \char`\"{}[modifier+[modifier+]]+key\char`\"{}, for example \char`\"{}e\char`\"{}, \char`\"{}CTRL+q\char`\"{} or \char`\"{}CTRL+ALT+DEL\char`\"{}. Allowed modifiers are \char`\"{}SHIFT\char`\"{}, \char`\"{}CTRL\char`\"{}, \char`\"{}ALT\char`\"{}, \char`\"{}WIN\char`\"{} and \char`\"{}META\char`\"{}. \char`\"{}WIN\char`\"{} and \char`\"{}META\char`\"{} are equivalent. Modifiers are not case-sensitive. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the description of the key \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KKey\-Server::Sym::init()}{\rm (p.\,\pageref{structKKeyServer_1_1Sym_a4})}\end{Desc}


Definition at line 48 of file kshortcut.cpp.

References init().

\subsection{Member Function Documentation}
\index{KKey@{KKey}!clear@{clear}}
\index{clear@{clear}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KKey::clear ()}\label{classKKey_a8}


Clears the key. 

The key is null after calling this function. \begin{Desc}
\item[See also:]{\bf is\-Null()}{\rm (p.\,\pageref{classKKey_a16})}\end{Desc}


Definition at line 54 of file kshortcut.cpp.

Referenced by init(), KKey(), and null().\index{KKey@{KKey}!init@{init}}
\index{init@{init}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::init (int {\em key\-Qt})}\label{classKKey_a9}


Initializes the key with the given {\bf Qt} key code. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Qt}]the qt keycode \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}
\begin{Desc}
\item[See also:]Qt::Key\end{Desc}


Definition at line 67 of file kshortcut.cpp.

References KKey\-Server::key\-Qt\-To\-Mod(), and KKey\-Server::key\-Qt\-To\-Sym().

Referenced by KKey\-Sequence::init(), init(), KKey(), and KKey\-Sequence::set\-Key().\index{KKey@{KKey}!init@{init}}
\index{init@{init}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::init (const {\bf QKey\-Sequence} \& {\em key\-Seq})}\label{classKKey_a10}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Seq}]the key sequence that contains the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise\end{Desc}


Definition at line 82 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!init@{init}}
\index{init@{init}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::init (const {\bf QKey\-Event} $\ast$ {\em key\-Event})}\label{classKKey_a11}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key\-Event}]the key event to get the key from \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise\end{Desc}


Definition at line 88 of file kshortcut.cpp.

References init().\index{KKey@{KKey}!init@{init}}
\index{init@{init}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::init (const {\bf KKey} \& {\em key})}\label{classKKey_a12}


Copies the given key. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the key to copy \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise\end{Desc}


Definition at line 98 of file kshortcut.cpp.\index{KKey@{KKey}!init@{init}}
\index{init@{init}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::init (const {\bf QString} \& {\em key})}\label{classKKey_a13}


Initializes the key with the given description. 

The form of the description is \char`\"{}[modifier+[modifier+]]+key\char`\"{}, for example \char`\"{}e\char`\"{}, \char`\"{}CTRL+q\char`\"{} or \char`\"{}CTRL+ALT+DEL\char`\"{}. Allowed modifiers are \char`\"{}SHIFT\char`\"{}, \char`\"{}CTRL\char`\"{}, \char`\"{}ALT\char`\"{}, \char`\"{}WIN\char`\"{} and \char`\"{}META\char`\"{}. \char`\"{}WIN\char`\"{} and \char`\"{}META\char`\"{} are equivalent. Modifiers are not case-sensitive. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the description of the key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}
\begin{Desc}
\item[See also:]{\bf KKey\-Server::Sym::init()}{\rm (p.\,\pageref{structKKeyServer_1_1Sym_a4})}\end{Desc}


Definition at line 105 of file kshortcut.cpp.

References clear(), endl(), QString::ends\-With(), QString::left(), QString::length(), KKey\-Server::Sym::m\_\-sym, QString::mid(), QString::number(), QString\-List::split(), and QString::starts\-With().\index{KKey@{KKey}!operator=@{operator=}}
\index{operator=@{operator=}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KKey}\& KKey::operator= (const {\bf KKey} \& {\em key})\hspace{0.3cm}{\tt  [inline]}}\label{classKKey_a15}


Copies the key. 



Definition at line 162 of file kshortcut.h.\index{KKey@{KKey}!isNull@{isNull}}
\index{isNull@{isNull}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::is\-Null () const}\label{classKKey_a16}


Returns true if the key is null (after {\bf clear()}{\rm (p.\,\pageref{classKKey_a8})} or empty constructor). 

\begin{Desc}
\item[Returns:]true if the key is null \end{Desc}
\begin{Desc}
\item[See also:]{\bf clear()}{\rm (p.\,\pageref{classKKey_a8})} 

{\bf null()}{\rm (p.\,\pageref{classKKey_e0})}\end{Desc}


Definition at line 144 of file kshortcut.cpp.

Referenced by KKey\-Sequence::init(), and null().\index{KKey@{KKey}!compare@{compare}}
\index{compare@{compare}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KKey::compare (const {\bf KKey} \& {\em key}) const}\label{classKKey_a19}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em key}]the key to compare with this key \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a negative number if the given KKey is larger, 0 if they are equal and a positive number this KKey is larger\end{Desc}


Definition at line 148 of file kshortcut.cpp.

Referenced by KKey\-Sequence::compare().\index{KKey@{KKey}!operator==@{operator==}}
\index{operator==@{operator==}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::operator== (const {\bf KKey} \& {\em key}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKKey_a20}


Compares the symbol and modifiers of both keys. 

\begin{Desc}
\item[See also:]{\bf compare()}{\rm (p.\,\pageref{classKKey_a19})}\end{Desc}


Definition at line 201 of file kshortcut.h.\index{KKey@{KKey}!operator"!=@{operator"!=}}
\index{operator"!=@{operator"!=}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::operator!= (const {\bf KKey} \& {\em key}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKKey_a21}


Compares the symbol and modifiers of both keys. 

\begin{Desc}
\item[See also:]{\bf compare()}{\rm (p.\,\pageref{classKKey_a19})}\end{Desc}


Definition at line 207 of file kshortcut.h.\index{KKey@{KKey}!operator<@{operator$<$}}
\index{operator<@{operator$<$}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KKey::operator$<$ (const {\bf KKey} \& {\em key}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKKey_a22}


Compares the symbol and modifiers of both keys. 

\begin{Desc}
\item[See also:]{\bf compare()}{\rm (p.\,\pageref{classKKey_a19})}\end{Desc}


Definition at line 213 of file kshortcut.h.\index{KKey@{KKey}!keyCodeQt@{keyCodeQt}}
\index{keyCodeQt@{keyCodeQt}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KKey::key\-Code\-Qt () const}\label{classKKey_a23}


Returns the qt key code. 

\begin{Desc}
\item[Returns:]the qt key code or 0 if there is no key set. \end{Desc}
\begin{Desc}
\item[See also:]Qt::Key\end{Desc}


Definition at line 157 of file kshortcut.cpp.

Referenced by KKey\-Server::Key::init().\index{KKey@{KKey}!toString@{toString}}
\index{toString@{toString}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KKey::to\-String () const}\label{classKKey_a24}


Returns a human-readable representation of the key in the form \char`\"{}modifier+key\char`\"{}. 

Note that the representation is localised, use {\bf to\-String\-Internal()}{\rm (p.\,\pageref{classKKey_a25})} for cases like saving to configuration files. \begin{Desc}
\item[Returns:]the string representation of the key \end{Desc}
\begin{Desc}
\item[See also:]{\bf to\-String\-Internal()}{\rm (p.\,\pageref{classKKey_a25})}\end{Desc}


Definition at line 162 of file kshortcut.cpp.

References QString::is\-Empty(), and KKey\-Server::mod\-To\-String\-User().

Referenced by KKey\-Sequence::to\-String().\index{KKey@{KKey}!toStringInternal@{toStringInternal}}
\index{toStringInternal@{toStringInternal}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KKey::to\-String\-Internal () const}\label{classKKey_a25}


Returns an untranslated text representation of the key in the form \char`\"{}modifier+key\char`\"{}, suitable e.g. 

for saving in configuration files.

Definition at line 174 of file kshortcut.cpp.

References QString::is\-Empty().\index{KKey@{KKey}!null@{null}}
\index{null@{null}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KKey} \& KKey::null ()\hspace{0.3cm}{\tt  [static]}}\label{classKKey_e0}


Returns a null key. 

\begin{Desc}
\item[Returns:]the null key \end{Desc}
\begin{Desc}
\item[See also:]{\bf is\-Null()}{\rm (p.\,\pageref{classKKey_a16})} 

{\bf clear()}{\rm (p.\,\pageref{classKKey_a8})}\end{Desc}


Definition at line 188 of file kshortcut.cpp.

References clear(), and is\-Null().

Referenced by KKey\-Sequence::key().\index{KKey@{KKey}!modFlagLabel@{modFlagLabel}}
\index{modFlagLabel@{modFlagLabel}!KKey@{KKey}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KKey::mod\-Flag\-Label ({\bf Mod\-Flag} {\em f})\hspace{0.3cm}{\tt  [static]}}\label{classKKey_e1}


Returns a user-readable representation of the given modifiers. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em f}]the modifiers to convert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the string representation of the modifiers\end{Desc}


Definition at line 197 of file kshortcut.cpp.

References KKey\-Server::mod\-To\-String\-User().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kshortcut.h\item 
kkeyserver\_\-x11.cpp\item 
kshortcut.cpp\end{CompactItemize}
