KWidgetsAddons

kbusyindicatorwidget.h
1/*
2 SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef KBUSYINDICATORWIDGET_H
8#define KBUSYINDICATORWIDGET_H
9
10#include <QWidget>
11#include <kwidgetsaddons_export.h>
12#include <memory>
13
14/**
15 * @class KBusyIndicatorWidget kbusyindicatorwidget.h KBusyIndicatorWidget
16 *
17 * @brief Rotating spinning icon to indicate busyness
18 *
19 * When you need to communicate to the user that your application is busy with
20 * something you'll want to use a KBusyIndicatorWidget to display an infinitely
21 * spinnning indicator icon.
22 *
23 * A way of using this widget is to combine it with a QLabel to construct a
24 * status line:
25 *
26 * ```
27 * auto layout = new QHBoxLayout;
28 * layout->addWidget(new KBusyIndicatorWidget);
29 * layout->addWidget(new QLabel(QStringLiteral("Watering the flowers...")));
30 * ```
31 *
32 * @image html kbusyindicatorwidget.png "KBusyIndicatorWidget with label"
33 *
34 * KBusyIndicatorWidget is set apart from KPixmapSequenceWidget in that it
35 * does not render a pixmap sequence but rather animates a scaled Icon.
36 * It can support multiple semi-arbitrary sizes and quality is only limited
37 * by the resolution of available icons. It is also easier to use as its use
38 * is more specific.
39 *
40 * @since 5.61.0
41 */
42class KWIDGETSADDONS_EXPORT KBusyIndicatorWidget : public QWidget
43{
44 Q_OBJECT
45public:
46 /**
47 * Create a new KBusyIndicatorWidget widget
48 */
49 explicit KBusyIndicatorWidget(QWidget *parent = nullptr);
50
51 /**
52 * Destroy the widget
53 */
55
56 /**
57 * Return the smallest reasonable size for the widget
58 *
59 * @return Minimum size as a QSize object
60 */
61 QSize minimumSizeHint() const override;
62
63public Q_SLOTS:
64 /**
65 * Start the spinning animation
66 */
67 void start();
68
69 /**
70 * Stop the spinning animation
71 */
72 void stop();
73
74protected:
75 void showEvent(QShowEvent *event) override;
76 void hideEvent(QHideEvent *event) override;
77 void resizeEvent(QResizeEvent *event) override;
78 void paintEvent(QPaintEvent *) override;
79 bool event(QEvent *event) override;
80
81private:
82 std::unique_ptr<class KBusyIndicatorWidgetPrivate> const d;
83};
84
85#endif // KBUSYINDICATORWIDGET_H
Rotating spinning icon to indicate busyness.
~KBusyIndicatorWidget() override
Destroy the widget.
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE Q_NOREPLY void start()
Q_SLOTSQ_SLOTS
virtual bool event(QEvent *event) override
virtual void hideEvent(QHideEvent *event)
virtual void paintEvent(QPaintEvent *event)
virtual void resizeEvent(QResizeEvent *event)
virtual void showEvent(QShowEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:46:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.