mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Improve API for QgsMapStylePanelFactory
This commit is contained in:
parent
60df926605
commit
7573b221e7
@ -69,10 +69,10 @@ class QgsMapStylePanelFactory
|
|||||||
virtual QString title() = 0;
|
virtual QString title() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Supported layer type for the widget.
|
* @brief Check if the layer is supported for this widget.
|
||||||
* @return The layer type this widget is supported for.
|
* @return True if this layer is supported for this widget
|
||||||
*/
|
*/
|
||||||
virtual LayerTypesFlags layerType() = 0;
|
virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Factory fucntion to create the widget on demand as needed by the dock.
|
* @brief Factory fucntion to create the widget on demand as needed by the dock.
|
||||||
|
@ -125,7 +125,7 @@ void QgsMapStylingWidget::setLayer( QgsMapLayer *layer )
|
|||||||
|
|
||||||
Q_FOREACH ( QgsMapStylePanelFactory* factory, mPageFactories )
|
Q_FOREACH ( QgsMapStylePanelFactory* factory, mPageFactories )
|
||||||
{
|
{
|
||||||
if ( factory->layerType().testFlag( layer->type() ) )
|
if ( factory->supportsLayer( layer ) )
|
||||||
{
|
{
|
||||||
QListWidgetItem* item = new QListWidgetItem( factory->icon(), "" );
|
QListWidgetItem* item = new QListWidgetItem( factory->icon(), "" );
|
||||||
mOptionsListWidget->addItem( item );
|
mOptionsListWidget->addItem( item );
|
||||||
@ -404,7 +404,7 @@ QgsMapStylePanel *QgsMapLayerStyleManagerWidgetFactory::createPanel( QgsMapLayer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsMapStylePanelFactory::LayerTypesFlags QgsMapLayerStyleManagerWidgetFactory::layerType()
|
bool QgsMapLayerStyleManagerWidgetFactory::supportsLayer( QgsMapLayer *layer )
|
||||||
{
|
{
|
||||||
return QgsMapLayer::VectorLayer;
|
return ( layer->type() == QgsMapLayer::VectorLayer || layer->type() == QgsMapLayer::RasterLayer );
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class APP_EXPORT QgsMapLayerStyleManagerWidgetFactory : public QgsMapStylePanelF
|
|||||||
QIcon icon() override;
|
QIcon icon() override;
|
||||||
QString title() override;
|
QString title() override;
|
||||||
QgsMapStylePanel *createPanel( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent ) override;
|
QgsMapStylePanel *createPanel( QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent ) override;
|
||||||
LayerTypesFlags layerType() override;
|
bool supportsLayer( QgsMapLayer *layer ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class APP_EXPORT QgsMapLayerStyleCommand : public QUndoCommand
|
class APP_EXPORT QgsMapLayerStyleCommand : public QUndoCommand
|
||||||
|
@ -93,10 +93,10 @@ class GUI_EXPORT QgsMapStylePanelFactory
|
|||||||
virtual QString title() = 0;
|
virtual QString title() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Supported layer type for the widget.
|
* @brief Check if the layer is supported for this widget.
|
||||||
* @return The layer type this widget is supported for.
|
* @return True if this layer is supported for this widget
|
||||||
*/
|
*/
|
||||||
virtual LayerTypesFlags layerType() = 0;
|
virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Factory fucntion to create the widget on demand as needed by the dock.
|
* @brief Factory fucntion to create the widget on demand as needed by the dock.
|
||||||
|
@ -92,7 +92,7 @@ class GUI_EXPORT QgsRendererV2Widget : public QWidget
|
|||||||
/**
|
/**
|
||||||
* @brief Emitted when a sub panel for the widget is opened.
|
* @brief Emitted when a sub panel for the widget is opened.
|
||||||
* The renderer can open inline sub panels instead of dialogs.
|
* The renderer can open inline sub panels instead of dialogs.
|
||||||
* @param opened
|
* @param opened True of the a sub panel is opened.
|
||||||
*/
|
*/
|
||||||
void panelOpened( bool opened );
|
void panelOpened( bool opened );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user