LibrePCB Developers Documentation
layercombobox.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_LAYERCOMBOBOX_H
21#define LIBREPCB_EDITOR_LAYERCOMBOBOX_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29#include <optional.hpp>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class Layer;
37
38namespace editor {
39
40/*******************************************************************************
41 * Class LayerComboBox
42 ******************************************************************************/
43
47class LayerComboBox final : public QWidget {
48 Q_OBJECT
49
50public:
51 // Constructors / Destructor
52 explicit LayerComboBox(QWidget* parent = nullptr) noexcept;
53 LayerComboBox(const LayerComboBox& other) = delete;
54 ~LayerComboBox() noexcept;
55
56 // Getters
57 tl::optional<const Layer&> getCurrentLayer() const noexcept;
58
59 // Setters
60 void setLayers(const QSet<const Layer*>& layers) noexcept;
61 void setCurrentLayer(const Layer& layer) noexcept;
62
63 // General Methods
64 void stepUp() noexcept;
65 void stepDown() noexcept;
66
67 // Operator Overloadings
68 LayerComboBox& operator=(const LayerComboBox& rhs) = delete;
69
70signals:
71 void currentLayerChanged(const Layer& layer);
72
73private: // Methods
74 void currentIndexChanged(int index) noexcept;
75
76private: // Data
77 QScopedPointer<QComboBox> mComboBox;
78};
79
80/*******************************************************************************
81 * End of File
82 ******************************************************************************/
83
84} // namespace editor
85} // namespace librepcb
86
87#endif
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The LayerComboBox class.
Definition: layercombobox.h:47
~LayerComboBox() noexcept
Definition: layercombobox.cpp:59
void currentLayerChanged(const Layer &layer)
void currentIndexChanged(int index) noexcept
Definition: layercombobox.cpp:127
LayerComboBox(QWidget *parent=nullptr) noexcept
Definition: layercombobox.cpp:41
void stepDown() noexcept
Definition: layercombobox.cpp:116
LayerComboBox(const LayerComboBox &other)=delete
void setLayers(const QSet< const Layer * > &layers) noexcept
Definition: layercombobox.cpp:80
void stepUp() noexcept
Definition: layercombobox.cpp:109
void setCurrentLayer(const Layer &layer) noexcept
Definition: layercombobox.cpp:101
QScopedPointer< QComboBox > mComboBox
Definition: layercombobox.h:77
tl::optional< const Layer & > getCurrentLayer() const noexcept
Definition: layercombobox.cpp:66
Definition: occmodel.cpp:77
Definition: uuid.h:183