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 explicit KBusyIndicatorWidget(QWidget *parent = nullptr);
47 ~KBusyIndicatorWidget() override;
48
49 QSize minimumSizeHint() const override;
50
51protected:
52 void showEvent(QShowEvent *event) override;
53 void hideEvent(QHideEvent *event) override;
54 void resizeEvent(QResizeEvent *event) override;
55 void paintEvent(QPaintEvent *) override;
56 bool event(QEvent *event) override;
57
58private:
59 std::unique_ptr<class KBusyIndicatorWidgetPrivate> const d;
60};
61
62#endif // KBUSYINDICATORWIDGET_H
Rotating spinning icon to indicate busyness.
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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.