Debian Codegraph @

kysdk-qtwidgets/src/kfilewidget.h

raw
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 KFILEWIDGET_H
24 #define KFILEWIDGET_H
25
26 #include "gui_g.h"
27 #include <QWidget>
28
29 namespace kdk
30 {
31
32 /** @defgroup FrameModule
33 * {
34 */
35
36 class KFileWidgetPrivate;
37
38 /**
39 * @brief The KFileWidget class
40 * @since 2.4.1.0
41 */
42 class GUI_EXPORT KFileWidget : public QWidget
43 {
44 Q_OBJECT
45 public:
46 KFileWidget(QWidget *parent = nullptr);
47
48 public:
49 /** @brief 设置主要文本
50 * @param str
51 */
52 void setMainText(QString str);
53
54 /**
55 * @brief 设置次级文本
56 * @param str
57 */
58 void setSubText(QString str);
59
60 /**
61 * @brief 设置图片
62 * @param icon
63 */
64 void setIcon(QIcon icon);
65
66 /**
67 * @brief 设置圆角
68 * @param radius
69 */
70 void setBorderRadius(int radius);
71
72 /**
73 * @brief 设置圆角
74 * @param bottomLeft
75 * @param topLeft
76 * @param topRight
77 * @param bottomRight
78 */
79 void setBorderRadius(int bottomLeft, int topLeft, int topRight, int bottomRight);
80
81 Q_SIGNALS:
82 void clicked();
83
84 protected:
85 void paintEvent(QPaintEvent *event);
86 bool eventFilter(QObject *watched, QEvent *event);
87
88 private:
89 Q_DECLARE_PRIVATE(KFileWidget)
90 KFileWidgetPrivate *const d_ptr;
91 };
92
93 }
94 #endif // KFILEWIDGET_H