KGuiAddons

kcursorsaver.h
1/*
2 SPDX-License-Identifier: LGPL-2.0-or-later
3 SPDX-FileCopyrightText: 2003 Marc Mutz <mutz@kde.org>
4 SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
5*/
6
7#ifndef KCURSORSAVER_H
8#define KCURSORSAVER_H
9#include <kguiaddons_export.h>
10
11#include <QCursor>
12
13class KCursorSaverPrivate;
14
15/**
16 * @class KCursorSaver kcursorsaver.h KCursorSaver
17 *
18 * @short Class to temporarily set a mouse cursor and restore the previous one on destruction
19 *
20 * Create a KCursorSaver object when you want to set the cursor.
21 * As soon as it gets out of scope, it will restore the original
22 * cursor.
23 * @code
24 KCursorSaver saver(Qt::WaitCursor);
25 ... long-running operation here ...
26 @endcode
27 * @since 5.73
28 */
29class KGUIADDONS_EXPORT KCursorSaver
30{
31public:
32 /// Creates a KCursorSaver, setting the mouse cursor to @p shape.
33 explicit KCursorSaver(Qt::CursorShape shape);
34
35 /// Move-constructs a KCursorSaver from other
37
38 /// restore the cursor
40
41 /// call this to explicitly restore the cursor
42 void restoreCursor();
43
44 KCursorSaver &operator=(KCursorSaver &&other);
45
46private:
47 KCursorSaver(KCursorSaver &other) = delete;
48 void operator=(const KCursorSaver &rhs) = delete;
49 KCursorSaverPrivate *const d; ///< @internal
50};
51
52#endif
Class to temporarily set a mouse cursor and restore the previous one on destruction.
CursorShape
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.