46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#ifndef RENAMINGUTILITY_FILESYSTEMITEMMODEL_H
|
|
#define RENAMINGUTILITY_FILESYSTEMITEMMODEL_H
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
namespace RenamingUtility {
|
|
|
|
enum FileSystemItemModelRole {
|
|
CheckableRole = Qt::UserRole + 1,
|
|
ErrorStatusRole = Qt::UserRole + 2
|
|
};
|
|
|
|
class FileSystemItem;
|
|
|
|
class FileSystemItemModel : public QAbstractItemModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
FileSystemItemModel(FileSystemItem *rootItem, QObject *parent = nullptr);
|
|
virtual ~FileSystemItemModel();
|
|
|
|
void setRootItem(FileSystemItem *rootItem);
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
int role = Qt::DisplayRole) const;
|
|
QModelIndex index(int row, int column,
|
|
const QModelIndex &parent = QModelIndex()) const;
|
|
QModelIndex index(FileSystemItem *item, int column = 0) const;
|
|
QModelIndex parent(const QModelIndex &index) const;
|
|
QModelIndex counterpart(const QModelIndex &index, int column);
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
|
int columnCount(const QModelIndex &index = QModelIndex()) const;
|
|
|
|
|
|
private:
|
|
FileSystemItem *m_rootItem;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // RENAMINGUTILITY_FILESYSTEMITEMMODEL_H
|