QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsfieldcombobox.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfieldcombobox.h
3
--------------------------------------
4
Date : 01.04.2014
5
Copyright : (C) 2014 Denis Rouzaud
6
Email : denis.rouzaud@gmail.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 QGSFIELDCOMBOBOX_H
17
#define QGSFIELDCOMBOBOX_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsfieldproxymodel.h
"
22
23
#include <QComboBox>
24
25
class
QgsMapLayer
;
26
class
QgsVectorLayer
;
27
class
QgsFields
;
28
37
class
GUI_EXPORT
QgsFieldComboBox
:
public
QComboBox
38
{
39
Q_OBJECT
40
Q_PROPERTY(
QgsFieldProxyModel::Filters
filters
READ
filters
WRITE
setFilters
)
41
Q_PROPERTY(
bool
allowEmptyFieldName
READ
allowEmptyFieldName
WRITE
setAllowEmptyFieldName
)
42
43
public:
48
explicit
QgsFieldComboBox
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
49
51
void
setFilters
(
QgsFieldProxyModel
::Filters
filters
);
52
54
QgsFieldProxyModel
::Filters
filters
()
const
{
return
mFieldProxyModel->filters(); }
55
60
void
setAllowEmptyFieldName(
bool
allowEmpty );
61
66
bool
allowEmptyFieldName()
const
;
67
69
QString currentField()
const
;
70
75
QgsVectorLayer
*layer()
const
;
76
87
void
setFields(
const
QgsFields
&fields );
88
97
QgsFields
fields()
const
;
98
99
signals:
101
void
fieldChanged
(
const
QString &fieldName );
102
103
public
slots:
104
110
void
setLayer
(
QgsMapLayer
*
layer
);
111
113
void
setField
(
const
QString &fieldName );
114
115
protected
slots:
116
void
indexChanged
(
int
i );
117
118
private
:
119
QgsFieldProxyModel
*mFieldProxyModel =
nullptr
;
120
};
121
122
#endif
// QGSFIELDCOMBOBOX_H
QgsFieldComboBox::setFilters
void setFilters(QgsFieldProxyModel::Filters filters)
setFilters allows filtering according to the type of field
Definition
qgsfieldcombobox.cpp:34
QgsFieldComboBox::allowEmptyFieldName
bool allowEmptyFieldName
Definition
qgsfieldcombobox.h:41
QgsFieldComboBox::fieldChanged
void fieldChanged(const QString &fieldName)
Emitted when the currently selected field changes.
QgsFieldComboBox::setLayer
void setLayer(QgsMapLayer *layer)
Sets the layer for which fields are listed in the combobox.
Definition
qgsfieldcombobox.cpp:49
QgsFieldComboBox::filters
QgsFieldProxyModel::Filters filters
Definition
qgsfieldcombobox.h:40
QgsFieldComboBox::layer
QgsVectorLayer * layer() const
Returns the layer currently associated with the combobox.
Definition
qgsfieldcombobox.cpp:55
QgsFieldComboBox::setField
void setField(const QString &fieldName)
setField sets the currently selected field
Definition
qgsfieldcombobox.cpp:70
QgsFieldComboBox::QgsFieldComboBox
QgsFieldComboBox(QWidget *parent=nullptr)
QgsFieldComboBox creates a combo box to display the fields of a layer.
Definition
qgsfieldcombobox.cpp:25
QgsFieldComboBox::indexChanged
void indexChanged(int i)
Definition
qgsfieldcombobox.cpp:109
QgsFieldComboBox::setAllowEmptyFieldName
void setAllowEmptyFieldName(bool allowEmpty)
Sets whether an optional empty field ("not set") option is shown in the combo box.
Definition
qgsfieldcombobox.cpp:39
QgsFieldProxyModel
A proxy model to filter the list of fields of a layer.
Definition
qgsfieldproxymodel.h:31
QgsFieldProxyModel::Filters
QFlags< Filter > Filters
Definition
qgsfieldproxymodel.h:52
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:45
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsfieldproxymodel.h
Generated on
for QGIS API Documentation by
1.17.0