File indexing completed on 2024-05-19 05:44:25

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef STACKSMODEL_H
0008 #define STACKSMODEL_H
0009 
0010 #include <QAbstractListModel>
0011 
0012 class StacksModel : public QAbstractListModel
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit StacksModel(QObject* parent = nullptr);
0017     ~StacksModel();
0018 
0019     void setStackIndex(int index);
0020     void fillFromIndex(const QModelIndex& leaf);
0021     void clear();
0022 
0023     int rowCount(const QModelIndex& parent) const override;
0024     QVariant data(const QModelIndex& index, int role) const override;
0025     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0026 
0027 signals:
0028     void stacksFound(int stacks);
0029 
0030 private:
0031     QVector<QVector<QModelIndex>> m_data;
0032     int m_stackIndex = 0;
0033 };
0034 
0035 #endif // STACKSMODEL_H