tageditor/renamingutility/filesystemitemmodel.h

45 lines
1.4 KiB
C
Raw Normal View History

2015-04-22 19:33:53 +02:00
#ifndef RENAMINGUTILITY_FILESYSTEMITEMMODEL_H
#define RENAMINGUTILITY_FILESYSTEMITEMMODEL_H
#include <QAbstractItemModel>
namespace RenamingUtility {
enum FileSystemItemModelRole {
CheckableRole = Qt::UserRole + 1,
ErrorStatusRole = Qt::UserRole + 2
};
class FileSystemItem;
2016-05-07 00:00:59 +02:00
class FileSystemItemModel : public QAbstractItemModel
{
2015-04-22 19:33:53 +02:00
Q_OBJECT
public:
2017-01-06 21:29:43 +01:00
explicit FileSystemItemModel(FileSystemItem *rootItem, QObject *parent = nullptr);
~FileSystemItemModel();
2015-04-22 19:33:53 +02:00
void setRootItem(FileSystemItem *rootItem);
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
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