7#include "qml_material/export.hpp"
11class QQmlInstanceModel;
12class QQmlDelegateModel;
19class QML_MATERIAL_API ComboBoxModel :
public QObject {
22 explicit ComboBoxModel(QQmlContext*, QObject* parent =
nullptr);
23 ~ComboBoxModel()
override;
24 QVariant model()
const;
25 void setModel(
const QVariant&);
26 void setDelegate(QQmlComponent*);
27 QQmlComponent* delegate()
const;
28 QQmlInstanceModel* delegateModel()
const;
31 QString textRole()
const {
return m_text_role; }
32 void setTextRole(
const QString&);
33 QString valueRole()
const {
return m_value_role; }
34 void setValueRole(
const QString&);
35 QString textAt(
int)
const;
36 QVariant valueAt(
int)
const;
37 int indexOfValue(
const QVariant&)
const;
38 int indexOf(QObject*)
const;
40 Q_SIGNAL
void modelChanged();
41 Q_SIGNAL
void delegateModelChanged();
42 Q_SIGNAL
void countChanged();
43 Q_SIGNAL
void changed();
44 Q_SIGNAL
void itemCreated(QObject*
object);
47 QVariant roleAt(
int,
const QString&)
const;
51 QPointer<QQmlContext> m_context;
53 QPointer<QObject> m_source;
54 QPointer<QQmlComponent> m_delegate;
55 QPointer<QQmlInstanceModel> m_instance;
56 std::unique_ptr<QQmlDelegateModel> m_owned;
57 QList<QMetaObject::Connection> m_connections;
58 QMetaObject::Connection m_data_connection;
59 QString m_text_role, m_value_role;
61 bool m_complete =
false;