Skip to content

Commit 7573b22

Browse files
committedJun 4, 2016
Improve API for QgsMapStylePanelFactory
1 parent 60df926 commit 7573b22

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed
 

‎python/gui/qgsmapstylepanel.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ class QgsMapStylePanelFactory
6969
virtual QString title() = 0;
7070

7171
/**
72-
* @brief Supported layer type for the widget.
73-
* @return The layer type this widget is supported for.
72+
* @brief Check if the layer is supported for this widget.
73+
* @return True if this layer is supported for this widget
7474
*/
75-
virtual LayerTypesFlags layerType() = 0;
75+
virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
7676

7777
/**
7878
* @brief Factory fucntion to create the widget on demand as needed by the dock.

‎src/app/qgsmapstylingwidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void QgsMapStylingWidget::setLayer( QgsMapLayer *layer )
125125

126126
Q_FOREACH ( QgsMapStylePanelFactory* factory, mPageFactories )
127127
{
128-
if ( factory->layerType().testFlag( layer->type() ) )
128+
if ( factory->supportsLayer( layer ) )
129129
{
130130
QListWidgetItem* item = new QListWidgetItem( factory->icon(), "" );
131131
mOptionsListWidget->addItem( item );
@@ -404,7 +404,7 @@ QgsMapStylePanel *QgsMapLayerStyleManagerWidgetFactory::createPanel( QgsMapLayer
404404

405405
}
406406

407-
QgsMapStylePanelFactory::LayerTypesFlags QgsMapLayerStyleManagerWidgetFactory::layerType()
407+
bool QgsMapLayerStyleManagerWidgetFactory::supportsLayer( QgsMapLayer *layer )
408408
{
409-
return QgsMapLayer::VectorLayer;
409+
return ( layer->type() == QgsMapLayer::VectorLayer || layer->type() == QgsMapLayer::RasterLayer );
410410
}

‎src/app/qgsmapstylingwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class APP_EXPORT QgsMapLayerStyleManagerWidgetFactory : public QgsMapStylePanelF
4545
QIcon icon() override;
4646
QString title() override;
4747
QgsMapStylePanel *createPanel( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent ) override;
48-
LayerTypesFlags layerType() override;
48+
bool supportsLayer( QgsMapLayer *layer ) override;
4949
};
5050

5151
class APP_EXPORT QgsMapLayerStyleCommand : public QUndoCommand

‎src/gui/qgsmapstylepanel.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ class GUI_EXPORT QgsMapStylePanelFactory
9393
virtual QString title() = 0;
9494

9595
/**
96-
* @brief Supported layer type for the widget.
97-
* @return The layer type this widget is supported for.
96+
* @brief Check if the layer is supported for this widget.
97+
* @return True if this layer is supported for this widget
9898
*/
99-
virtual LayerTypesFlags layerType() = 0;
99+
virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
100100

101101
/**
102102
* @brief Factory fucntion to create the widget on demand as needed by the dock.

‎src/gui/symbology-ng/qgsrendererv2widget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class GUI_EXPORT QgsRendererV2Widget : public QWidget
9292
/**
9393
* @brief Emitted when a sub panel for the widget is opened.
9494
* The renderer can open inline sub panels instead of dialogs.
95-
* @param opened
95+
* @param opened True of the a sub panel is opened.
9696
*/
9797
void panelOpened( bool opened );
9898

0 commit comments

Comments
 (0)
Please sign in to comment.