Debian Codegraph @

kysdk-qtwidgets/src/kdialog.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: Zhen Sun <[email protected]>
20 *
21 */
22
23 #ifndef KDIALOG_H
24 #define KDIALOG_H
25
26 #include "gui_g.h"
27 #include "kiconbar.h"
28 #include "kwindowbuttonbar.h"
29 #include "themeController.h"
30 #include <QBoxLayout>
31 #include <QDialog>
32 #include <QPushButton>
33
34 namespace kdk
35 {
36
37 /** @defgroup DialogBoxModule
38 * @{
39 */
40
41 class KDialogPrivate;
42 /**
43 * @brief 继承自 QDialog,支持响应式主题背景切换和图标主题切换、 标题颜色响应窗口激活状态
44 * @since 1.0.0
45 */
46 class GUI_EXPORT KDialog : public QDialog, public ThemeController
47 {
48 Q_OBJECT
49
50 public:
51 explicit KDialog(QWidget *parent = nullptr);
52 ~KDialog();
53
54 /**
55 * @brief 设置对话框图标
56 * @param icon
57 */
58 void setWindowIcon(const QIcon &icon);
59
60 /**
61 * @brief 设置对话框图标
62 * @param iconName
63 */
64 void setWindowIcon(const QString &iconName);
65
66 /**
67 * @brief 设置对话框标题名称
68 * @param widgetName
69 */
70 void setWindowTitle(const QString &);
71
72 /**
73 * @brief 获取最大化按钮
74 * @return
75 */
76 QPushButton *maximumButton();
77
78 /**
79 * @brief 获取最小化按钮
80 * @return
81 */
82 QPushButton *minimumButton();
83
84 /**
85 * @brief 获取关闭按钮
86 * @return
87 */
88 QPushButton *closeButton();
89
90 /**
91 * @brief 获取下拉菜单按钮
92 * @return
93 */
94 KMenuButton *menuButton();
95
96 /**
97 * @brief 获取主内容区Widget
98 * @return
99 */
100 QWidget *mainWidget();
101
102 /**
103 * @brief windowButtonBar
104 * @return
105 * @2.5.2.0
106 */
107 KWindowButtonBar *windowButtonBar();
108
109 /**
110 * @brief iconBar
111 * @return
112 * @2.5.2.0
113 */
114 KIconBar *iconBar();
115
116 protected:
117 bool eventFilter(QObject *target, QEvent *event) override;
118 void changeTheme();
119 void changeIconStyle();
120 QBoxLayout *mainLayout();
121
122 private:
123 Q_DECLARE_PRIVATE(KDialog)
124 KDialogPrivate *const d_ptr;
125 };
126 }
127 /**
128 * @example testDialog/widget.h
129 * @example testDialog/widget.cpp
130 * @}
131 */
132
133 #endif // KDIALOG_H