DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dloadingindicator.h
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DLOADINGINDICATOR_H
6#define DLOADINGINDICATOR_H
7
8#include <QObject>
9#include <QBrush>
10#include <QColor>
11#include <QVariant>
12#include <QSizePolicy>
13#include <QVariantAnimation>
14#include <QGraphicsScene>
15#include <QGraphicsPixmapItem>
16#include <QGraphicsView>
17#include <QEasingCurve>
18
19#include <dtkwidget_global.h>
20#include <DObject>
21
22DWIDGET_BEGIN_NAMESPACE
23
24class DLoadingIndicatorPrivate;
25class LIBDTKWIDGETSHARED_EXPORT DLoadingIndicator : public QGraphicsView, public DTK_CORE_NAMESPACE::DObject
26{
27 Q_OBJECT
28
29 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor DESIGNABLE true SCRIPTABLE true)
30 Q_PROPERTY(bool loading READ loading WRITE setLoading)
31 Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
32 Q_PROPERTY(QPixmap imageSource READ imageSource WRITE setImageSource)
33 Q_PROPERTY(QWidget* widgetSource READ widgetSource WRITE setWidgetSource)
34 Q_PROPERTY(int aniDuration READ aniDuration WRITE setAniDuration)
35 Q_PROPERTY(QEasingCurve::Type aniEasingType READ aniEasingType WRITE setAniEasingType)
36 Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
37 Q_PROPERTY(qreal rotate READ rotate WRITE setRotate NOTIFY rotateChanged)
38
39public:
46 Counterclockwise
47 };
48
49 Q_ENUMS(RotationDirection)
50
51 DLoadingIndicator(QWidget * parent = 0);
53
54 QColor backgroundColor() const;
55 bool loading() const;
56 QWidget* widgetSource() const;
57 QPixmap imageSource() const;
58 int aniDuration() const;
59 QEasingCurve::Type aniEasingType() const;
60 QSize sizeHint() const Q_DECL_OVERRIDE;
61 bool smooth() const;
62 RotationDirection direction() const;
63 qreal rotate() const;
64
65public Q_SLOTS:
66 void start();
67 void stop();
68 void setLoading(bool flag);
69 void setAniDuration(int msecs);
70 void setAniEasingCurve(const QEasingCurve & easing);
71 void setBackgroundColor(const QColor &color);
72 void setRotate(QVariant angle);
73 void setWidgetSource(QWidget* widgetSource);
74 void setImageSource(const QPixmap &imageSource);
75 void setAniEasingType(QEasingCurve::Type aniEasingType);
76 void setSmooth(bool smooth);
77 void setDirection(RotationDirection direction);
78
79Q_SIGNALS:
80 void directionChanged(RotationDirection direction);
81 void rotateChanged(qreal rotate);
82
83protected:
84 void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
85
86private:
87 D_DECLARE_PRIVATE(DLoadingIndicator)
88};
89
90DWIDGET_END_NAMESPACE
91
92#endif // DLOADINGINDICATOR_H
The DLoadingIndicator class provides a widget that showing loading animation.
Definition dloadingindicator.h:26
RotationDirection
The RotationDirection enum contains the possible rotation directions of the DLoadingIndicator widget.
Definition dloadingindicator.h:44
@ Clockwise
Definition dloadingindicator.h:45