| 1 |
/* |
| 2 |
* |
| 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: Sisheng He <[email protected]> |
| 20 |
* |
| 21 |
*/ |
| 22 |
#ifndef ADDBUTTON_H |
| 23 |
#define ADDBUTTON_H |
| 24 |
|
| 25 |
#include <QObject> |
| 26 |
#include <QPainterPath> |
| 27 |
#include <QPushButton> |
| 28 |
#include <QWidget> |
| 29 |
|
| 30 |
#include "kbaseframe.h" |
| 31 |
|
| 32 |
/** |
| 33 |
* @defgroup PushButtonModule |
| 34 |
* @brief 添加按钮 |
| 35 |
* @since 3.0.1.0 |
| 36 |
* { |
| 37 |
*/ |
| 38 |
namespace kdk |
| 39 |
{ |
| 40 |
|
| 41 |
class KAddButtonPrivate; |
| 42 |
|
| 43 |
class KAddButton : public QPushButton |
| 44 |
{ |
| 45 |
Q_OBJECT |
| 46 |
public: |
| 47 |
explicit KAddButton(QWidget *parent = nullptr, KBaseFrame::BorderRadiusStyle style = KBaseFrame::BorderRadiusStyle::Bottom, bool heightAdaptive = true); |
| 48 |
~KAddButton(); |
| 49 |
|
| 50 |
/** |
| 51 |
* @brief 设置圆角模式 |
| 52 |
* |
| 53 |
* @param style |
| 54 |
*/ |
| 55 |
void setRadiusType(KBaseFrame::BorderRadiusStyle style); |
| 56 |
/** |
| 57 |
* @brief 获取平板模式 |
| 58 |
* |
| 59 |
* @return bool 是否是平板模式 |
| 60 |
*/ |
| 61 |
bool getTabletMode(); |
| 62 |
|
| 63 |
/** |
| 64 |
* @brief 设置高度是否自适应 |
| 65 |
* @param flag |
| 66 |
*/ |
| 67 |
void setHeightAdaptive(bool flag); |
| 68 |
|
| 69 |
protected: |
| 70 |
void paintEvent(QPaintEvent *event); |
| 71 |
|
| 72 |
Q_SIGNALS: |
| 73 |
void tabletModeChanged(bool b); |
| 74 |
|
| 75 |
private: |
| 76 |
Q_DECLARE_PRIVATE(KAddButton) |
| 77 |
KAddButtonPrivate *const d_ptr; |
| 78 |
}; |
| 79 |
|
| 80 |
} |
| 81 |
|
| 82 |
#endif // ADDBUTTON_H |