KGuiAddons 5.109.0
Public Member Functions | List of all members
KCursorSaver

Class to temporarily set a mouse cursor and restore the previous one on destruction. More...

#include <KCursorSaver>

Public Member Functions

 KCursorSaver (KCursorSaver &&other)
 Move-constructs a KCursorSaver from other.
 
 KCursorSaver (Qt::CursorShape shape)
 Creates a KCursorSaver, setting the mouse cursor to shape.
 
 ~KCursorSaver ()
 restore the cursor
 
KCursorSaveroperator= (KCursorSaver &&other)
 
void restoreCursor ()
 call this to explicitly restore the cursor
 

Detailed Description

Class to temporarily set a mouse cursor and restore the previous one on destruction.

Create a KCursorSaver object when you want to set the cursor. As soon as it gets out of scope, it will restore the original cursor.

KCursorSaver saver(Qt::WaitCursor);
... long-running operation here ...
Class to temporarily set a mouse cursor and restore the previous one on destruction.
Definition kcursorsaver.h:30
Since
5.73

Constructor & Destructor Documentation

◆ KCursorSaver() [1/2]

KCursorSaver::KCursorSaver ( Qt::CursorShape  shape)
explicit

Creates a KCursorSaver, setting the mouse cursor to shape.

◆ KCursorSaver() [2/2]

KCursorSaver::KCursorSaver ( KCursorSaver &&  other)

Move-constructs a KCursorSaver from other.

◆ ~KCursorSaver()

KCursorSaver::~KCursorSaver ( )

restore the cursor

Member Function Documentation

◆ restoreCursor()

void KCursorSaver::restoreCursor ( )

call this to explicitly restore the cursor