2014-03-24 22:53:10 +01:00
|
|
|
/**
|
|
|
|
* @brief The QgsMapLayerComboBox class is a combo box which displays the list of layers
|
|
|
|
* @note added in 2.3
|
|
|
|
*/
|
|
|
|
class QgsMapLayerComboBox : QComboBox
|
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmaplayercombobox.h"
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
|
|
|
|
* The layers can be filtered and/or ordered.
|
|
|
|
*/
|
|
|
|
explicit QgsMapLayerComboBox( QWidget *parent /TransferThis/ = 0 );
|
|
|
|
|
2014-05-02 09:59:30 +02:00
|
|
|
//! setFilters allows fitering according to layer type and/or geometry type.
|
2015-10-07 11:55:34 +11:00
|
|
|
void setFilters( const QgsMapLayerProxyModel::Filters& filters );
|
2014-03-24 22:53:10 +01:00
|
|
|
|
2014-05-02 09:59:30 +02:00
|
|
|
//! currently used filter on list layers
|
2014-09-01 16:45:54 +02:00
|
|
|
QgsMapLayerProxyModel::Filters filters() const;
|
2015-03-19 22:57:51 +01:00
|
|
|
|
2015-03-10 11:18:04 +01:00
|
|
|
//! except a list of layers not to be listed
|
2015-10-07 11:55:34 +11:00
|
|
|
void setExceptedLayerList( const QList<QgsMapLayer*>& layerList );
|
2015-03-10 11:18:04 +01:00
|
|
|
|
|
|
|
//! returns the list of excepted layers
|
|
|
|
QList<QgsMapLayer*> exceptedLayerList() const;
|
2014-05-02 09:59:30 +02:00
|
|
|
|
2016-11-16 13:46:20 +10:00
|
|
|
/**
|
|
|
|
* Sets a list of data providers which should be excluded from the combobox.
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
* @see excludedProviders()
|
|
|
|
*/
|
|
|
|
void setExcludedProviders( const QStringList& providers );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of data providers which are excluded from the combobox.
|
|
|
|
* @see setExcludedProviders()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
QStringList excludedProviders() const;
|
|
|
|
|
2016-11-16 11:53:13 +10:00
|
|
|
/**
|
|
|
|
* Sets whether an optional empty layer ("not set") option is shown in the combo box.
|
|
|
|
* @see allowEmptyLayer()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
void setAllowEmptyLayer( bool allowEmpty );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the combo box allows the empty layer ("not set") choice.
|
|
|
|
* @see setAllowEmptyLayer()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
bool allowEmptyLayer() const;
|
|
|
|
|
2016-11-16 12:13:09 +10:00
|
|
|
/**
|
|
|
|
* Sets whether the CRS of layers is also included in the combo box text.
|
|
|
|
* @see showCrs()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
void setShowCrs( bool showCrs );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the combo box shows the layer's CRS.
|
|
|
|
* @see setShowCrs()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
bool showCrs() const;
|
|
|
|
|
2016-11-16 13:32:27 +10:00
|
|
|
/**
|
|
|
|
* Sets a list of additional (non map layer) items to include at the end of the combobox.
|
|
|
|
* These may represent additional layers such as layers which are not included in the map
|
|
|
|
* layer registry, or paths to layers which have not yet been loaded into QGIS.
|
|
|
|
* @see additionalItems()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
void setAdditionalItems( const QStringList& items );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the list of additional (non map layer) items included at the end of the combo box.
|
|
|
|
* @see setAdditionalItems()
|
|
|
|
* @note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
QStringList additionalItems() const;
|
|
|
|
|
2015-06-10 16:03:38 +10:00
|
|
|
/** Returns the current layer selected in the combo box.
|
|
|
|
* @see layer
|
|
|
|
*/
|
2014-09-02 08:10:32 +02:00
|
|
|
QgsMapLayer* currentLayer() const;
|
2014-03-24 22:53:10 +01:00
|
|
|
|
2015-06-10 16:03:38 +10:00
|
|
|
/** Return the layer currently shown at the specified index within the combo box.
|
|
|
|
* @param layerIndex position of layer to return
|
|
|
|
* @note added in QGIS 2.10
|
|
|
|
* @see currentLayer
|
|
|
|
*/
|
|
|
|
QgsMapLayer* layer( int layerIndex ) const;
|
|
|
|
|
2014-03-24 22:53:10 +01:00
|
|
|
public slots:
|
2014-05-02 09:59:30 +02:00
|
|
|
//! setLayer set the current layer selected in the combo
|
2014-03-24 22:53:10 +01:00
|
|
|
void setLayer( QgsMapLayer* layer );
|
|
|
|
|
|
|
|
signals:
|
2014-05-02 09:59:30 +02:00
|
|
|
//! layerChanged this signal is emitted whenever the currently selected layer changes
|
2014-03-24 22:53:10 +01:00
|
|
|
void layerChanged( QgsMapLayer* layer );
|
2016-01-04 22:51:18 +11:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void indexChanged( int i );
|
|
|
|
void rowsChanged();
|
2014-03-24 22:53:10 +01:00
|
|
|
};
|