LibrePCB Developers Documentation
Loading...
Searching...
No Matches
editortoolbox.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_EDITORTOOLBOX_H
21#define LIBREPCB_EDITOR_EDITORTOOLBOX_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33namespace editor {
34
35/*******************************************************************************
36 * Class EditorToolbox
37 ******************************************************************************/
38
43class EditorToolbox final {
44 Q_DECLARE_TR_FUNCTIONS(EditorToolbox)
45
46public:
47 // Constructors / Destructor
48 EditorToolbox() = delete;
49 EditorToolbox(const EditorToolbox& other) = delete;
50 ~EditorToolbox() = delete;
51
52 // Operator Overloadings
53 EditorToolbox& operator=(const EditorToolbox& rhs) = delete;
54
55 // Static Methods
56
63 static bool isWindowBackgroundDark() noexcept;
64
70 static void removeFormLayoutRow(QLabel& label) noexcept;
71
77 static void deleteLayoutItemRecursively(QLayoutItem* item) noexcept;
78
97 static bool startToolBarTabFocusCycle(QToolBar& toolBar,
98 QWidget& returnFocusToWidget) noexcept;
99
100private:
110 static bool removeFormLayoutRow(QLayout& layout, QLabel& label) noexcept;
111
117 static void hideLayoutItem(QLayoutItem& item) noexcept;
118};
119
120/*******************************************************************************
121 * End of File
122 ******************************************************************************/
123
124} // namespace editor
125} // namespace librepcb
126
127#endif
The EditorToolbox class provides some useful general purpose methods for editors (i....
Definition editortoolbox.h:43
static bool startToolBarTabFocusCycle(QToolBar &toolBar, QWidget &returnFocusToWidget) noexcept
Set the focus to the first widget of a toolbar and iterate through.
Definition editortoolbox.cpp:80
static bool isWindowBackgroundDark() noexcept
Detect if the default (theme dependent) window background is dark.
Definition editortoolbox.cpp:38
static void removeFormLayoutRow(QLabel &label) noexcept
Remove (hide) a whole row in a QFormLayout.
Definition editortoolbox.cpp:56
static void hideLayoutItem(QLayoutItem &item) noexcept
Helper for removeFormLayoutRow()
Definition editortoolbox.cpp:132
EditorToolbox & operator=(const EditorToolbox &rhs)=delete
static void deleteLayoutItemRecursively(QLayoutItem *item) noexcept
Delete a QLayout item with all its children.
Definition editortoolbox.cpp:66
EditorToolbox(const EditorToolbox &other)=delete
Definition occmodel.cpp:76