KCursorSaver Class

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

Header: #include <KCursorSaver>
CMake: find_package(KF6 REQUIRED COMPONENTS GuiAddons)
target_link_libraries(mytarget PRIVATE KF6::GuiAddons)
Since: 5.73

Public Functions

KCursorSaver(Qt::CursorShape shape)
~KCursorSaver()
void restoreCursor()

Detailed Description

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

Member Function Documentation

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

Creates a KCursorSaver, setting the mouse cursor to shape.

[noexcept] KCursorSaver::~KCursorSaver()

restore the cursor

void KCursorSaver::restoreCursor()

call this to explicitly restore the cursor