6#ifndef ATLASGAMEMANAGER_FILEPATHMODEL_HPP
7#define ATLASGAMEMANAGER_FILEPATHMODEL_HPP
9#include <QAbstractItemModel>
21 std::vector< std::filesystem::path >
m_paths {};
22 std::unordered_map< int, std::unique_ptr< atlas::images::ImageLoader > >
loaders {};
36 QModelIndex
index(
int row,
int column,
const QModelIndex&
parent = QModelIndex() )
const override;
37 QModelIndex
parent(
const QModelIndex& child )
const override;
38 int rowCount(
const QModelIndex&
parent = QModelIndex() )
const override;
39 QVariant
data(
const QModelIndex&
index,
int role = Qt::DisplayRole )
const override;
43 bool insertRows(
int row,
int col,
const QModelIndex&
parent = QModelIndex() )
override;
44 bool removeRows(
int row,
int count,
const QModelIndex&
parent = QModelIndex() )
override;
46 const QModelIndex& sourceParent,
49 const QModelIndex& destinationParent,
50 int destinationChild )
override;
52 bool setData(
const QModelIndex&
index,
const QVariant& value,
int role = Qt::EditRole )
override;
54 Qt::ItemFlags
flags(
const QModelIndex&
index )
const override;
56 std::vector< std::filesystem::path >
getFilepaths()
const;
61 void setFilepaths(
const std::vector< std::filesystem::path >& filepaths );
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition FilepathModel.cpp:29
bool insertRows(int row, int col, const QModelIndex &parent=QModelIndex()) override
Definition FilepathModel.cpp:98
std::vector< std::filesystem::path > m_paths
Definition FilepathModel.hpp:21
std::unordered_map< int, std::unique_ptr< atlas::images::ImageLoader > > loaders
Definition FilepathModel.hpp:22
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition FilepathModel.cpp:47
QThread loading_thread
Definition FilepathModel.hpp:23
FilepathModel(QObject *parent=nullptr)
Definition FilepathModel.cpp:24
void killLoaders()
Definition FilepathModel.cpp:227
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Definition FilepathModel.cpp:76
void reloadRecord(QPersistentModelIndex index)
Definition FilepathModel.cpp:218
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition FilepathModel.cpp:89
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition FilepathModel.cpp:134
Qt::DropActions supportedDropActions() const override
Definition FilepathModel.cpp:71
std::vector< std::filesystem::path > getFilepaths() const
Definition FilepathModel.cpp:176
void refreshOnFuture(QPersistentModelIndex index, QFuture< QPixmap > future)
Definition FilepathModel.cpp:181
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
Definition FilepathModel.cpp:145
void setFilepaths(const std::vector< std::filesystem::path > &filepaths)
Definition FilepathModel.cpp:16
QModelIndex parent(const QModelIndex &child) const override
Definition FilepathModel.cpp:37
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition FilepathModel.cpp:42
CustomRoles
Definition FilepathModel.hpp:28
@ StartUserRole
Definition FilepathModel.hpp:29
@ FilepathRole
Definition FilepathModel.hpp:31
@ PixmapRole
Definition FilepathModel.hpp:30