1 /* 2 Copyright (C) 2015 Volker Krause <vkrause@kde.org> 3 4 This program is free software; you can redistribute it and/or modify it 5 under the terms of the GNU Library General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or (at your 7 option) any later version. 8 9 This program is distributed in the hope that it will be useful, but WITHOUT 10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef FILELISTMODEL_H 19 #define FILELISTMODEL_H 20 21 #include <QAbstractListModel> 22 23 class ElfFileSet; 24 25 /** Simple flat list of all files in an ElfFileSet. */ 26 class FileListModel : public QAbstractListModel 27 { 28 Q_OBJECT 29 public: 30 enum Role { 31 FileIndexRole = Qt::UserRole + 1, 32 FileRole 33 }; 34 explicit FileListModel(QObject* parent = nullptr); 35 ~FileListModel(); 36 37 ElfFileSet *fileSet() const; 38 void setFileSet(ElfFileSet *fileSet); 39 40 QVariant data(const QModelIndex& index, int role) const override; 41 int rowCount(const QModelIndex& parent) const override; 42 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; 43 44 private: 45 ElfFileSet *m_fileSet = nullptr; 46 }; 47 48 #endif // FILELISTMODEL_H 49