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;
Item delegate that formats recent file entries with human-readable size information.
Definition recentcapturefiles_list_model.h:128
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
Qt model for displaying recent capture files.
Definition recentcapturefiles_list_model.h:27
~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
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
Proxy model that reverses row order for display (newest first).
Definition recentcapturefiles_list_model.h:93
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