Debian Codegraph @

kysdk-qtwidgets/src/kmenubutton.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 KMENUBUTTON_H
24 #define KMENUBUTTON_H
25
26 #include "gui_g.h"
27 #include "themeController.h"
28 #include <QAction>
29 #include <QMenu>
30 #include <QPushButton>
31 #include <QToolButton>
32
33 namespace kdk
34 {
35
36 /**
37 * @defgroup PushbuttonModule
38 * @{
39 */
40
41 class KMenuButtonPrivate;
42
43 /**
44 * @brief 下拉菜单按钮
45 * @since 1.0.0
46 */
47 class GUI_EXPORT KMenuButton : public QToolButton, public ThemeController
48 {
49 Q_OBJECT
50 public:
51 KMenuButton(QWidget *parent = nullptr);
52 ~KMenuButton();
53
54 /**
55 * @brief 获取主菜单
56 * @return
57 */
58 QMenu *menu();
59
60 /**
61 * @brief 获取主题菜单
62 * @return
63 */
64 QMenu *themeMenu();
65
66 /**
67 * @brief 获取设置action
68 * @return
69 */
70 QAction *settingAction();
71
72 /**
73 * @brief 获取主题Action
74 * @return
75 */
76 QAction *themeAction();
77
78 /**
79 * @brief 获取帮助Action
80 * @return
81 */
82 QAction *assistAction();
83
84 /**
85 * @brief 获取关于Action
86 * @return
87 */
88 QAction *aboutAction();
89
90 /**
91 * @brief 获取意见反馈Action
92 * @since 2.4.1.0-0k1.0
93 * @return
94 */
95 QAction *feedbackAction();
96 /**
97 * @brief 获取离开Action
98 * @return
99 */
100 QAction *quitAction();
101
102 /**
103 * @brief 获取跟随主题Action
104 * @return
105 */
106 QAction *autoAction();
107
108 /**
109 * @brief 获取浅色主题Action
110 * @return
111 */
112 QAction *lightAction();
113
114 /**
115 * @brief 获取深色Action
116 * @return
117 */
118 QAction *darkAction();
119
120 protected:
121 void changeTheme() override;
122 void paintEvent(QPaintEvent *painteEvent);
123 QSize sizeHint() const override;
124
125 private:
126 Q_DECLARE_PRIVATE(KMenuButton)
127 KMenuButtonPrivate *const d_ptr;
128 };
129 }
130 /**
131 * @example testWidget/testwidget.h
132 * @example testWidget/testwidget.cpp
133 * @}
134 */
135 #endif // KMENUBUTTON_H