Skip to content
Permalink
Browse files
QgsMapLayerComboBox: allow setting filters within QtDesigner
  • Loading branch information
3nids committed May 12, 2014
1 parent ebe1f2e commit 105155bd9b3fd954d7713c6236ff0aca3f6c3210
Showing with 19 additions and 24 deletions.
  1. +7 −12 python/gui/qgsmaplayercombobox.sip
  2. +1 −0 src/customwidgets/qgsmaplayercomboboxplugin.h
  3. +10 −12 src/gui/qgsmaplayercombobox.h
  4. +1 −0 src/gui/qgsmaplayerproxymodel.h
@@ -16,25 +16,20 @@ class QgsMapLayerComboBox : QComboBox
*/
explicit QgsMapLayerComboBox( QWidget *parent /TransferThis/ = 0 );

/**
* @brief setFilters allows fitering according to layer type and/or geometry type.
*/
//! setFilters allows fitering according to layer type and/or geometry type.
void setFilters( QgsMapLayerProxyModel::Filters filters );

/**
* @brief currentLayer returns the current layer selected in the combo box
*/
//! currently used filter on list layers
QgsMapLayerProxyModel::Filters getFilters();

///! currentLayer returns the current layer selected in the combo box
QgsMapLayer* currentLayer();

public slots:
/**
* @brief setLayer set the current layer selected in the combo
*/
//! setLayer set the current layer selected in the combo
void setLayer( QgsMapLayer* layer );

signals:
/**
* @brief layerChanged this signal is emitted whenever the currently selected layer changes
*/
//! layerChanged this signal is emitted whenever the currently selected layer changes
void layerChanged( QgsMapLayer* layer );
};
@@ -43,4 +43,5 @@ class CUSTOMWIDGETS_EXPORT QgsMapLayerComboBoxPlugin : public QObject, public QD
QString whatsThis() const;
QString domXml() const;
};

#endif // QGSMAPLAYERCOMBOBOXPLUGIN_H
@@ -30,33 +30,31 @@ class QgsVectorLayer;
class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
{
Q_OBJECT
Q_FLAGS( QgsMapLayerProxyModel::Filters )
Q_PROPERTY( QgsMapLayerProxyModel::Filters filters READ getFilters WRITE setFilters )

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 = 0 );

/**
* @brief setFilters allows fitering according to layer type and/or geometry type.
*/
//! setFilters allows fitering according to layer type and/or geometry type.
void setFilters( QgsMapLayerProxyModel::Filters filters );

/**
* @brief currentLayer returns the current layer selected in the combo box
*/
//! currently used filter on list layers
QgsMapLayerProxyModel::Filters getFilters() {return mProxyModel->filters();}

//! currentLayer returns the current layer selected in the combo box
QgsMapLayer* currentLayer();

public slots:
/**
* @brief setLayer set the current layer selected in the combo
*/
//! setLayer set the current layer selected in the combo
void setLayer( QgsMapLayer* layer );

signals:
/**
* @brief layerChanged this signal is emitted whenever the currently selected layer changes
*/
//! layerChanged this signal is emitted whenever the currently selected layer changes
void layerChanged( QgsMapLayer* layer );

protected slots:
@@ -27,6 +27,7 @@ class QgsMapLayerModel;
class GUI_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_FLAGS( Filters )
public:
enum Filter
{

0 comments on commit 105155b

Please sign in to comment.