LibrePCB Developers Documentation
toolbarproxy.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_TOOLBARPROXY_H
21#define LIBREPCB_EDITOR_TOOLBARPROXY_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29#include <memory>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35namespace editor {
36
37/*******************************************************************************
38 * Class ToolBarProxy
39 ******************************************************************************/
40
45class ToolBarProxy final : public QObject {
46 Q_OBJECT
47
48public:
49 // Constructors / Destructor
50 ToolBarProxy(QObject* parent = nullptr) noexcept;
51 ToolBarProxy(const ToolBarProxy& other) = delete;
52 ~ToolBarProxy() noexcept;
53
54 // Setters
55 void setToolBar(QToolBar* toolbar) noexcept;
56 void setEnabled(bool enabled) noexcept;
57
58 // General Methods
59 void clear() noexcept;
60 QAction* addAction(std::unique_ptr<QAction> action) noexcept;
61 void addActionGroup(std::unique_ptr<QActionGroup> group) noexcept;
62 QAction* addLabel(const QString& text, int indent = 0) noexcept;
63 QAction* addWidget(std::unique_ptr<QWidget> widget, int indent = 0) noexcept;
64 QAction* addSeparator() noexcept;
65 void removeAction(QAction* action) noexcept;
66 bool startTabFocusCycle(QWidget& returnFocusWidget);
67
68 // Operator Overloadings
69 ToolBarProxy& operator=(const ToolBarProxy& rhs) = delete;
70
71private: // Data
72 QToolBar* mToolBar;
73 QList<QAction*> mActions;
74 QList<QActionGroup*> mActionGroups;
75};
76
77/*******************************************************************************
78 * End of File
79 ******************************************************************************/
80
81} // namespace editor
82} // namespace librepcb
83
84#endif
The ToolBarProxy class allows to map a list of QAction's to one QToolBar.
Definition: toolbarproxy.h:45
void clear() noexcept
Definition: toolbarproxy.cpp:85
ToolBarProxy(QObject *parent=nullptr) noexcept
Definition: toolbarproxy.cpp:40
void setEnabled(bool enabled) noexcept
Definition: toolbarproxy.cpp:74
void addActionGroup(std::unique_ptr< QActionGroup > group) noexcept
Definition: toolbarproxy.cpp:105
bool startTabFocusCycle(QWidget &returnFocusWidget)
Definition: toolbarproxy.cpp:156
QList< QActionGroup * > mActionGroups
Definition: toolbarproxy.h:74
ToolBarProxy(const ToolBarProxy &other)=delete
QAction * addWidget(std::unique_ptr< QWidget > widget, int indent=0) noexcept
Definition: toolbarproxy.cpp:124
QAction * addAction(std::unique_ptr< QAction > action) noexcept
Definition: toolbarproxy.cpp:92
~ToolBarProxy() noexcept
Definition: toolbarproxy.cpp:44
QAction * addLabel(const QString &text, int indent=0) noexcept
Definition: toolbarproxy.cpp:118
void setToolBar(QToolBar *toolbar) noexcept
Definition: toolbarproxy.cpp:52
QToolBar * mToolBar
Definition: toolbarproxy.h:72
void removeAction(QAction *action) noexcept
Definition: toolbarproxy.cpp:144
QList< QAction * > mActions
Definition: toolbarproxy.h:73
QAction * addSeparator() noexcept
Definition: toolbarproxy.cpp:138
Definition: occmodel.cpp:77