Debian Codegraph @

kysdk-qtwidgets/src/ktoolbar.h

raw
1 /*
2 * libkysdk-qtwidgets's Library
3 *
4 * Copyright (C) 2024, 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 KTOOLBAR_H
24 #define KTOOLBAR_H
25
26 #include "gui_g.h"
27 #include "ktoolbutton.h"
28 #include <QPushButton>
29 #include <QWidget>
30
31 namespace kdk
32 {
33
34 class KToolBarPrivate;
35
36 /**
37 * @since 2.5.2.0
38 */
39 class GUI_EXPORT KToolBar : public QWidget
40 {
41 Q_OBJECT
42 public:
43 KToolBar(QWidget *parent = nullptr);
44
45 Qt::Orientation orientation();
46
47 void setOrientation(Qt::Orientation orientation);
48
49 KToolButton *addButton(QIcon icon);
50
51 KToolButton *addButton(QString string);
52
53 // KToolButton* addButton (const QIcon&icon ,const QString text = QString());
54 QList<KToolButton *> addButton(QList<QIcon> list);
55
56 QList<KToolButton *> addButton(QList<QString> list);
57
58 QList<KToolButton *> buttonList();
59
60 void removeButton(KToolButton *button);
61
62 void removeButton(int id);
63
64 void removeButton(QList<KToolButton *> list);
65
66 void setBorderRadius(int radius);
67
68 int borderRadius();
69
70 void setExclusive(bool);
71
72 bool exclusive();
73
74 void setCheckable(bool flag);
75
76 bool isCheckable();
77
78 QList<KToolButton *> checkedButton();
79
80 void setLineVisible(bool flag);
81
82 bool isLineVisible();
83
84 void setBackgroundColorEnabled(bool flag);
85
86 bool backgroundColorEnabled();
87
88 protected:
89 void paintEvent(QPaintEvent *event);
90
91 private:
92 Q_DECLARE_PRIVATE(KToolBar)
93 KToolBarPrivate *const d_ptr;
94 };
95
96 }
97
98 #endif // KTOOLBAR_H