QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgssingleitemmodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssingleitemmodel.h
3 ---------------
4 begin : May 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSINGLEITEMMODEL_H
17#define QGSSINGLEITEMMODEL_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21
22#include <QAbstractItemModel>
23
32class CORE_EXPORT QgsSingleItemModel: public QAbstractItemModel
33{
34 Q_OBJECT
35
36 public:
37
46 explicit QgsSingleItemModel( QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &text = QString(),
47 const QMap< int, QVariant > &data = QMap< int, QVariant >(), Qt::ItemFlags flags = Qt::NoItemFlags );
48
58 const QList< QMap< int, QVariant > > &columnData,
59 Qt::ItemFlags flags = Qt::NoItemFlags );
60
61 QVariant data( const QModelIndex &index, int role ) const override;
62 Qt::ItemFlags flags( const QModelIndex &index ) const override;
63 QModelIndex index( int row, int column,
64 const QModelIndex &parent = QModelIndex() ) const override;
65 QModelIndex parent( const QModelIndex &index ) const override;
66 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
67 int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
68
69 private:
70
71 QString mText;
72 QMap< int, QVariant > mData;
73 QList< QMap< int, QVariant > > mColumnData;
74 Qt::ItemFlags mFlags = Qt::NoItemFlags;
75};
76
77#endif //QGSSINGLEITEMMODEL_H
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
QModelIndex parent(const QModelIndex &index) const override
QgsSingleItemModel(QObject *parent=nullptr, const QString &text=QString(), const QMap< int, QVariant > &data=QMap< int, QVariant >(), Qt::ItemFlags flags=Qt::NoItemFlags)
Constructor for QgsSingleItemModel with the specified parent object and display text.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53