20#ifndef LIBREPCB_EDITOR_ATTRIBUTELISTMODEL_H
21#define LIBREPCB_EDITOR_ATTRIBUTELISTMODEL_H
26#include "../modelview/comboboxdelegate.h"
72 void add(const QPersistentModelIndex& itemIndex) noexcept;
73 void remove(const QPersistentModelIndex& itemIndex) noexcept;
74 void moveUp(const QPersistentModelIndex& itemIndex) noexcept;
75 void moveDown(const QPersistentModelIndex& itemIndex) noexcept;
78 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
79 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
80 QVariant
data(const QModelIndex& index,
81 int role = Qt::DisplayRole) const override;
82 QVariant
headerData(
int section, Qt::Orientation orientation,
83 int role = Qt::DisplayRole) const override;
84 Qt::ItemFlags
flags(const QModelIndex& index) const override;
85 bool setData(const QModelIndex& index, const QVariant& value,
86 int role = Qt::EditRole) override;
93 const std::shared_ptr<const
Attribute>& attribute,
The Attribute class.
Definition: attribute.h:46
The AttributeType class.
Definition: attributetype.h:42
The AttributeUnit class.
Definition: attributeunit.h:40
The AttributeListModel class.
Definition: attributelistmodel.h:48
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Definition: attributelistmodel.cpp:265
void attributeListEdited(const AttributeList &list, int index, const std::shared_ptr< const Attribute > &attribute, AttributeList::Event event) noexcept
Definition: attributelistmodel.cpp:393
void execCmd(UndoCommand *cmd)
Definition: attributelistmodel.cpp:419
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: attributelistmodel.cpp:165
void moveDown(const QPersistentModelIndex &itemIndex) noexcept
Definition: attributelistmodel.cpp:144
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: attributelistmodel.cpp:297
void setAttributeList(AttributeList *list) noexcept
Definition: attributelistmodel.cpp:69
void add(const QPersistentModelIndex &itemIndex) noexcept
Definition: attributelistmodel.cpp:93
const AttributeUnit * mNewUnit
Definition: attributelistmodel.h:107
QString mNewValue
Definition: attributelistmodel.h:106
AttributeListModel(const AttributeListModel &other)=delete
AttributeKey validateKeyOrThrow(const QString &key) const
Definition: attributelistmodel.cpp:428
AttributeList * mAttributeList
Definition: attributelistmodel.h:101
AttributeListModel()=delete
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition: attributelistmodel.cpp:179
void setUndoStack(UndoStack *stack) noexcept
Definition: attributelistmodel.cpp:85
void moveUp(const QPersistentModelIndex &itemIndex) noexcept
Definition: attributelistmodel.cpp:127
void remove(const QPersistentModelIndex &itemIndex) noexcept
Definition: attributelistmodel.cpp:112
QString mNewKey
Definition: attributelistmodel.h:104
AttributeList::OnEditedSlot mOnEditedSlot
Definition: attributelistmodel.h:110
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition: attributelistmodel.cpp:313
ComboBoxDelegate::Items mTypeComboBoxItems
Definition: attributelistmodel.h:103
const AttributeType * mNewType
Definition: attributelistmodel.h:105
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition: attributelistmodel.cpp:172
UndoStack * mUndoStack
Definition: attributelistmodel.h:102
static ComboBoxDelegate::Items buildUnitComboBoxData(const AttributeType &type) noexcept
Definition: attributelistmodel.cpp:437
Column
Definition: attributelistmodel.h:52
@ COLUMN_TYPE
Definition: attributelistmodel.h:54
@ COLUMN_VALUE
Definition: attributelistmodel.h:55
@ _COLUMN_COUNT
Definition: attributelistmodel.h:58
@ COLUMN_KEY
Definition: attributelistmodel.h:53
@ COLUMN_UNIT
Definition: attributelistmodel.h:56
@ COLUMN_ACTIONS
Definition: attributelistmodel.h:57
Subclass of QStyledItemDelegate which uses QComboBox as item editor.
Definition: comboboxdelegate.h:42
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, AttributeKeyConstraint, AttributeKeyVerifier > AttributeKey
Definition: attributekey.h:84