3#include "qml_material/model/header_data_model.hpp"
4#include "qml_material/model/header_list_model.hpp"
8class QML_MATERIAL_API HeaderModel :
public QObject {
11 Q_PROPERTY(QVariant model READ model WRITE setModel RESET resetModel NOTIFY modelChanged FINAL)
12 Q_PROPERTY(QAbstractItemModel* syncModel READ syncModel WRITE setSyncModel NOTIFY
13 syncModelChanged FINAL)
14 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY
15 orientationChanged FINAL)
17 SourceMode sourceMode READ sourceMode WRITE setSourceMode NOTIFY sourceModeChanged FINAL)
18 Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
20 QAbstractItemModel* effectiveModel READ effectiveModel NOTIFY effectiveModelChanged FINAL)
21 Q_PROPERTY(
int sectionCount READ sectionCount NOTIFY contentChanged FINAL)
22 Q_PROPERTY(QStringList texts READ texts NOTIFY contentChanged FINAL)
31 explicit HeaderModel(QObject* parent =
nullptr);
32 QVariant model()
const;
33 void setModel(
const QVariant&);
34 Q_INVOKABLE
void resetModel();
35 QAbstractItemModel* syncModel()
const {
return m_sync; }
36 void setSyncModel(QAbstractItemModel*);
37 void setSyncSource(
const QVariant&);
38 Qt::Orientation orientation()
const {
return m_orientation; }
39 void setOrientation(Qt::Orientation);
40 SourceMode sourceMode()
const {
return m_mode; }
41 void setSourceMode(SourceMode);
42 QString textRole()
const {
return m_textRole; }
43 void setTextRole(
const QString&);
44 QAbstractItemModel* effectiveModel()
const {
return m_effective; }
45 int sectionCount()
const;
46 QStringList texts()
const;
47 Q_SIGNAL
void modelChanged();
48 Q_SIGNAL
void syncModelChanged();
49 Q_SIGNAL
void orientationChanged();
50 Q_SIGNAL
void sourceModeChanged();
51 Q_SIGNAL
void textRoleChanged();
52 Q_SIGNAL
void effectiveModelChanged();
53 Q_SIGNAL
void contentChanged();
57 HeaderDataModel m_header;
58 HeaderListModel m_list;
59 QAbstractItemModel* m_effective = &m_header;
60 QPointer<QAbstractItemModel> m_sync;
61 QPointer<QObject> m_object;
62 QMetaObject::Connection m_syncDestroyed, m_modelDestroyed;
65 Qt::Orientation m_orientation = Qt::Horizontal;
66 SourceMode m_mode = Auto;
67 bool m_explicit =
false;
68 bool m_updating =
false;