mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Streamline QgsMapLayerConfigWidgetFactory interface
This commit is contained in:
parent
382986ffde
commit
e4080edaa7
@ -13,6 +13,9 @@ class QgsMapLayerConfigWidgetFactory
|
||||
/** Constructor */
|
||||
QgsMapLayerConfigWidgetFactory();
|
||||
|
||||
/** Constructor */
|
||||
QgsMapLayerConfigWidgetFactory(QString title, QIcon icon);
|
||||
|
||||
/** Destructor */
|
||||
virtual ~QgsMapLayerConfigWidgetFactory();
|
||||
|
||||
@ -22,6 +25,8 @@ class QgsMapLayerConfigWidgetFactory
|
||||
*/
|
||||
virtual QIcon icon() const;
|
||||
|
||||
void setIcon(QIcon icon);
|
||||
|
||||
/**
|
||||
* @brief The title of the panel.
|
||||
* @note This may or may not be shown to the user.
|
||||
@ -29,10 +34,16 @@ class QgsMapLayerConfigWidgetFactory
|
||||
*/
|
||||
virtual QString title() const;
|
||||
|
||||
void setTitlte(QString title);
|
||||
|
||||
virtual bool supportsStyleDock() const;
|
||||
|
||||
void setSupportsStyleDock(bool supports);
|
||||
|
||||
virtual bool supportLayerPropertiesDialog() const;
|
||||
|
||||
void setSupportLayerPropertiesDialog(bool supports);
|
||||
|
||||
/**
|
||||
* @brief Check if the layer is supported for this widget.
|
||||
* @return True if this layer is supported for this widget
|
||||
|
@ -505,14 +505,10 @@ bool QgsMapLayerStyleCommand::mergeWith( const QUndoCommand* other )
|
||||
return true;
|
||||
}
|
||||
|
||||
QIcon QgsLayerStyleManagerWidgetFactory::icon() const
|
||||
QgsLayerStyleManagerWidgetFactory::QgsLayerStyleManagerWidgetFactory()
|
||||
{
|
||||
return QgsApplication::getThemeIcon( "propertyicons/stylepreset.svg" );
|
||||
}
|
||||
|
||||
QString QgsLayerStyleManagerWidgetFactory::title() const
|
||||
{
|
||||
return QObject::tr( "Style Manager" );
|
||||
setIcon( QgsApplication::getThemeIcon( "propertyicons/stylepreset.svg" ) );
|
||||
setTitlte( QObject::tr( "Style Manager" ) );
|
||||
}
|
||||
|
||||
QgsMapLayerConfigWidget *QgsLayerStyleManagerWidgetFactory::createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockMode, QWidget *parent ) const
|
||||
|
@ -42,8 +42,7 @@ class QgsMapLayerStyleManagerWidget;
|
||||
class APP_EXPORT QgsLayerStyleManagerWidgetFactory : public QgsMapLayerConfigWidgetFactory
|
||||
{
|
||||
public:
|
||||
QIcon icon() const override;
|
||||
QString title() const override;
|
||||
QgsLayerStyleManagerWidgetFactory();
|
||||
bool supportsStyleDock() const override { return true; }
|
||||
QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockMode, QWidget *parent ) const override;
|
||||
bool supportsLayer( QgsMapLayer *layer ) const override;
|
||||
|
@ -17,6 +17,13 @@
|
||||
|
||||
QgsMapLayerConfigWidgetFactory::QgsMapLayerConfigWidgetFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QgsMapLayerConfigWidgetFactory::QgsMapLayerConfigWidgetFactory( QString title, QIcon icon )
|
||||
: mIcon( icon )
|
||||
, mTitle( title )
|
||||
{
|
||||
}
|
||||
|
||||
QgsMapLayerConfigWidgetFactory::~QgsMapLayerConfigWidgetFactory()
|
||||
|
@ -28,9 +28,13 @@
|
||||
class GUI_EXPORT QgsMapLayerConfigWidgetFactory
|
||||
{
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
QgsMapLayerConfigWidgetFactory();
|
||||
|
||||
/** Constructor */
|
||||
QgsMapLayerConfigWidgetFactory( QString title, QIcon icon );
|
||||
|
||||
/** Destructor */
|
||||
virtual ~QgsMapLayerConfigWidgetFactory();
|
||||
|
||||
@ -38,14 +42,28 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
|
||||
* @brief The icon that will be shown in the UI for the panel.
|
||||
* @return A QIcon for the panel icon.
|
||||
*/
|
||||
virtual QIcon icon() const { return QIcon(); }
|
||||
virtual QIcon icon() const { return mIcon; }
|
||||
|
||||
/**
|
||||
* Set the icon for the factory object.
|
||||
* @param icon The icon to show in the interface.
|
||||
*/
|
||||
void setIcon( QIcon icon ) { mIcon = icon; }
|
||||
|
||||
/**
|
||||
* @brief The title of the panel.
|
||||
* @note This may or may not be shown to the user.
|
||||
* @return Title of the panel
|
||||
*/
|
||||
virtual QString title() const { return QString(); }
|
||||
virtual QString title() const { return mTitle; }
|
||||
|
||||
/**
|
||||
* Set the title for the interface
|
||||
* @note Not all users may show this as a label
|
||||
* e.g style dock uses this as a tooltip.
|
||||
* @param title The title to set.
|
||||
*/
|
||||
void setTitlte( QString title ) { mTitle = title; }
|
||||
|
||||
/**
|
||||
* Flag if widget is supported for use in style dock.
|
||||
@ -53,12 +71,24 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
|
||||
*/
|
||||
virtual bool supportsStyleDock() const { return false; }
|
||||
|
||||
/**
|
||||
* Set support flag for style dock
|
||||
* @param supports True if this widget is supported in the style dock.
|
||||
*/
|
||||
void setSupportsStyleDock( bool supports ) { mSuppprtsDock = supports; }
|
||||
|
||||
/**
|
||||
* Flag if widget is supported for use in layer properties dialog.
|
||||
* @return True if supported
|
||||
*/
|
||||
virtual bool supportLayerPropertiesDialog() const { return false; }
|
||||
|
||||
/**
|
||||
* Set support flag for style dock
|
||||
* @param supports True if this widget is supported in the style dock.
|
||||
*/
|
||||
void setSupportLayerPropertiesDialog( bool supports ) { mSuppprtsProperties = supports; }
|
||||
|
||||
/**
|
||||
* @brief Check if the layer is supported for this widget.
|
||||
* @return True if this layer is supported for this widget
|
||||
@ -75,6 +105,12 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
|
||||
* @return A new QgsMapStylePanel which is shown in the map style dock.
|
||||
*/
|
||||
virtual QgsMapLayerConfigWidget* createWidget( QgsMapLayer* layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget* parent = 0 ) const = 0;
|
||||
|
||||
private:
|
||||
QIcon mIcon;
|
||||
QString mTitle;
|
||||
bool mSuppprtsDock;
|
||||
bool mSuppprtsProperties;
|
||||
};
|
||||
|
||||
#endif // QGSMAPLAYERCONFIGWIDGETFACTORY_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user