File indexing completed on 2024-05-12 05:35:40

0001 /*
0002     SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0003     SPDX-FileCopyrightText: 2023 Jeremy Whiting <jpwhiting@kde.org>
0004     SPDX-FileCopyrightText: 2023 Niccolò Venerandi <niccolo@venerandi.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QAbstractTableModel>
0012 
0013 #include "gamepad.h"
0014 
0015 class AxesModel : public QAbstractTableModel
0016 {
0017     Q_OBJECT
0018 
0019     Q_PROPERTY(Gamepad *device MEMBER m_device NOTIFY deviceChanged REQUIRED)
0020 
0021 public:
0022     explicit AxesModel(QObject *parent = nullptr);
0023 
0024     int rowCount(const QModelIndex &) const override;
0025     int columnCount(const QModelIndex &) const override;
0026 
0027     QVariant data(const QModelIndex &index, int role) const override;
0028 
0029     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0030 
0031 Q_SIGNALS:
0032     void deviceChanged();
0033 
0034 private:
0035     Gamepad *m_device = nullptr;
0036 };