ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
FF7ItemModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2022 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QAbstractTableModel>
7 #include <ff7tkdata_export.h>
8 #include <FF7Item>
9 
10 class FF7TKDATA_EXPORT FF7ItemModel : public QAbstractTableModel
11 {
12  Q_OBJECT
13  Q_PROPERTY(QList<quint16> items READ allItems WRITE setItems NOTIFY itemsChanged)
14 public:
15  explicit FF7ItemModel(QObject *parent = nullptr, const QList<quint16> &initialItems = QList<quint16>(320, FF7Item::EmptyItemData));
16  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
17  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
18  QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const override;
19  bool setData(const QModelIndex &index = QModelIndex(), const QVariant &value = QVariant(), int role = Qt::EditRole) override;
20  Qt::ItemFlags flags(const QModelIndex &index = QModelIndex()) const override;
21  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
27  bool setItems(const QList<quint16> &newItems = {});
32  bool resetItems(const QList<quint16> &newItems = {});
33  QList<quint16> allItems();
34 signals:
35  void itemsChanged(QList<quint16>);
36 private:
37  QList<quint16> items;
38 };
FF7ItemModel
Definition: FF7ItemModel.h:10
FF7Item::EmptyItemData
@ EmptyItemData
Definition: FF7Item.h:84