LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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) noexcept
 
 AttributeListModel (QObject *parent=nullptr) noexcept
 
 ~AttributeListModel () noexcept
 
void setAttributeList (AttributeList *list) noexcept
 
void setUndoStack (UndoStack *stack) noexcept
 
void addAttribute (const QVariant &editData) noexcept
 
void removeAttribute (const QVariant &editData) noexcept
 
void moveAttributeUp (const QVariant &editData) noexcept
 
void moveAttributeDown (const QVariant &editData) 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 QVector< QPair< QString,
QVariant > > 
buildUnitComboBoxData (const AttributeType &type) noexcept
 

Private Attributes

AttributeListmAttributeList
 
UndoStackmUndoStack
 
QVector< QPair< QString,
QVariant > > 
mTypeComboBoxItems
 
QString mNewKey
 
const AttributeTypemNewType
 
QString mNewValue
 
const AttributeUnitmNewUnit
 
AttributeList::OnEditedSlot mOnEditedSlot
 

Detailed Description

The AttributeListModel class.

Member Enumeration Documentation

enum Column
Enumerator
COLUMN_KEY 
COLUMN_TYPE 
COLUMN_VALUE 
COLUMN_UNIT 
COLUMN_ACTIONS 
_COLUMN_COUNT 

Constructor & Destructor Documentation

AttributeListModel ( )
delete
AttributeListModel ( const AttributeListModel other)
noexcept
AttributeListModel ( QObject *  parent = nullptr)
explicitnoexcept

+ Here is the call graph for this function:

~AttributeListModel ( )
noexcept

Member Function Documentation

void setAttributeList ( AttributeList list)
noexcept
void setUndoStack ( UndoStack stack)
noexcept
void addAttribute ( const QVariant &  editData)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeAttribute ( const QVariant &  editData)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void moveAttributeUp ( const QVariant &  editData)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void moveAttributeDown ( const QVariant &  editData)
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the call graph for this function:

int columnCount ( const QModelIndex &  parent = QModelIndex()) const
override
QVariant data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

+ Here is the call graph for this function:

QVariant headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

+ Here is the call graph for this function:

Qt::ItemFlags flags ( const QModelIndex &  index) const
override

+ Here is the call graph for this function:

bool setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

+ Here is the call graph for this function:

AttributeListModel& operator= ( const AttributeListModel rhs)
noexcept
void attributeListEdited ( const AttributeList list,
int  index,
const std::shared_ptr< const Attribute > &  attribute,
AttributeList::Event  event 
)
privatenoexcept
void execCmd ( UndoCommand cmd)
private

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AttributeKey validateKeyOrThrow ( const QString &  key) const
private

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QVector< QPair< QString, QVariant > > buildUnitComboBoxData ( const AttributeType type)
staticprivatenoexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

AttributeList* mAttributeList
private
UndoStack* mUndoStack
private
QVector<QPair<QString, QVariant> > mTypeComboBoxItems
private
QString mNewKey
private
const AttributeType* mNewType
private
QString mNewValue
private
const AttributeUnit* mNewUnit
private
AttributeList::OnEditedSlot mOnEditedSlot
private

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