10 #include <QFileSystemModel>
24 explicit ProjectView(QWidget *parent =
nullptr) : QTreeView(parent)
26 m_fileSystemModel =
new QFileSystemModel;
27 QTreeView::setModel(m_fileSystemModel);
30 setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
32 for (
int i{1}; i <
size().width(); ++i)
37 &QTreeView::customContextMenuRequested,
44 m_fileSystemModel->setRootPath(
path);
45 setRootIndex(m_fileSystemModel->index(
path));
50 return m_fileSystemModel->filePath(index);
55 return m_fileSystemModel->rootDirectory().filePath(
relativePathAt(index));
59 QFileSystemModel *m_fileSystemModel;
QString absolutePathAt(const QModelIndex &index) const
ProjectView(QWidget *parent=nullptr)
void setRootPath(const QString &path)
friend class ProjectViewContextMenu
QString relativePathAt(const QModelIndex &index) const
static const std::string path