LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentsignallistmodel.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_COMPONENTSIGNALLISTMODEL_H
21#define LIBREPCB_EDITOR_COMPONENTSIGNALLISTMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Component;
38
39namespace editor {
40
41class UndoCommand;
42class UndoStack;
43
44/*******************************************************************************
45 * Class ComponentSignalListModel
46 ******************************************************************************/
47
52 : public QObject,
53 public slint::Model<ui::ComponentSignalData> {
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
58 // ComponentSignalListModel() = delete;
60 explicit ComponentSignalListModel(QObject* parent = nullptr) noexcept;
61 ~ComponentSignalListModel() noexcept;
62
63 // General Methods
64 void setReferences(Component* component, UndoStack* stack) noexcept;
65 bool add(QString names) noexcept;
66 void apply();
67
68 // Implementations
69 std::size_t row_count() const override;
70 std::optional<ui::ComponentSignalData> row_data(std::size_t i) const override;
71 void set_row_data(std::size_t i,
72 const ui::ComponentSignalData& data) noexcept override;
73
74 // Operator Overloadings
76 delete;
77
78private:
79 ui::ComponentSignalData createItem(const ComponentSignal& obj,
80 int sortIndex) noexcept;
81 void updateSortOrder(bool notify) noexcept;
82 void listEdited(const ComponentSignalList& list, int index,
83 const std::shared_ptr<const ComponentSignal>& item,
84 ComponentSignalList::Event event) noexcept;
85 void execCmd(UndoCommand* cmd);
86 CircuitIdentifier validateNameOrThrow(const QString& name) const;
87 static QString cleanForcedNetName(const QString& name) noexcept;
88
89private:
92
93 QList<ui::ComponentSignalData> mItems;
94
95 // Slots
97};
98
99/*******************************************************************************
100 * End of File
101 ******************************************************************************/
102
103} // namespace editor
104} // namespace librepcb
105
106#endif
The Component class represents a "generic" device in the library.
Definition component.h:73
The ComponentSignal class represents one signal of a component.
Definition componentsignal.h:45
The ComponentSignalListModel class.
Definition componentsignallistmodel.h:53
QList< ui::ComponentSignalData > mItems
Definition componentsignallistmodel.h:93
void execCmd(UndoCommand *cmd)
Definition componentsignallistmodel.cpp:274
void listEdited(const ComponentSignalList &list, int index, const std::shared_ptr< const ComponentSignal > &item, ComponentSignalList::Event event) noexcept
Definition componentsignallistmodel.cpp:245
void setReferences(Component *component, UndoStack *stack) noexcept
Definition componentsignallistmodel.cpp:63
void updateSortOrder(bool notify) noexcept
Definition componentsignallistmodel.cpp:218
QPointer< Component > mComponent
Definition componentsignallistmodel.h:90
static QString cleanForcedNetName(const QString &name) noexcept
Definition componentsignallistmodel.cpp:293
std::size_t row_count() const override
Definition componentsignallistmodel.cpp:142
std::optional< ui::ComponentSignalData > row_data(std::size_t i) const override
Definition componentsignallistmodel.cpp:146
void apply()
Definition componentsignallistmodel.cpp:110
CircuitIdentifier validateNameOrThrow(const QString &name) const
Definition componentsignallistmodel.cpp:283
bool add(QString names) noexcept
Definition componentsignallistmodel.cpp:88
QPointer< UndoStack > mUndoStack
Definition componentsignallistmodel.h:91
ui::ComponentSignalData createItem(const ComponentSignal &obj, int sortIndex) noexcept
Definition componentsignallistmodel.cpp:205
ComponentSignalListModel(const ComponentSignalListModel &other)=delete
ComponentSignalList::OnEditedSlot mOnEditedSlot
Definition componentsignallistmodel.h:96
void set_row_data(std::size_t i, const ui::ComponentSignalData &data) noexcept override
Definition componentsignallistmodel.cpp:153
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition undostack.h:106
Definition occmodel.cpp:77
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition circuitidentifier.h:88
Definition uuid.h:186