16#ifndef QGSKEYVALUEWIDGET_H
17#define QGSKEYVALUEWIDGET_H
21#include <QAbstractTableModel>
34class GUI_EXPORT QgsKeyValueModel :
public QAbstractTableModel
38 explicit QgsKeyValueModel( QObject *parent =
nullptr );
39 void setMap(
const QVariantMap &map );
40 QVariantMap map()
const;
42 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
43 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
44 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
45 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
46 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
47 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
48 bool insertRows(
int position,
int rows,
const QModelIndex &parent = QModelIndex() )
override;
49 bool removeRows(
int position,
int rows,
const QModelIndex &parent = QModelIndex() )
override;
50 void setReadOnly(
bool readOnly );
51 typedef QPair<QString, QVariant> Line;
54 bool mReadOnly =
false;
67 Q_PROPERTY( QVariantMap map READ map WRITE setMap )
77 void setMap(
const QVariantMap &map );
83 QVariantMap
map()
const {
return mModel.map(); }
87 void setReadOnly(
bool readOnly )
override;
90 QgsKeyValueModel mModel;