LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentpinoutlistmodel.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_COMPONENTPINOUTLISTMODEL_H
21#define LIBREPCB_EDITOR_COMPONENTPINOUTLISTMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class ComponentSignalNameListModel;
40class UndoCommand;
41class UndoStack;
42
43/*******************************************************************************
44 * Class ComponentPinoutListModel
45 ******************************************************************************/
46
51 : public QObject,
52 public slint::Model<ui::ComponentPinoutData> {
53 Q_OBJECT
54
55public:
56 // Constructors / Destructor
57 // ComponentPinoutListModel() = delete;
59 explicit ComponentPinoutListModel(QObject* parent = nullptr) noexcept;
60 ~ComponentPinoutListModel() noexcept;
61
62 // General Methods
64 const std::shared_ptr<ComponentSignalNameListModel>& sigs,
65 UndoStack* stack) noexcept;
66
67 // Implementations
68 std::size_t row_count() const override;
69 std::optional<ui::ComponentPinoutData> row_data(std::size_t i) const override;
70 void set_row_data(std::size_t i,
71 const ui::ComponentPinoutData& data) noexcept override;
72
73 // Operator Overloadings
75 delete;
76
77private:
78 ui::ComponentPinoutData createItem(
79 const ComponentPinSignalMapItem& obj) noexcept;
80 void refresh() noexcept;
81 void listEdited(const ComponentPinSignalMap& list, int index,
82 const std::shared_ptr<const ComponentPinSignalMapItem>& item,
83 ComponentPinSignalMap::Event event) noexcept;
84 void execCmd(UndoCommand* cmd);
85
86private:
91
92 QList<ui::ComponentPinoutData> mItems;
93
94 // Slots
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace editor
103} // namespace librepcb
104
105#endif
The ComponentPinSignalMapItem class maps a symbol pin to a component signal.
Definition componentpinsignalmap.h:50
The ComponentPinoutListModel class.
Definition componentpinoutlistmodel.h:52
void setReferences(ComponentPinSignalMap *list, const SymbolPinList *pins, const std::shared_ptr< ComponentSignalNameListModel > &sigs, UndoStack *stack) noexcept
Definition componentpinoutlistmodel.cpp:60
ComponentPinSignalMap::OnEditedSlot mOnEditedSlot
Definition componentpinoutlistmodel.h:95
std::optional< ui::ComponentPinoutData > row_data(std::size_t i) const override
Definition componentpinoutlistmodel.cpp:101
void execCmd(UndoCommand *cmd)
Definition componentpinoutlistmodel.cpp:192
void listEdited(const ComponentPinSignalMap &list, int index, const std::shared_ptr< const ComponentPinSignalMapItem > &item, ComponentPinSignalMap::Event event) noexcept
Definition componentpinoutlistmodel.cpp:165
void refresh() noexcept
Definition componentpinoutlistmodel.cpp:155
ComponentPinSignalMap * mList
Definition componentpinoutlistmodel.h:87
QList< ui::ComponentPinoutData > mItems
Definition componentpinoutlistmodel.h:92
std::size_t row_count() const override
Definition componentpinoutlistmodel.cpp:97
const SymbolPinList * mPins
Definition componentpinoutlistmodel.h:89
ui::ComponentPinoutData createItem(const ComponentPinSignalMapItem &obj) noexcept
Definition componentpinoutlistmodel.cpp:135
QPointer< UndoStack > mUndoStack
Definition componentpinoutlistmodel.h:90
ComponentPinoutListModel(const ComponentPinoutListModel &other)=delete
std::shared_ptr< ComponentSignalNameListModel > mSignals
Definition componentpinoutlistmodel.h:88
void set_row_data(std::size_t i, const ui::ComponentPinoutData &data) noexcept override
Definition componentpinoutlistmodel.cpp:108
The ComponentSignalNameListModel class.
Definition componentsignalnamelistmodel.h:50
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
Definition uuid.h:186