This commit is contained in:
Misaki
2026-06-10 00:57:54 +08:00
commit 7551a85abe
2805 changed files with 373529 additions and 0 deletions
@@ -0,0 +1,30 @@
#ifndef T_TREEVIEWMODEL_H
#define T_TREEVIEWMODEL_H
#include <QAbstractItemModel>
#include <QObject>
class T_TreeItem;
class T_TreeViewModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit T_TreeViewModel(QObject* parent = nullptr);
~T_TreeViewModel();
QModelIndex parent(const QModelIndex& child) const override;
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
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;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
int getItemCount() const;
private:
QMap<QString, T_TreeItem*> _itemsMap;
T_TreeItem* _rootItem{nullptr};
};
#endif // T_TREEVIEWMODEL_H