10#ifndef RECENTCAPTUREFILES_LIST_MODEL_H
11#define RECENTCAPTUREFILES_LIST_MODEL_H
13#include <QAbstractListModel>
15#include <QSortFilterProxyModel>
16#include <QStyledItemDelegate>
55 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
63 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
74 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
81 void invalidateModel();
108 QModelIndex
mapToSource(
const QModelIndex &proxyIndex)
const override;
116 QModelIndex
mapFromSource(
const QModelIndex &sourceIndex)
const override;
146 QString
displayText(
const QVariant &value,
const QLocale &locale)
const override;
154 void initStyleOption(QStyleOptionViewItem *option,
const QModelIndex &index)
const override;
162 QString formatFileSize(qint64 bytes)
const;
RecentCaptureFilesDelegate(QObject *parent=nullptr)
Constructs a RecentCaptureFilesDelegate.
Definition recentcapturefiles_list_model.cpp:139
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
Initialises the style option for rendering, applying italic style to entries whose file is inaccessib...
Definition recentcapturefiles_list_model.cpp:165
QString displayText(const QVariant &value, const QLocale &locale) const override
Returns the display string for a recent file entry.
Definition recentcapturefiles_list_model.cpp:158
RecentCaptureFilesListModel(QObject *parent=nullptr)
Constructs the model and connects it to WorkspaceState change notifications.
Definition recentcapturefiles_list_model.cpp:19
~RecentCaptureFilesListModel()
Destroys the model.
Definition recentcapturefiles_list_model.cpp:30
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of recent capture file entries.
Definition recentcapturefiles_list_model.cpp:40
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns data for the given index and role.
Definition recentcapturefiles_list_model.cpp:48
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the given index.
Definition recentcapturefiles_list_model.cpp:79
RecentFileRoles
Custom data roles for RecentCaptureFilesListModel.
Definition recentcapturefiles_list_model.h:33
@ AccessibleRole
Definition recentcapturefiles_list_model.h:36
@ FileSizeRole
Definition recentcapturefiles_list_model.h:35
@ FilenameRole
Definition recentcapturefiles_list_model.h:34
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
Maps a proxy index to the corresponding source index by mirroring the row about the midpoint of the l...
Definition recentcapturefiles_list_model.cpp:107
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
Maps a source index to the corresponding proxy index by mirroring the row about the midpoint of the l...
Definition recentcapturefiles_list_model.cpp:121
RecentCaptureFilesReverseProxyModel(QObject *parent=nullptr)
Constructs the reverse-order proxy model.
Definition recentcapturefiles_list_model.cpp:102