LibrePCB Developers Documentation
Loading...
Searching...
No Matches
graphicslayersmodel.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_GRAPHICSLAYERSMODEL_H
21#define LIBREPCB_EDITOR_GRAPHICSLAYERSMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27#include "graphicslayer.h"
28
29#include <QtCore>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35namespace editor {
36
37class GraphicsLayer;
38class GraphicsLayerList;
39
40/*******************************************************************************
41 * Class GraphicsLayersModel
42 ******************************************************************************/
43
47class GraphicsLayersModel : public QObject,
48 public slint::Model<ui::GraphicsLayerData> {
49 Q_OBJECT
50
51public:
52 // Constructors / Destructor
55 QObject* parent = nullptr) noexcept;
56 virtual ~GraphicsLayersModel() noexcept;
57
58 // Implementations
59 std::size_t row_count() const override;
60 std::optional<ui::GraphicsLayerData> row_data(std::size_t i) const override;
61 void set_row_data(std::size_t i,
62 const ui::GraphicsLayerData& data) noexcept override;
63
64 // Operator Overloadings
65 GraphicsLayersModel& operator=(const GraphicsLayersModel& rhs) = delete;
66
67signals:
69
70private:
71 void onEdited(const GraphicsLayer& layer,
72 GraphicsLayer::Event event) noexcept;
73 void updateEnabledLayers() noexcept;
74
76 QList<std::shared_ptr<GraphicsLayer>> mEnabledLayers;
77 QHash<const GraphicsLayer*, std::size_t> mIndices;
80};
81
82/*******************************************************************************
83 * End of File
84 ******************************************************************************/
85
86} // namespace editor
87} // namespace librepcb
88
89#endif
The GraphicsLayer class represents a graphical layer used in schematics and boards.
Definition graphicslayer.h:53
The GraphicsLayerList class.
Definition graphicslayerlist.h:48
The GraphicsLayersModel class.
Definition graphicslayersmodel.h:48
void set_row_data(std::size_t i, const ui::GraphicsLayerData &data) noexcept override
Definition graphicslayersmodel.cpp:80
std::optional< ui::GraphicsLayerData > row_data(std::size_t i) const override
Definition graphicslayersmodel.cpp:66
GraphicsLayer::OnEditedSlot mOnEditedSlot
Definition graphicslayersmodel.h:78
void updateEnabledLayers() noexcept
Definition graphicslayersmodel.cpp:120
QPointer< GraphicsLayerList > mList
Definition graphicslayersmodel.h:75
std::size_t row_count() const override
Definition graphicslayersmodel.cpp:62
void onEdited(const GraphicsLayer &layer, GraphicsLayer::Event event) noexcept
Definition graphicslayersmodel.cpp:91
GraphicsLayersModel(const GraphicsLayersModel &other)=delete
QTimer mDelayTimer
Definition graphicslayersmodel.h:79
QHash< const GraphicsLayer *, std::size_t > mIndices
Definition graphicslayersmodel.h:77
QList< std::shared_ptr< GraphicsLayer > > mEnabledLayers
Definition graphicslayersmodel.h:76
Definition occmodel.cpp:77
Definition uuid.h:186