QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgslistwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslistwidget.h
3
--------------------------------------
4
Date : 08.2016
5
Copyright : (C) 2016 Patrick Valsecchi
6
Email : patrick.valsecchi@camptocamp.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 QGSLISTWIDGET_H
17
#define QGSLISTWIDGET_H
18
19
#include "qgis_gui.h"
20
#include "
qgstablewidgetbase.h
"
21
22
#include <QAbstractTableModel>
23
#include <QVariant>
24
25
#ifndef SIP_RUN
27
33
class
GUI_EXPORT QgsListModel :
public
QAbstractTableModel
34
{
35
Q_OBJECT
36
public
:
37
explicit
QgsListModel( QMetaType::Type subType, QObject *parent =
nullptr
);
38
void
setList(
const
QVariantList &list );
39
QVariantList list()
const
;
40
bool
valid()
const
;
41
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 );
51
52
private
:
53
bool
mReadOnly =
false
;
54
QVariantList mLines;
55
QMetaType::Type mSubType;
56
};
58
#endif
59
60
65
class
GUI_EXPORT
QgsListWidget
:
public
QgsTableWidgetBase
66
{
67
Q_OBJECT
68
Q_PROPERTY( QVariantList
list
READ
list
WRITE
setList
)
69
public
:
73
explicit
QgsListWidget
( QMetaType::Type subType, QWidget *parent =
nullptr
);
74
78
void
setList
(
const
QVariantList &
list
);
79
84
QVariantList
list
()
const
{
return
mModel.list(); }
85
90
bool
valid
()
const
{
return
mModel.valid(); }
91
92
public
slots:
93
94
void
setReadOnly(
bool
readOnly )
override
;
95
96
private
:
97
QgsListModel mModel;
98
};
99
100
101
#endif
// QGSKEYVALUEWIDGET_H
QgsListWidget::list
QVariantList list() const
Gets the edit value.
Definition
qgslistwidget.h:84
QgsListWidget::valid
bool valid() const
Check the content is valid.
Definition
qgslistwidget.h:90
QgsListWidget::list
QVariantList list
Definition
qgslistwidget.h:68
QgsListWidget::QgsListWidget
QgsListWidget(QMetaType::Type subType, QWidget *parent=nullptr)
Constructor.
Definition
qgslistwidget.cpp:22
QgsListWidget::setList
void setList(const QVariantList &list)
Set the initial value of the widget.
Definition
qgslistwidget.cpp:29
QgsTableWidgetBase::QgsTableWidgetBase
QgsTableWidgetBase(QWidget *parent)
Constructor.
Definition
qgstablewidgetbase.cpp:20
qgstablewidgetbase.h
Generated on
for QGIS API Documentation by
1.17.0