3#include <QAbstractTableModel>
5#include <qqmlregistration.h>
6#include "qml_material/export.hpp"
10class QML_MATERIAL_API HeaderDataModel :
public QAbstractTableModel {
13 Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY
14 sourceModelChanged FINAL)
15 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY
16 orientationChanged FINAL)
18 explicit HeaderDataModel(QObject* parent =
nullptr);
19 QAbstractItemModel* sourceModel()
const {
return m_source; }
20 Qt::Orientation orientation()
const {
return m_orientation; }
21 void setSourceModel(QAbstractItemModel* source);
22 void setOrientation(Qt::Orientation orientation);
23 int rowCount(
const QModelIndex& parent = {})
const override;
24 int columnCount(
const QModelIndex& parent = {})
const override;
25 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
26 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole)
override;
27 QHash<int, QByteArray> roleNames()
const override;
28 Q_SIGNAL
void sourceModelChanged();
29 Q_SIGNAL
void orientationChanged();
32 bool validIndex(
const QModelIndex& index)
const;
34 QPointer<QAbstractItemModel> m_source;
35 Qt::Orientation m_orientation = Qt::Horizontal;