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