Skip to content

Commit 105155b

Browse files
committed
QgsMapLayerComboBox: allow setting filters within QtDesigner
1 parent ebe1f2e commit 105155b

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

python/gui/qgsmaplayercombobox.sip

+7-12
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,20 @@ class QgsMapLayerComboBox : QComboBox
1616
*/
1717
explicit QgsMapLayerComboBox( QWidget *parent /TransferThis/ = 0 );
1818

19-
/**
20-
* @brief setFilters allows fitering according to layer type and/or geometry type.
21-
*/
19+
//! setFilters allows fitering according to layer type and/or geometry type.
2220
void setFilters( QgsMapLayerProxyModel::Filters filters );
2321

24-
/**
25-
* @brief currentLayer returns the current layer selected in the combo box
26-
*/
22+
//! currently used filter on list layers
23+
QgsMapLayerProxyModel::Filters getFilters();
24+
25+
///! currentLayer returns the current layer selected in the combo box
2726
QgsMapLayer* currentLayer();
2827

2928
public slots:
30-
/**
31-
* @brief setLayer set the current layer selected in the combo
32-
*/
29+
//! setLayer set the current layer selected in the combo
3330
void setLayer( QgsMapLayer* layer );
3431

3532
signals:
36-
/**
37-
* @brief layerChanged this signal is emitted whenever the currently selected layer changes
38-
*/
33+
//! layerChanged this signal is emitted whenever the currently selected layer changes
3934
void layerChanged( QgsMapLayer* layer );
4035
};

src/customwidgets/qgsmaplayercomboboxplugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ class CUSTOMWIDGETS_EXPORT QgsMapLayerComboBoxPlugin : public QObject, public QD
4343
QString whatsThis() const;
4444
QString domXml() const;
4545
};
46+
4647
#endif // QGSMAPLAYERCOMBOBOXPLUGIN_H

src/gui/qgsmaplayercombobox.h

+10-12
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,31 @@ class QgsVectorLayer;
3030
class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
3131
{
3232
Q_OBJECT
33+
Q_FLAGS( QgsMapLayerProxyModel::Filters )
34+
Q_PROPERTY( QgsMapLayerProxyModel::Filters filters READ getFilters WRITE setFilters )
35+
3336
public:
3437
/**
3538
* @brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
3639
* The layers can be filtered and/or ordered.
3740
*/
3841
explicit QgsMapLayerComboBox( QWidget *parent = 0 );
3942

40-
/**
41-
* @brief setFilters allows fitering according to layer type and/or geometry type.
42-
*/
43+
//! setFilters allows fitering according to layer type and/or geometry type.
4344
void setFilters( QgsMapLayerProxyModel::Filters filters );
4445

45-
/**
46-
* @brief currentLayer returns the current layer selected in the combo box
47-
*/
46+
//! currently used filter on list layers
47+
QgsMapLayerProxyModel::Filters getFilters() {return mProxyModel->filters();}
48+
49+
//! currentLayer returns the current layer selected in the combo box
4850
QgsMapLayer* currentLayer();
4951

5052
public slots:
51-
/**
52-
* @brief setLayer set the current layer selected in the combo
53-
*/
53+
//! setLayer set the current layer selected in the combo
5454
void setLayer( QgsMapLayer* layer );
5555

5656
signals:
57-
/**
58-
* @brief layerChanged this signal is emitted whenever the currently selected layer changes
59-
*/
57+
//! layerChanged this signal is emitted whenever the currently selected layer changes
6058
void layerChanged( QgsMapLayer* layer );
6159

6260
protected slots:

src/gui/qgsmaplayerproxymodel.h

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class QgsMapLayerModel;
2727
class GUI_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel
2828
{
2929
Q_OBJECT
30+
Q_FLAGS( Filters )
3031
public:
3132
enum Filter
3233
{

0 commit comments

Comments
 (0)