LibrePCB Developers Documentation
CategoryTreeModel Class Referencefinal

The CategoryTreeModel class. More...

#include <categorytreemodel.h>

Inherits QAbstractItemModel.

+ Collaboration diagram for CategoryTreeModel:

Classes

struct  Item
 

Public Types

enum class  Filter
 

Public Member Functions

 CategoryTreeModel ()=delete
 
 CategoryTreeModel (const CategoryTreeModel &other)=delete
 
 CategoryTreeModel (const WorkspaceLibraryDb &library, const QStringList &localeOrder, Filters filters) noexcept
 
 ~CategoryTreeModel () noexcept
 
void setLocaleOrder (const QStringList &order) noexcept
 
int columnCount (const QModelIndex &parent=QModelIndex()) const noexcept override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const noexcept override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const noexcept override
 
QModelIndex parent (const QModelIndex &index) const noexcept override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const noexcept override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const noexcept override
 
CategoryTreeModeloperator= (const CategoryTreeModel &rhs)=delete
 

Private Member Functions

void update () noexcept
 
QVector< std::shared_ptr< Item > > getChilds (std::shared_ptr< Item > parent) const noexcept
 
bool containsItems (const tl::optional< Uuid > &uuid) const
 
bool listAll () const noexcept
 
bool listPackageCategories () const noexcept
 
void updateModelItem (std::shared_ptr< Item > parentItem, const QVector< std::shared_ptr< Item > > &newChilds) noexcept
 
ItemitemFromIndex (const QModelIndex &index) const noexcept
 
QModelIndex indexFromItem (const Item *item) const noexcept
 

Private Attributes

const WorkspaceLibraryDbmLibrary
 
QStringList mLocaleOrder
 
const Filters mFilters
 
std::shared_ptr< ItemmRootItem
 

Detailed Description

The CategoryTreeModel class.

Member Enumeration Documentation

◆ Filter

enum class Filter
strong
Enumerator
CmpCat 

Show all component categories, even empty ones.

CmpCatWithSymbols 

Show component categories containing symbols.

CmpCatWithComponents 

Show component categories containing components.

CmpCatWithDevices 

Show component categories containing devices.

PkgCat 

Show all package categories, even empty ones.

PkgCatWithPackages 

Show package categories containing packages.

Constructor & Destructor Documentation

◆ CategoryTreeModel() [1/3]

CategoryTreeModel ( )
delete

◆ CategoryTreeModel() [2/3]

CategoryTreeModel ( const CategoryTreeModel other)
delete

◆ CategoryTreeModel() [3/3]

CategoryTreeModel ( const WorkspaceLibraryDb library,
const QStringList &  localeOrder,
Filters  filters 
)
explicitnoexcept

◆ ~CategoryTreeModel()

~CategoryTreeModel ( )
noexcept

Member Function Documentation

◆ setLocaleOrder()

void setLocaleOrder ( const QStringList &  order)
noexcept

◆ columnCount()

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

◆ rowCount()

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

◆ index()

QModelIndex index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
overridenoexcept

◆ parent()

QModelIndex parent ( const QModelIndex &  index) const
overridenoexcept

◆ headerData()

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

◆ data()

QVariant data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
overridenoexcept

◆ operator=()

CategoryTreeModel & operator= ( const CategoryTreeModel rhs)
delete

◆ update()

void update ( )
privatenoexcept
+ Here is the call graph for this function:

◆ getChilds()

QVector< std::shared_ptr< CategoryTreeModel::Item > > getChilds ( std::shared_ptr< Item parent) const
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ containsItems()

bool containsItems ( const tl::optional< Uuid > &  uuid) const
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listAll()

bool listAll ( ) const
privatenoexcept

◆ listPackageCategories()

bool listPackageCategories ( ) const
privatenoexcept
+ Here is the caller graph for this function:

◆ updateModelItem()

void updateModelItem ( std::shared_ptr< Item parentItem,
const QVector< std::shared_ptr< Item > > &  newChilds 
)
privatenoexcept
+ Here is the caller graph for this function:

◆ itemFromIndex()

CategoryTreeModel::Item * itemFromIndex ( const QModelIndex &  index) const
privatenoexcept

◆ indexFromItem()

QModelIndex indexFromItem ( const Item item) const
privatenoexcept

Member Data Documentation

◆ mLibrary

const WorkspaceLibraryDb& mLibrary
private

◆ mLocaleOrder

QStringList mLocaleOrder
private

◆ mFilters

const Filters mFilters
private

◆ mRootItem

std::shared_ptr<Item> mRootItem
private

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