\section{KCursor Class Reference}
\label{classKCursor}\index{KCursor@{KCursor}}
A wrapper around {\bf QCursor} that allows for \char`\"{}themed\char`\"{} cursors. A {\bf QCursor} wrapper allowing \char`\"{}themed\char`\"{} cursors and auto-hiding cursors.  


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

Inheritance diagram for KCursor:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=44pt]{classKCursor__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KCursor:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=94pt]{classKCursor__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KCursor} ()
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QCursor} {\bf hand\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper hand cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf working\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper arrow+hourglass cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf arrow\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper arrow cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf up\-Arrow\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper up arrow cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf cross\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper cross-hair cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf wait\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper hourglass cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf ibeam\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper text cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf size\-Ver\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper vertical resize cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf size\-Hor\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper horizontal resize cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf size\-BDiag\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper diagonal resize (/) cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf size\-FDiag\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper diagonal resize ($\backslash$) cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf size\-All\-Cursor} ()
\begin{CompactList}\small\item\em Returns the proper all-directions resize cursor according to the current GUI style (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf blank\-Cursor} ()
\begin{CompactList}\small\item\em Returns a blank or invisible cursor (static function). \item\end{CompactList}\item 
{\bf QCursor} {\bf whats\-This\-Cursor} ()
\begin{CompactList}\small\item\em Returns a Whats\-This cursor (static function). \item\end{CompactList}\item 
void {\bf set\-Auto\-Hide\-Cursor} ({\bf QWidget} $\ast$w, bool enable)
\begin{CompactList}\small\item\em Sets auto-hiding the cursor for widget {\tt w}. \item\end{CompactList}\item 
void {\bf set\-Auto\-Hide\-Cursor} ({\bf QWidget} $\ast$w, bool enable, bool custom\-Event\-Filter)
\begin{CompactList}\small\item\em Overloaded method for the case where you have an event-filter installed on the widget you want to enable auto-cursor-hiding. \item\end{CompactList}\item 
void {\bf set\-Hide\-Cursor\-Delay} (int ms)
\begin{CompactList}\small\item\em Sets the delay time in milliseconds for auto-hiding. \item\end{CompactList}\item 
int {\bf hide\-Cursor\-Delay} ()
\item 
void {\bf auto\-Hide\-Event\-Filter} ({\bf QObject} $\ast$, {\bf QEvent} $\ast$)
\begin{CompactList}\small\item\em KCursor has to install an event\-Filter over the widget you want to auto-hide. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
A wrapper around {\bf QCursor} that allows for \char`\"{}themed\char`\"{} cursors. A {\bf QCursor} wrapper allowing \char`\"{}themed\char`\"{} cursors and auto-hiding cursors. 

Currently, the only themed cursor is a hand shaped cursor.

A typical usage would be \small\begin{alltt}
 	setCursor({\bf KCursor::handCursor()}{\rm (p.\,\pageref{classKCursor_e0})});
 \end{alltt}\normalsize 


\begin{Desc}
\item[Author:]Kurt Granroth $<${\tt granroth@kde.org}$>$ \end{Desc}




Definition at line 43 of file kcursor.h.

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


Constructor. 

Does not do anything so far. 

Definition at line 40 of file kcursor.cpp.

\subsection{Member Function Documentation}
\index{KCursor@{KCursor}!handCursor@{handCursor}}
\index{handCursor@{handCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::hand\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e0}


Returns the proper hand cursor according to the current GUI style (static function). 



Definition at line 44 of file kcursor.cpp.

References KGlobal::config(), QCursor::handle(), and KConfig\-Base::read\-Entry().

Referenced by KList\-View::contents\-Mouse\-Move\-Event(), KURLLabel::KURLLabel(), KURLLabel::set\-Use\-Cursor(), and KText\-Browser::viewport\-Mouse\-Move\-Event().\index{KCursor@{KCursor}!workingCursor@{workingCursor}}
\index{workingCursor@{workingCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::working\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e1}


Returns the proper arrow+hourglass cursor according to the current GUI style (static function). 



Definition at line 124 of file kcursor.cpp.

References QCursor::handle().\index{KCursor@{KCursor}!arrowCursor@{arrowCursor}}
\index{arrowCursor@{arrowCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::arrow\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e2}


Returns the proper arrow cursor according to the current GUI style (static function). 

This will change at some later date 

Definition at line 145 of file kcursor.cpp.\index{KCursor@{KCursor}!upArrowCursor@{upArrowCursor}}
\index{upArrowCursor@{upArrowCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::up\-Arrow\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e3}


Returns the proper up arrow cursor according to the current GUI style (static function). 



Definition at line 151 of file kcursor.cpp.\index{KCursor@{KCursor}!crossCursor@{crossCursor}}
\index{crossCursor@{crossCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::cross\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e4}


Returns the proper cross-hair cursor according to the current GUI style (static function). 



Definition at line 157 of file kcursor.cpp.\index{KCursor@{KCursor}!waitCursor@{waitCursor}}
\index{waitCursor@{waitCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::wait\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e5}


Returns the proper hourglass cursor according to the current GUI style (static function). 



Definition at line 163 of file kcursor.cpp.\index{KCursor@{KCursor}!ibeamCursor@{ibeamCursor}}
\index{ibeamCursor@{ibeamCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::ibeam\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e6}


Returns the proper text cursor according to the current GUI style (static function). 



Definition at line 169 of file kcursor.cpp.\index{KCursor@{KCursor}!sizeVerCursor@{sizeVerCursor}}
\index{sizeVerCursor@{sizeVerCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::size\-Ver\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e7}


Returns the proper vertical resize cursor according to the current GUI style (static function). 



Definition at line 175 of file kcursor.cpp.\index{KCursor@{KCursor}!sizeHorCursor@{sizeHorCursor}}
\index{sizeHorCursor@{sizeHorCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::size\-Hor\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e8}


Returns the proper horizontal resize cursor according to the current GUI style (static function). 



Definition at line 181 of file kcursor.cpp.\index{KCursor@{KCursor}!sizeBDiagCursor@{sizeBDiagCursor}}
\index{sizeBDiagCursor@{sizeBDiagCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::size\-BDiag\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e9}


Returns the proper diagonal resize (/) cursor according to the current GUI style (static function). 



Definition at line 187 of file kcursor.cpp.\index{KCursor@{KCursor}!sizeFDiagCursor@{sizeFDiagCursor}}
\index{sizeFDiagCursor@{sizeFDiagCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::size\-FDiag\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e10}


Returns the proper diagonal resize ($\backslash$) cursor according to the current GUI style (static function). 



Definition at line 193 of file kcursor.cpp.\index{KCursor@{KCursor}!sizeAllCursor@{sizeAllCursor}}
\index{sizeAllCursor@{sizeAllCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::size\-All\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e11}


Returns the proper all-directions resize cursor according to the current GUI style (static function). 



Definition at line 199 of file kcursor.cpp.\index{KCursor@{KCursor}!blankCursor@{blankCursor}}
\index{blankCursor@{blankCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::blank\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e12}


Returns a blank or invisible cursor (static function). 



Definition at line 205 of file kcursor.cpp.\index{KCursor@{KCursor}!whatsThisCursor@{whatsThisCursor}}
\index{whatsThisCursor@{whatsThisCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCursor} KCursor::whats\-This\-Cursor ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e13}


Returns a Whats\-This cursor (static function). 



Definition at line 210 of file kcursor.cpp.\index{KCursor@{KCursor}!setAutoHideCursor@{setAutoHideCursor}}
\index{setAutoHideCursor@{setAutoHideCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCursor::set\-Auto\-Hide\-Cursor ({\bf QWidget} $\ast$ {\em w}, bool {\em enable})\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e14}


Sets auto-hiding the cursor for widget {\tt w}. 

Enabling it will result in the cursor being hidden when \begin{itemize}
\item a key-event happens \item there are no key-events for a configured time-frame (see {\bf set\-Hide\-Cursor\-Delay}{\rm (p.\,\pageref{classKCursor_e16})}())\end{itemize}
The cursor will be shown again when the focus is lost or a mouse-event happens.

Side effect: when enabling auto-hide, mouse\-Tracking is enabled for the specified widget, because it's needed to get mouse-move-events. So don't disable mouse\-Tracking for a widget while using auto-hide for it.

When disabling auto-hide, mouse\-Tracking will be disabled, so if you need mouse\-Tracking after disabling auto-hide, you have to reenable mouse\-Tracking.

If you want to use auto-hiding for widgets that don't take focus, e.g. a {\bf QCanvas\-View}, then you have to pass all key-events that should trigger auto-hiding to {\bf auto\-Hide\-Event\-Filter}{\rm (p.\,\pageref{classKCursor_e18})}(). 

Definition at line 217 of file kcursor.cpp.

Referenced by KLine\-Edit::create(), KEdit::create(), KCombo\-Box::create(), KEdit::KEdit(), and KText\-Edit::KText\-Edit().\index{KCursor@{KCursor}!setAutoHideCursor@{setAutoHideCursor}}
\index{setAutoHideCursor@{setAutoHideCursor}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCursor::set\-Auto\-Hide\-Cursor ({\bf QWidget} $\ast$ {\em w}, bool {\em enable}, bool {\em custom\-Event\-Filter})\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e15}


Overloaded method for the case where you have an event-filter installed on the widget you want to enable auto-cursor-hiding. 

In this case set {\tt custom\-Event\-Filter} to true and call {\bf auto\-Hide\-Event\-Filter}{\rm (p.\,\pageref{classKCursor_e18})}() from the beginning of your event\-Filter().

\begin{Desc}
\item[See also:]{\bf auto\-Hide\-Event\-Filter}{\rm (p.\,\pageref{classKCursor_e18})} \end{Desc}


Definition at line 222 of file kcursor.cpp.\index{KCursor@{KCursor}!setHideCursorDelay@{setHideCursorDelay}}
\index{setHideCursorDelay@{setHideCursorDelay}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCursor::set\-Hide\-Cursor\-Delay (int {\em ms})\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e16}


Sets the delay time in milliseconds for auto-hiding. 

When no keyboard events arrive for that time-frame, the cursor will be hidden.

Default is 5000, i.e. 5 seconds. 

Definition at line 233 of file kcursor.cpp.\index{KCursor@{KCursor}!hideCursorDelay@{hideCursorDelay}}
\index{hideCursorDelay@{hideCursorDelay}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KCursor::hide\-Cursor\-Delay ()\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e17}


\begin{Desc}
\item[Returns:]the current auto-hide delay time.\end{Desc}
Default is 5000, i.e. 5 seconds. 

Definition at line 238 of file kcursor.cpp.\index{KCursor@{KCursor}!autoHideEventFilter@{autoHideEventFilter}}
\index{autoHideEventFilter@{autoHideEventFilter}!KCursor@{KCursor}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCursor::auto\-Hide\-Event\-Filter ({\bf QObject} $\ast$, {\bf QEvent} $\ast$)\hspace{0.3cm}{\tt  [static]}}\label{classKCursor_e18}


KCursor has to install an event\-Filter over the widget you want to auto-hide. 

If you have an own event\-Filter() on that widget and stop some events by returning true, you might break auto-hiding, because KCursor doesn't get those events.

In this case, you need to call set\-Auto\-Hide\-Cursor( widget, true, true ); to tell KCursor not to install an event\-Filter. Then you call this method from the beginning of your event\-Filter, for example: \small\begin{alltt}
 edit = new {\bf KEdit}{\rm (p.\,\pageref{classKEdit})}( this, "some edit widget" );
 edit-$>$installEventFilter( this );
 KCursor::setAutoHideCursor( edit, true, true );\end{alltt}\normalsize 


\small\begin{alltt} [...]\end{alltt}\normalsize 


\small\begin{alltt} bool YourClass::eventFilter( QObject *o, QEvent *e )
 \{
     if ( o == edit ) // only that widget where you enabled auto-hide!
         KCursor::autoHideEventFilter( o, e );\end{alltt}\normalsize 


\small\begin{alltt}     // now you can do your own event-processing
     [...]
 \}
 \end{alltt}\normalsize 


Note that you must not call {\bf KCursor::auto\-Hide\-Event\-Filter()}{\rm (p.\,\pageref{classKCursor_e18})} when you didn't enable or after disabling auto-hiding. 

Definition at line 228 of file kcursor.cpp.

Referenced by KLine\-Edit::event\-Filter().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kcursor.h\item 
kcursor.cpp\end{CompactItemize}
