| 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: Zhenyu Wang <[email protected]> |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef KCLOCKTIMER_H |
| 24 |
#define KCLOCKTIMER_H |
| 25 |
|
| 26 |
#include "gui_g.h" |
| 27 |
#include <QWidget> |
| 28 |
|
| 29 |
namespace kdk |
| 30 |
{ |
| 31 |
|
| 32 |
class KClockTimerPrivate; |
| 33 |
|
| 34 |
/** |
| 35 |
* @defgroup timerModule |
| 36 |
* @since 2.5.2.0 |
| 37 |
*/ |
| 38 |
class GUI_EXPORT KClockTimer : public QWidget |
| 39 |
{ |
| 40 |
Q_OBJECT |
| 41 |
public: |
| 42 |
KClockTimer(QWidget *parent = nullptr); |
| 43 |
|
| 44 |
/** |
| 45 |
* @brief 获取当前时间 |
| 46 |
* @return |
| 47 |
*/ |
| 48 |
QString time(); |
| 49 |
|
| 50 |
public slots: |
| 51 |
/** |
| 52 |
* @brief 开始计时信号 |
| 53 |
*/ |
| 54 |
void startStopwatch(); |
| 55 |
|
| 56 |
/** |
| 57 |
* @brief 停止计时信号 |
| 58 |
*/ |
| 59 |
void stopStopwatch(); |
| 60 |
|
| 61 |
/** |
| 62 |
* @brief 复位信号 |
| 63 |
*/ |
| 64 |
void resetStopwatch(); |
| 65 |
|
| 66 |
private: |
| 67 |
KClockTimerPrivate *const d_ptr; |
| 68 |
Q_DECLARE_PRIVATE(KClockTimer) |
| 69 |
}; |
| 70 |
|
| 71 |
} |
| 72 |
#endif // KCLOCKTIMER_H |