1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef PICTUREMODEL_H
- #define PICTUREMODEL_H
- #include <QAbstractListModel>
- class FSNode;
- class PictureModel : public QAbstractListModel
- {
- Q_OBJECT
- public:
- enum PictureRoles {
- PathRole = Qt::UserRole + 1
- };
- PictureModel(QObject *parent = nullptr);
- ~PictureModel();
- int rowCount(const QModelIndex & parent = QModelIndex()) const;
- Q_INVOKABLE QString randomPicture() const;
- QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
- Q_INVOKABLE void setModelRoot(const QString &root);
- void addSupportedExtension(const QString &extension);
- void addModelNode(const FSNode *parent);
- QString qualifyNode(const FSNode *node) const;
- protected:
- QHash<int, QByteArray> roleNames() const;
- private:
- QList<const FSNode*> files;
- QStringList extensions;
- };
- #endif // PICTUREMODEL_H
|