dust3d/application/sources/component_list_model.h

34 lines
1.1 KiB
C
Raw Normal View History

#ifndef DUST3D_APPLICATION_COMPONENT_LIST_MODEL_H_
#define DUST3D_APPLICATION_COMPONENT_LIST_MODEL_H_
2022-10-06 09:05:09 +00:00
#include <unordered_map>
#include <dust3d/base/uuid.h>
2022-10-06 09:05:09 +00:00
#include <QAbstractListModel>
class Document;
class SkeletonComponent;
class ComponentListModel: public QAbstractListModel
{
Q_OBJECT
signals:
void listingComponentChanged(const dust3d::Uuid &componentId);
public:
ComponentListModel(const Document *document, QObject *parent=nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
2022-10-03 00:06:25 +00:00
const SkeletonComponent *modelIndexToComponent(const QModelIndex &index) const;
2022-10-04 11:45:21 +00:00
const dust3d::Uuid modelIndexToComponentId(const QModelIndex &index) const;
const dust3d::Uuid listingComponentId() const;
public slots:
void setListingComponentId(const dust3d::Uuid &componentId);
2022-10-06 09:05:09 +00:00
void reload();
private:
const Document *m_document = nullptr;
dust3d::Uuid m_listingComponentId;
2022-10-06 09:05:09 +00:00
std::unordered_map<dust3d::Uuid, QModelIndex> m_componentIdToIndexMap;
};
#endif