20#ifndef LIBREPCB_EDITOR_CATEGORYTREEMODEL_H
21#define LIBREPCB_EDITOR_CATEGORYTREEMODEL_H
37class WorkspaceLibraryDb;
54 QVector<std::shared_ptr<Item>>
childs;
63 CmpCatWithSymbols = 1 << 1,
65 CmpCatWithComponents = 1 << 2,
67 CmpCatWithDevices = 1 << 3,
71 PkgCatWithPackages = 1 << 5,
73 Q_DECLARE_FLAGS(Filters,
Filter)
79 const QStringList& localeOrder,
80 Filters filters) noexcept;
88 const QModelIndex&
parent = QModelIndex()) const noexcept override;
90 const QModelIndex&
parent = QModelIndex()) const noexcept override;
93 const QModelIndex&
parent = QModelIndex()) const noexcept override;
94 QModelIndex
parent(const QModelIndex&
index) const noexcept override;
95 QVariant
headerData(
int section, Qt::Orientation orientation,
96 int role = Qt::DisplayRole) const noexcept override;
98 int role = Qt::DisplayRole) const noexcept override;
111 std::shared_ptr<
Item> parentItem,
112 const QVector<std::shared_ptr<
Item>>& newChilds) noexcept;
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:58
The CategoryTreeModel class.
Definition: categorytreemodel.h:48
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const noexcept override
Definition: categorytreemodel.cpp:101
Item * itemFromIndex(const QModelIndex &index) const noexcept
Definition: categorytreemodel.cpp:283
void updateModelItem(std::shared_ptr< Item > parentItem, const QVector< std::shared_ptr< Item > > &newChilds) noexcept
Definition: categorytreemodel.cpp:239
bool listPackageCategories() const noexcept
Definition: categorytreemodel.cpp:234
bool containsItems(const tl::optional< Uuid > &uuid) const
Definition: categorytreemodel.cpp:207
std::shared_ptr< Item > mRootItem
Definition: categorytreemodel.h:120
QModelIndex parent(const QModelIndex &index) const noexcept override
Definition: categorytreemodel.cpp:93
QModelIndex indexFromItem(const Item *item) const noexcept
Definition: categorytreemodel.cpp:298
bool listAll() const noexcept
Definition: categorytreemodel.cpp:230
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const noexcept override
Definition: categorytreemodel.cpp:83
int columnCount(const QModelIndex &parent=QModelIndex()) const noexcept override
Definition: categorytreemodel.cpp:73
int rowCount(const QModelIndex &parent=QModelIndex()) const noexcept override
Definition: categorytreemodel.cpp:78
const Filters mFilters
Definition: categorytreemodel.h:119
void update() noexcept
Definition: categorytreemodel.cpp:135
Filter
Definition: categorytreemodel.h:59
QStringList mLocaleOrder
Definition: categorytreemodel.h:118
void setLocaleOrder(const QStringList &order) noexcept
Definition: categorytreemodel.cpp:62
QVector< std::shared_ptr< Item > > getChilds(std::shared_ptr< Item > parent) const noexcept
Definition: categorytreemodel.cpp:163
const WorkspaceLibraryDb & mLibrary
Definition: categorytreemodel.h:117
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const noexcept override
Definition: categorytreemodel.cpp:114
Definition: occmodel.cpp:77
Definition: categorytreemodel.h:49
QString text
Definition: categorytreemodel.h:52
QString tooltip
Definition: categorytreemodel.h:53
QVector< std::shared_ptr< Item > > childs
Definition: categorytreemodel.h:54
tl::optional< Uuid > uuid
tl::nullopt for items without category
Definition: categorytreemodel.h:51
std::weak_ptr< Item > parent
nullptr for root categories
Definition: categorytreemodel.h:50