File indexing completed on 2025-02-02 14:19:56
0001 /* 0002 SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KBUSYINDICATORWIDGET_H 0008 #define KBUSYINDICATORWIDGET_H 0009 0010 #include <QWidget> 0011 #include <kwidgetsaddons_export.h> 0012 #include <memory> 0013 0014 /** 0015 * @class KBusyIndicatorWidget kbusyindicatorwidget.h KBusyIndicatorWidget 0016 * 0017 * @brief Rotating spinning icon to indicate busyness 0018 * 0019 * When you need to communicate to the user that your application is busy with 0020 * something you'll want to use a KBusyIndicatorWidget to display an infinitely 0021 * spinnning indicator icon. 0022 * 0023 * A way of using this widget is to combine it with a QLabel to construct a 0024 * status line: 0025 * 0026 * ``` 0027 * auto layout = new QHBoxLayout; 0028 * layout->addWidget(new KBusyIndicatorWidget); 0029 * layout->addWidget(new QLabel(QStringLiteral("Watering the flowers..."))); 0030 * ``` 0031 * 0032 * @image html kbusyindicatorwidget.png "KBusyIndicatorWidget with label" 0033 * 0034 * KBusyIndicatorWidget is set apart from KPixmapSequenceWidget in that it 0035 * does not render a pixmap sequence but rather animates a scaled Icon. 0036 * It can support multiple semi-arbitrary sizes and quality is only limited 0037 * by the resolution of available icons. It is also easier to use as its use 0038 * is more specific. 0039 * 0040 * @since 5.61.0 0041 */ 0042 class KWIDGETSADDONS_EXPORT KBusyIndicatorWidget : public QWidget 0043 { 0044 Q_OBJECT 0045 public: 0046 explicit KBusyIndicatorWidget(QWidget *parent = nullptr); 0047 ~KBusyIndicatorWidget() override; 0048 0049 QSize minimumSizeHint() const override; 0050 0051 protected: 0052 void showEvent(QShowEvent *event) override; 0053 void hideEvent(QHideEvent *event) override; 0054 void resizeEvent(QResizeEvent *event) override; 0055 void paintEvent(QPaintEvent *) override; 0056 bool event(QEvent *event) override; 0057 0058 private: 0059 std::unique_ptr<class KBusyIndicatorWidgetPrivate> const d; 0060 }; 0061 0062 #endif // KBUSYINDICATORWIDGET_H