LibrePCB Developers Documentation
AttributeListModel Class Referencefinal

The AttributeListModel class. More...

#include <attributelistmodel.h>

Inherits QAbstractTableModel.

+ Collaboration diagram for AttributeListModel:

Public Types

enum  Column
 

Public Member Functions

 AttributeListModel ()=delete
 
 AttributeListModel (const AttributeListModel &other)=delete
 
 AttributeListModel (QObject *parent=nullptr) noexcept
 
 ~AttributeListModel () noexcept
 
void setAttributeList (AttributeList *list) noexcept
 
void setUndoStack (UndoStack *stack) noexcept
 
void add (const QPersistentModelIndex &itemIndex) noexcept
 
void remove (const QPersistentModelIndex &itemIndex) noexcept
 
void moveUp (const QPersistentModelIndex &itemIndex) noexcept
 
void moveDown (const QPersistentModelIndex &itemIndex) noexcept
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
AttributeListModeloperator= (const AttributeListModel &rhs) noexcept
 

Private Member Functions

void attributeListEdited (const AttributeList &list, int index, const std::shared_ptr< const Attribute > &attribute, AttributeList::Event event) noexcept
 
void execCmd (UndoCommand *cmd)
 
AttributeKey validateKeyOrThrow (const QString &key) const
 

Static Private Member Functions

static ComboBoxDelegate::Items buildUnitComboBoxData (const AttributeType &type) noexcept
 

Private Attributes

AttributeListmAttributeList
 
UndoStackmUndoStack
 
ComboBoxDelegate::Items mTypeComboBoxItems
 
QString mNewKey
 
const AttributeTypemNewType
 
QString mNewValue
 
const AttributeUnitmNewUnit
 
AttributeList::OnEditedSlot mOnEditedSlot
 

Detailed Description

The AttributeListModel class.

Member Enumeration Documentation

◆ Column

enum Column
Enumerator
COLUMN_KEY 
COLUMN_TYPE 
COLUMN_VALUE 
COLUMN_UNIT 
COLUMN_ACTIONS 
_COLUMN_COUNT 

Constructor & Destructor Documentation

◆ AttributeListModel() [1/3]

AttributeListModel ( )
delete

◆ AttributeListModel() [2/3]

AttributeListModel ( const AttributeListModel other)
delete

◆ AttributeListModel() [3/3]

AttributeListModel ( QObject *  parent = nullptr)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~AttributeListModel()

~AttributeListModel ( )
noexcept

Member Function Documentation

◆ setAttributeList()

void setAttributeList ( AttributeList list)
noexcept

◆ setUndoStack()

void setUndoStack ( UndoStack stack)
noexcept

◆ add()

void add ( const QPersistentModelIndex &  itemIndex)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

void remove ( const QPersistentModelIndex &  itemIndex)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveUp()

void moveUp ( const QPersistentModelIndex &  itemIndex)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveDown()

void moveDown ( const QPersistentModelIndex &  itemIndex)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rowCount()

int rowCount ( const QModelIndex &  parent = QModelIndex()) const
override
+ Here is the call graph for this function:

◆ columnCount()

int columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ data()

QVariant data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override
+ Here is the call graph for this function:

◆ headerData()

QVariant headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override
+ Here is the call graph for this function:

◆ flags()

Qt::ItemFlags flags ( const QModelIndex &  index) const
override
+ Here is the call graph for this function:

◆ setData()

bool setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override
+ Here is the call graph for this function:

◆ operator=()

AttributeListModel & operator= ( const AttributeListModel rhs)
noexcept

◆ attributeListEdited()

void attributeListEdited ( const AttributeList list,
int  index,
const std::shared_ptr< const Attribute > &  attribute,
AttributeList::Event  event 
)
privatenoexcept

◆ execCmd()

void execCmd ( UndoCommand cmd)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateKeyOrThrow()

AttributeKey validateKeyOrThrow ( const QString &  key) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildUnitComboBoxData()

ComboBoxDelegate::Items buildUnitComboBoxData ( const AttributeType type)
staticprivatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mAttributeList

AttributeList* mAttributeList
private

◆ mUndoStack

UndoStack* mUndoStack
private

◆ mTypeComboBoxItems

ComboBoxDelegate::Items mTypeComboBoxItems
private

◆ mNewKey

QString mNewKey
private

◆ mNewType

const AttributeType* mNewType
private

◆ mNewValue

QString mNewValue
private

◆ mNewUnit

const AttributeUnit* mNewUnit
private

◆ mOnEditedSlot

AttributeList::OnEditedSlot mOnEditedSlot
private

The documentation for this class was generated from the following files: