File indexing completed on 2024-05-12 15:54:51
0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QAbstractListModel> 0007 0008 #include "types.h" 0009 0010 class OpenFileModel : public QAbstractListModel 0011 { 0012 Q_OBJECT 0013 Q_PROPERTY(QString urlToOpen READ urlToOpen NOTIFY urlToOpenChanged) 0014 0015 public: 0016 explicit OpenFileModel(const QStringList &images, QObject *parent = nullptr); 0017 ~OpenFileModel() = default; 0018 0019 void updateOpenFiles(const QStringList &images); 0020 QString urlToOpen() const; 0021 0022 QHash<int, QByteArray> roleNames() const override; 0023 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0024 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0025 0026 Q_SIGNALS: 0027 void updatedImages(); 0028 void urlToOpenChanged(); 0029 0030 protected: 0031 QStringList m_images; 0032 };