KCursor
#include <KCursor>
Static Public Member Functions | |
static void | autoHideEventFilter (QObject *, QEvent *) |
static int | hideCursorDelay () |
static void | setAutoHideCursor (QWidget *w, bool enable, bool customEventFilter=false) |
static void | setHideCursorDelay (int ms) |
Detailed Description
The KCursor class provides a set of static convenience methods for auto-hiding cursors on widgets.
Member Function Documentation
◆ autoHideEventFilter()
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:
Note that you must not call KCursor::autoHideEventFilter() when you didn't enable or after disabling auto-hiding.
Definition at line 22 of file kcursor.cpp.
◆ hideCursorDelay()
|
static |
- Returns
- the current auto-hide delay time.
Default is 5000, i.e. 5 seconds.
Definition at line 32 of file kcursor.cpp.
◆ setAutoHideCursor()
|
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 re-enable 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 17 of file kcursor.cpp.
◆ setHideCursorDelay()
|
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 27 of file kcursor.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:58:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.