Debian Codegraph @

kysdk-qtwidgets/src/kswitchbuttonframe.h

raw
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 SWITCHWIDGET_H
23 #define SWITCHWIDGET_H
24
25 #include "kbaseframe.h"
26
27 #include "kswitchbutton.h"
28
29 /**
30 * @defgroup ContainerModules
31 * @brief 创建一个带 KSwitchButton 的 Frame
32 * @since 3.0.1.0
33 * {
34 */
35 namespace kdk
36 {
37
38 class KSwitchButtonFramePrivate;
39
40 class KSwitchButtonFrame : public KBaseFrame
41 {
42 Q_OBJECT
43
44 public:
45 /**
46 * @brief 创建一个带 KSwitchButton 的 Frame
47 *
48 * @param title: text of m_settingName
49 * @param style: 设置圆角(None:无圆角,Top:上圆角,Bottom:下圆角,Around:四圆角)
50 * @param parent
51 */
52 explicit KSwitchButtonFrame(const QString title, QWidget *parent = nullptr, BorderRadiusStyle style = BorderRadiusStyle::None);
53 ~KSwitchButtonFrame();
54
55 /**
56 * @brief 设置提示文案
57 * @param hintText
58 */
59 void setHintText(QString &hintText);
60
61 /**
62 * @brief 获取 switchbutton
63 * @return KSlider: m_slider
64 */
65 KSwitchButton *switchButton();
66
67 /**
68 * @brief 获取label
69 *
70 * @return QLabel
71 */
72 KLabel *titleLabel();
73
74 /**
75 * @brief 获取layout
76 *
77 * @return QHBoxLayout
78 */
79 QHBoxLayout *mainHLayout();
80
81 private:
82 Q_DECLARE_PRIVATE(KSwitchButtonFrame)
83 KSwitchButtonFramePrivate *const d_ptr;
84 };
85 }
86
87 #endif // SWITCHWIDGET_H