Skip to content

Commit

Permalink
QgsMapLayerComboBox: allow setting filters within QtDesigner
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 12, 2014
1 parent ebe1f2e commit 105155b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
19 changes: 7 additions & 12 deletions python/gui/qgsmaplayercombobox.sip
Expand Up @@ -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 );
};
1 change: 1 addition & 0 deletions src/customwidgets/qgsmaplayercomboboxplugin.h
Expand Up @@ -43,4 +43,5 @@ class CUSTOMWIDGETS_EXPORT QgsMapLayerComboBoxPlugin : public QObject, public QD
QString whatsThis() const;
QString domXml() const;
};

#endif // QGSMAPLAYERCOMBOBOXPLUGIN_H
22 changes: 10 additions & 12 deletions src/gui/qgsmaplayercombobox.h
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsmaplayerproxymodel.h
Expand Up @@ -27,6 +27,7 @@ class QgsMapLayerModel;
class GUI_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_FLAGS( Filters )
public:
enum Filter
{
Expand Down

0 comments on commit 105155b

Please sign in to comment.