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