16#ifndef QGSLISTWIDGET_H
17#define QGSLISTWIDGET_H
20#include <QAbstractTableModel>
33class GUI_EXPORT QgsListModel :
public QAbstractTableModel
38 explicit QgsListModel( QMetaType::Type subType, QObject *parent =
nullptr );
39 void setList(
const QVariantList &list );
40 QVariantList list()
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 );
53 bool mReadOnly =
false;
55 QMetaType::Type mSubType;
68 Q_PROPERTY( QVariantList list READ list WRITE setList )
74 explicit QgsListWidget( QMetaType::Type subType, QWidget *parent =
nullptr );
79 void setList(
const QVariantList &list );
85 QVariantList
list()
const {
return mModel.list(); }
91 bool valid()
const {
return mModel.valid(); }
95 void setReadOnly(
bool readOnly )
override;