16 #ifndef QGSLISTWIDGET_H
17 #define QGSLISTWIDGET_H
20 #include <QAbstractTableModel>
34 class GUI_EXPORT QgsListModel :
public QAbstractTableModel
39 explicit QgsListModel( QVariant::Type subType, QObject *parent =
nullptr );
40 void setList(
const QVariantList &list );
41 QVariantList list()
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;
55 QVariant::Type mSubType;
69 Q_PROPERTY( QVariantList list READ list WRITE setList )
75 explicit QgsListWidget( QVariant::Type subType, QWidget *parent =
nullptr );
80 void setList(
const QVariantList &list );
86 QVariantList
list()
const {
return mModel.list(); }
92 bool valid()
const {
return mModel.valid(); }
96 QVariant::Type mSubType;
100 #endif // QGSKEYVALUEWIDGET_H