3#include <QAbstractTableModel>
5#include <qqmlregistration.h>
6#include "qml_material/export.hpp"
10class QML_MATERIAL_API HeaderListModel :
public QAbstractTableModel {
13 Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
14 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY
15 orientationChanged FINAL)
17 explicit HeaderListModel(QObject* parent =
nullptr);
18 QVariant source()
const;
19 void setSource(
const QVariant& source);
20 bool trySetSource(
const QVariant& source);
21 Qt::Orientation orientation()
const {
return m_orientation; }
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 QHash<int, QByteArray> roleNames()
const override;
27 Q_SIGNAL
void sourceChanged();
28 Q_SIGNAL
void orientationChanged();
32 QModelIndex sectionIndex(
int section)
const;
35 QPointer<QAbstractItemModel> m_model;
36 QVariantList m_values;
37 QHash<int, QByteArray> m_roles;
38 Qt::Orientation m_orientation = Qt::Horizontal;
39 int m_integerCount = 0;