QGIS/python/gui/qgsfieldcombobox.sip

70 lines
2.1 KiB
Plaintext
Raw Normal View History

2014-03-24 22:53:10 +01:00
/**
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
* @see QgsMapLayerComboBox
2014-03-24 22:53:10 +01:00
* @note added in 2.3
*/
class QgsFieldComboBox : QComboBox
{
%TypeHeaderCode
#include "qgsfieldcombobox.h"
%End
public:
/**
* @brief QgsFieldComboBox creates a combo box to display the fields of a layer.
* The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer.
*/
explicit QgsFieldComboBox( QWidget *parent /TransferThis/ = 0 );
//! setFilters allows fitering according to the type of field
void setFilters( QgsFieldProxyModel::Filters filters );
//! currently used filter on list of fields
2014-09-01 16:45:54 +02:00
QgsFieldProxyModel::Filters filters() const;
/**
* Sets whether an optional empty field ("not set") option is shown in the combo box.
* @see allowEmptyFieldName()
* @note added in QGIS 3.0
*/
void setAllowEmptyFieldName( bool allowEmpty );
/**
* Returns true if the combo box allows the empty field ("not set") choice.
* @see setAllowEmptyFieldName()
* @note added in QGIS 3.0
*/
bool allowEmptyFieldName() const;
//! return the currently selected field
2014-09-01 16:45:54 +02:00
QString currentField() const;
/**
* Returns the layer currently associated with the combobox.
* @see setLayer()
*/
2014-09-01 16:45:54 +02:00
QgsVectorLayer* layer() const;
2014-03-24 22:53:10 +01:00
signals:
//! the signal is emitted when the currently selected field changes
void fieldChanged( const QString& fieldName );
2014-03-24 22:53:10 +01:00
public slots:
2014-05-02 10:32:37 +02:00
/**
* Sets the layer for which fields are listed in the combobox. If no layer is set
* or a non-vector layer is set then the combobox will be empty.
* @see layer()
*/
2014-03-24 22:53:10 +01:00
void setLayer( QgsMapLayer* layer );
//! setField sets the currently selected field
void setField( const QString& fieldName );
protected slots:
void indexChanged( int i );
2014-03-24 22:53:10 +01:00
};