blob: bc855f13d2c37211bc7d8cd29157b7842a59870a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef SCREENSHOTMODEL_H
#define SCREENSHOTMODEL_H
#include <QAbstractListModel>
class ScreenshotModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(QString latestScreenshot READ latestScreenshot NOTIFY latestScreenshotChanged)
public:
enum Role {
RoleFileName
};
ScreenshotModel(QObject *parent = nullptr);
QString path() const;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE QString get(int index) const;
QString latestScreenshot() const;
void clear();
void insert(const QString &filename);
void remove(const QString &filename);
signals:
void latestScreenshotChanged();
private:
QStringList m_files;
};
#endif // SCREENSHOTMODEL_H
|