20#ifndef LIBREPCB_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTMODEL_H
21#define LIBREPCB_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTMODEL_H
38class LibraryElementCache;
40class UndoCommandGroup;
70 QObject* parent =
nullptr) noexcept;
80 void add(const QPersistentModelIndex& itemIndex) noexcept;
81 void remove(const QPersistentModelIndex& itemIndex) noexcept;
82 void moveUp(const QPersistentModelIndex& itemIndex) noexcept;
83 void moveDown(const QPersistentModelIndex& itemIndex) noexcept;
84 void browse(const QPersistentModelIndex& itemIndex,
85 const
Uuid& symbol) noexcept;
88 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
89 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
90 QVariant
data(const QModelIndex& index,
91 int role = Qt::DisplayRole) const override;
92 QVariant
headerData(
int section, Qt::Orientation orientation,
93 int role = Qt::DisplayRole) const override;
94 Qt::ItemFlags
flags(const QModelIndex& index) const override;
95 bool setData(const QModelIndex& index, const QVariant& value,
96 int role = Qt::EditRole) override;
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The ComponentSymbolVariantItem class represents one symbol of a component symbol variant.
Definition componentsymbolvariantitem.h:54
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The ComponentSymbolVariantItemListModel class.
Definition componentsymbolvariantitemlistmodel.h:50
void browse(const QPersistentModelIndex &itemIndex, const Uuid &symbol) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:181
ComponentSymbolVariantItemListModel()=delete
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Definition componentsymbolvariantitemlistmodel.cpp:347
Angle mNewRotation
Definition componentsymbolvariantitemlistmodel.h:118
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition componentsymbolvariantitemlistmodel.cpp:218
void moveDown(const QPersistentModelIndex &itemIndex) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:163
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition componentsymbolvariantitemlistmodel.cpp:384
std::unique_ptr< UndoCommandGroup > createSuffixUpdateCmd()
Definition componentsymbolvariantitemlistmodel.cpp:521
void setSymbolsCache(const std::shared_ptr< const LibraryElementCache > &cache) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:81
void add(const QPersistentModelIndex &itemIndex) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:97
ComponentSymbolVariantItemList * mItemList
Definition componentsymbolvariantitemlistmodel.h:111
ComponentSymbolVariantItemList::OnEditedSlot mOnEditedSlot
Definition componentsymbolvariantitemlistmodel.h:121
std::shared_ptr< const LibraryElementCache > mSymbolsCache
Definition componentsymbolvariantitemlistmodel.h:112
bool mNewIsRequired
Definition componentsymbolvariantitemlistmodel.h:116
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition componentsymbolvariantitemlistmodel.cpp:234
void setUndoStack(UndoStack *stack) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:88
void moveUp(const QPersistentModelIndex &itemIndex) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:145
void remove(const QPersistentModelIndex &itemIndex) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:130
void execCmd(UndoCommand *cmd, bool updateSuffixes=true)
Definition componentsymbolvariantitemlistmodel.cpp:493
Point mNewPosition
Definition componentsymbolvariantitemlistmodel.h:117
QString mNewSuffix
Definition componentsymbolvariantitemlistmodel.h:115
ComponentSymbolVariantItemListModel(const ComponentSymbolVariantItemListModel &other)=delete
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition componentsymbolvariantitemlistmodel.cpp:396
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition componentsymbolvariantitemlistmodel.cpp:226
UndoStack * mUndoStack
Definition componentsymbolvariantitemlistmodel.h:113
std::optional< Uuid > mNewSymbolUuid
Definition componentsymbolvariantitemlistmodel.h:114
Column
Definition componentsymbolvariantitemlistmodel.h:54
@ _COLUMN_COUNT
Definition componentsymbolvariantitemlistmodel.h:62
@ COLUMN_ISREQUIRED
Definition componentsymbolvariantitemlistmodel.h:57
@ COLUMN_SYMBOL
Definition componentsymbolvariantitemlistmodel.h:55
@ COLUMN_X
Definition componentsymbolvariantitemlistmodel.h:58
@ COLUMN_Y
Definition componentsymbolvariantitemlistmodel.h:59
@ COLUMN_ROTATION
Definition componentsymbolvariantitemlistmodel.h:60
@ COLUMN_ACTIONS
Definition componentsymbolvariantitemlistmodel.h:61
@ COLUMN_SUFFIX
Definition componentsymbolvariantitemlistmodel.h:56
void setItemList(ComponentSymbolVariantItemList *list) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:68
void itemListEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItemList::Event event) noexcept
Definition componentsymbolvariantitemlistmodel.cpp:467
Cache for fast access to library elements.
Definition libraryelementcache.h:55
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition undocommandgroup.h:44
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:76