Debian Codegraph @

src/Gui/SplitButton.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /****************************************************************************
3 * *
4 * Copyright (c) 2025 Kacper Donat <[email protected]> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 ***************************************************************************/
23
24 #ifndef FREECAD_FCSPLITBUTTON_H
25 #define FREECAD_FCSPLITBUTTON_H
26
27 #include <QWidget>
28 #include <QPushButton>
29 #include <QToolButton>
30 #include <QMenu>
31
32 namespace Gui
33 {
34
35 class SplitButton: public QWidget
36 {
37 Q_OBJECT
38 public:
39 explicit SplitButton(QWidget* parent = nullptr);
40 explicit SplitButton(const QString& text, QWidget* parent = nullptr);
41
42 QPushButton* mainButton() const
43 {
44 return m_main;
45 }
46
47 QToolButton* menuButton() const
48 {
49 return m_menuButton;
50 }
51
52 QMenu* menu() const
53 {
54 return m_menu;
55 }
56
57 Q_SIGNALS:
58 void defaultClicked();
59 void triggered(QAction*);
60
61 private:
62 QPushButton* m_main;
63 QToolButton* m_menuButton;
64 QMenu* m_menu;
65 };
66
67 } // namespace Gui
68
69 #endif // FREECAD_FCSPLITBUTTON_H