| 1 |
/* |
| 2 |
* libkysdk-qtwidgets's Library |
| 3 |
* |
| 4 |
* Copyright (C) 2023, KylinSoft Co., Ltd. |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 3 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this library. If not, see <https://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* Authors: Zhen Sun <[email protected]> |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef KPROGRESSCIRCLE_H |
| 24 |
#define KPROGRESSCIRCLE_H |
| 25 |
#include "gui_g.h" |
| 26 |
#include "kprogressbar.h" |
| 27 |
#include <QWidget> |
| 28 |
|
| 29 |
/** |
| 30 |
* @defgroup BarModule |
| 31 |
* { |
| 32 |
*/ |
| 33 |
namespace kdk |
| 34 |
{ |
| 35 |
class KProgressCirclePrivate; |
| 36 |
|
| 37 |
/** |
| 38 |
* @brief 以圆环样式显示进度,支持三种状态 |
| 39 |
* @since 1.0.0 |
| 40 |
*/ |
| 41 |
class GUI_EXPORT KProgressCircle : public QWidget |
| 42 |
{ |
| 43 |
Q_OBJECT |
| 44 |
|
| 45 |
public: |
| 46 |
explicit KProgressCircle(QWidget *parent = nullptr); |
| 47 |
|
| 48 |
/** |
| 49 |
* @brief 获取KProgressCircle最小值 |
| 50 |
* @return int |
| 51 |
*/ |
| 52 |
int minimum() const; |
| 53 |
/** |
| 54 |
* @brief 获取KProgressCircle最大值 |
| 55 |
* @return int |
| 56 |
*/ |
| 57 |
int maximum() const; |
| 58 |
|
| 59 |
/** |
| 60 |
* @brief 获取当前值 |
| 61 |
* @return int |
| 62 |
*/ |
| 63 |
int value() const; |
| 64 |
|
| 65 |
/** |
| 66 |
* @brief 获取文本 |
| 67 |
* @return QString |
| 68 |
*/ |
| 69 |
QString text() const; |
| 70 |
|
| 71 |
/** |
| 72 |
* @brief 设置文本是否可见 |
| 73 |
* @param visible |
| 74 |
*/ |
| 75 |
void setTextVisible(bool visible); |
| 76 |
|
| 77 |
/** |
| 78 |
* @brief 返回文本是否可见 |
| 79 |
* @return bool |
| 80 |
*/ |
| 81 |
bool isTextVisible() const; |
| 82 |
/** |
| 83 |
* @brief 获取当前KProgressCircle状态 |
| 84 |
* @return |
| 85 |
*/ |
| 86 |
ProgressBarState state(); |
| 87 |
|
| 88 |
/** |
| 89 |
* @brief 设置当前KProgressCircle状态 |
| 90 |
* @param state |
| 91 |
*/ |
| 92 |
void setState(ProgressBarState state); |
| 93 |
|
| 94 |
Q_SIGNALS: |
| 95 |
void valueChanged(int value); |
| 96 |
|
| 97 |
public Q_SLOTS: |
| 98 |
void reset(); |
| 99 |
void setRange(int minimum, int maximum); |
| 100 |
void setMinimum(int minimum); |
| 101 |
void setMaximum(int maximum); |
| 102 |
void setValue(int value); |
| 103 |
|
| 104 |
protected: |
| 105 |
void paintEvent(QPaintEvent *) override; |
| 106 |
|
| 107 |
private: |
| 108 |
Q_DECLARE_PRIVATE(KProgressCircle) |
| 109 |
KProgressCirclePrivate *const d_ptr; |
| 110 |
}; |
| 111 |
} |
| 112 |
|
| 113 |
#endif // KPROGRESSCIRCLE_H |