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