KCursor class Reference (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KCursor Class Reference

A wrapper around QCursor that allows for "themed" cursors. A QCursor wrapper allowing "themed" cursors and auto-hiding cursors. More...

`#include <kcursor.h>`

Inheritance diagram for KCursor:

[legend]
Collaboration diagram for KCursor:

[legend]
List of all members.

## Public Member Functions
| KCursor ()
| Constructor.
## Static Public Member Functions
QCursor | handCursor ()
| Returns the proper hand cursor according to the current GUI style (static function).
QCursor | workingCursor ()
| Returns the proper arrow+hourglass cursor according to the current GUI style (static function).
QCursor | arrowCursor ()
| Returns the proper arrow cursor according to the current GUI style (static function).
QCursor | upArrowCursor ()
| Returns the proper up arrow cursor according to the current GUI style (static function).
QCursor | crossCursor ()
| Returns the proper cross-hair cursor according to the current GUI style (static function).
QCursor | waitCursor ()
| Returns the proper hourglass cursor according to the current GUI style (static function).
QCursor | ibeamCursor ()
| Returns the proper text cursor according to the current GUI style (static function).
QCursor | sizeVerCursor ()
| Returns the proper vertical resize cursor according to the current GUI style (static function).
QCursor | sizeHorCursor ()
| Returns the proper horizontal resize cursor according to the current GUI style (static function).
QCursor | sizeBDiagCursor ()
| Returns the proper diagonal resize (/) cursor according to the current GUI style (static function).
QCursor | sizeFDiagCursor ()
| Returns the proper diagonal resize (\) cursor according to the current GUI style (static function).
QCursor | sizeAllCursor ()
| Returns the proper all-directions resize cursor according to the current GUI style (static function).
QCursor | blankCursor ()
| Returns a blank or invisible cursor (static function).
QCursor | whatsThisCursor ()
| Returns a WhatsThis cursor (static function).
void | setAutoHideCursor (QWidget *w, bool enable)
| Sets auto-hiding the cursor for widget `w`.
void | setAutoHideCursor (QWidget *w, bool enable, bool customEventFilter)
| Overloaded method for the case where you have an event-filter installed on the widget you want to enable auto-cursor-hiding.
void | setHideCursorDelay (int ms)
| Sets the delay time in milliseconds for auto-hiding.
int | hideCursorDelay ()
void | autoHideEventFilter (QObject *, QEvent *)
| KCursor has to install an eventFilter over the widget you want to auto-hide.

## Detailed Description

A wrapper around QCursor that allows for "themed" cursors. A QCursor wrapper allowing "themed" cursors and auto-hiding cursors.

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

A typical usage would be

     	setCursor(KCursor::handCursor());

Author:
  Kurt Granroth <granroth@kde.org>

Definition at line 43 of file kcursor.h.

## Constructor & Destructor Documentation

KCursor::KCursor | ( |  | ) |

| Constructor. Does not do anything so far. Definition at line 40 of file kcursor.cpp.

## Member Function Documentation

QCursor KCursor::handCursor | ( |  | ) | `[static]`

| 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 KConfigBase::readEntry(). Referenced by KListView::contentsMouseMoveEvent(), KURLLabel::KURLLabel(), KURLLabel::setUseCursor(), and KTextBrowser::viewportMouseMoveEvent().

QCursor KCursor::workingCursor | ( |  | ) | `[static]`

| 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().

QCursor KCursor::arrowCursor | ( |  | ) | `[static]`

| 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.

QCursor KCursor::upArrowCursor | ( |  | ) | `[static]`

| Returns the proper up arrow cursor according to the current GUI style (static function). Definition at line 151 of file kcursor.cpp.

QCursor KCursor::crossCursor | ( |  | ) | `[static]`

| Returns the proper cross-hair cursor according to the current GUI style (static function). Definition at line 157 of file kcursor.cpp.

QCursor KCursor::waitCursor | ( |  | ) | `[static]`

| Returns the proper hourglass cursor according to the current GUI style (static function). Definition at line 163 of file kcursor.cpp.

QCursor KCursor::ibeamCursor | ( |  | ) | `[static]`

| Returns the proper text cursor according to the current GUI style (static function). Definition at line 169 of file kcursor.cpp.

QCursor KCursor::sizeVerCursor | ( |  | ) | `[static]`

| Returns the proper vertical resize cursor according to the current GUI style (static function). Definition at line 175 of file kcursor.cpp.

QCursor KCursor::sizeHorCursor | ( |  | ) | `[static]`

| Returns the proper horizontal resize cursor according to the current GUI style (static function). Definition at line 181 of file kcursor.cpp.

QCursor KCursor::sizeBDiagCursor | ( |  | ) | `[static]`

| Returns the proper diagonal resize (/) cursor according to the current GUI style (static function). Definition at line 187 of file kcursor.cpp.

QCursor KCursor::sizeFDiagCursor | ( |  | ) | `[static]`

| Returns the proper diagonal resize (\) cursor according to the current GUI style (static function). Definition at line 193 of file kcursor.cpp.

QCursor KCursor::sizeAllCursor | ( |  | ) | `[static]`

| Returns the proper all-directions resize cursor according to the current GUI style (static function). Definition at line 199 of file kcursor.cpp.

QCursor KCursor::blankCursor | ( |  | ) | `[static]`

| Returns a blank or invisible cursor (static function). Definition at line 205 of file kcursor.cpp.

QCursor KCursor::whatsThisCursor | ( |  | ) | `[static]`

| Returns a WhatsThis cursor (static function). Definition at line 210 of file kcursor.cpp.

void KCursor::setAutoHideCursor | ( | QWidget * | w,
|  | bool | enable
| ) | `[static]`

| Sets auto-hiding the cursor for widget `w`. Enabling it will result in the cursor being hidden when a key-event happens there are no key-events for a configured time-frame (see setHideCursorDelay()) The cursor will be shown again when the focus is lost or a mouse-event happens. Side effect: when enabling auto-hide, mouseTracking is enabled for the specified widget, because it's needed to get mouse-move-events. So don't disable mouseTracking for a widget while using auto-hide for it. When disabling auto-hide, mouseTracking will be disabled, so if you need mouseTracking after disabling auto-hide, you have to reenable mouseTracking. If you want to use auto-hiding for widgets that don't take focus, e.g. a QCanvasView, then you have to pass all key-events that should trigger auto-hiding to autoHideEventFilter(). Definition at line 217 of file kcursor.cpp. Referenced by KLineEdit::create(), KEdit::create(), KComboBox::create(), KEdit::KEdit(), and KTextEdit::KTextEdit().

void KCursor::setAutoHideCursor | ( | QWidget * | w,
|  | bool | enable,
|  | bool | customEventFilter
| ) | `[static]`

| 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 `customEventFilter` to true and call autoHideEventFilter() from the beginning of your eventFilter(). See also: autoHideEventFilter Definition at line 222 of file kcursor.cpp.

void KCursor::setHideCursorDelay | ( | int | ms | ) | `[static]`

| 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.

int KCursor::hideCursorDelay | ( |  | ) | `[static]`

| Returns: the current auto-hide delay time. Default is 5000, i.e. 5 seconds. Definition at line 238 of file kcursor.cpp.

void KCursor::autoHideEventFilter | ( | QObject * | ,
|  | QEvent * |
| ) | `[static]`

| KCursor has to install an eventFilter over the widget you want to auto-hide. If you have an own eventFilter() 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 setAutoHideCursor( widget, true, true ); to tell KCursor not to install an eventFilter. Then you call this method from the beginning of your eventFilter, for example:
     edit = new KEdit( this, "some edit widget" );
     edit->installEventFilter( this );
     KCursor::setAutoHideCursor( edit, true, true );
     [...]
     bool YourClass::eventFilter( QObject *o, QEvent *e )
     {
         if ( o == edit ) // only that widget where you enabled auto-hide!
             KCursor::autoHideEventFilter( o, e );
         // now you can do your own event-processing
         [...]
     }
Note that you must not call KCursor::autoHideEventFilter() when you didn't enable or after disabling auto-hiding. Definition at line 228 of file kcursor.cpp. Referenced by KLineEdit::eventFilter().

The documentation for this class was generated from the following files:

- kcursor.h
- kcursor.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:59:25 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001