mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-29 00:06:58 -05:00
Fix memory leaks in renderer widgets
This commit is contained in:
parent
7a8f35fc25
commit
f7f43e08c6
@ -33,6 +33,7 @@ Constructor
|
|||||||
:param style:
|
:param style:
|
||||||
:param renderer: the mask renderer (will not take ownership)
|
:param renderer: the mask renderer (will not take ownership)
|
||||||
%End
|
%End
|
||||||
|
~Qgs25DRendererWidget();
|
||||||
|
|
||||||
virtual QgsFeatureRenderer *renderer();
|
virtual QgsFeatureRenderer *renderer();
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Constructor
|
|||||||
:param style:
|
:param style:
|
||||||
:param renderer: the merged feature renderer (will not take ownership)
|
:param renderer: the merged feature renderer (will not take ownership)
|
||||||
%End
|
%End
|
||||||
|
~QgsEmbeddedSymbolRendererWidget();
|
||||||
|
|
||||||
virtual QgsFeatureRenderer *renderer();
|
virtual QgsFeatureRenderer *renderer();
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Constructor
|
|||||||
:param style:
|
:param style:
|
||||||
:param renderer: the mask renderer (will not take ownership)
|
:param renderer: the mask renderer (will not take ownership)
|
||||||
%End
|
%End
|
||||||
|
~QgsHeatmapRendererWidget();
|
||||||
|
|
||||||
virtual QgsFeatureRenderer *renderer();
|
virtual QgsFeatureRenderer *renderer();
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Constructor
|
|||||||
:param style:
|
:param style:
|
||||||
:param renderer: the mask renderer (will not take ownership)
|
:param renderer: the mask renderer (will not take ownership)
|
||||||
%End
|
%End
|
||||||
|
~QgsInvertedPolygonRendererWidget();
|
||||||
|
|
||||||
virtual QgsFeatureRenderer *renderer();
|
virtual QgsFeatureRenderer *renderer();
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Constructor
|
|||||||
:param style:
|
:param style:
|
||||||
:param renderer: the merged feature renderer (will not take ownership)
|
:param renderer: the merged feature renderer (will not take ownership)
|
||||||
%End
|
%End
|
||||||
|
~QgsMergedFeatureRendererWidget();
|
||||||
|
|
||||||
virtual QgsFeatureRenderer *renderer();
|
virtual QgsFeatureRenderer *renderer();
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
#include "qgsmaplayerstylemanager.h"
|
#include "qgsmaplayerstylemanager.h"
|
||||||
#include "qgsexpressioncontextutils.h"
|
#include "qgsexpressioncontextutils.h"
|
||||||
|
#include "qgssymbol.h"
|
||||||
|
|
||||||
Qgs25DRendererWidget::Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer )
|
Qgs25DRendererWidget::Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer )
|
||||||
: QgsRendererWidget( layer, style )
|
: QgsRendererWidget( layer, style )
|
||||||
@ -54,7 +55,7 @@ Qgs25DRendererWidget::Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *sty
|
|||||||
|
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = Qgs25DRenderer::convertFromRenderer( renderer );
|
mRenderer.reset( Qgs25DRenderer::convertFromRenderer( renderer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
mHeightWidget->setLayer( layer );
|
mHeightWidget->setLayer( layer );
|
||||||
@ -85,9 +86,11 @@ Qgs25DRendererWidget::Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *sty
|
|||||||
connect( mWallExpositionShading, &QAbstractButton::toggled, this, &Qgs25DRendererWidget::updateRenderer );
|
connect( mWallExpositionShading, &QAbstractButton::toggled, this, &Qgs25DRendererWidget::updateRenderer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qgs25DRendererWidget::~Qgs25DRendererWidget() = default;
|
||||||
|
|
||||||
QgsFeatureRenderer *Qgs25DRendererWidget::renderer()
|
QgsFeatureRenderer *Qgs25DRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qgs25DRendererWidget::updateRenderer()
|
void Qgs25DRendererWidget::updateRenderer()
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class GUI_EXPORT Qgs25DRendererWidget : public QgsRendererWidget, protected Ui::
|
|||||||
* \param renderer the mask renderer (will not take ownership)
|
* \param renderer the mask renderer (will not take ownership)
|
||||||
*/
|
*/
|
||||||
Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer SIP_TRANSFER );
|
Qgs25DRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer SIP_TRANSFER );
|
||||||
|
~Qgs25DRendererWidget() override;
|
||||||
|
|
||||||
QgsFeatureRenderer *renderer() override;
|
QgsFeatureRenderer *renderer() override;
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class GUI_EXPORT Qgs25DRendererWidget : public QgsRendererWidget, protected Ui::
|
|||||||
private:
|
private:
|
||||||
void apply() override SIP_FORCE;
|
void apply() override SIP_FORCE;
|
||||||
|
|
||||||
Qgs25DRenderer *mRenderer = nullptr;
|
std::unique_ptr< Qgs25DRenderer > mRenderer;
|
||||||
|
|
||||||
friend class QgsAppScreenShots;
|
friend class QgsAppScreenShots;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -79,6 +79,8 @@ QgsEmbeddedSymbolRendererWidget::QgsEmbeddedSymbolRendererWidget( QgsVectorLayer
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsEmbeddedSymbolRendererWidget::~QgsEmbeddedSymbolRendererWidget() = default;
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsEmbeddedSymbolRendererWidget::renderer()
|
QgsFeatureRenderer *QgsEmbeddedSymbolRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer.get();
|
return mRenderer.get();
|
||||||
|
|||||||
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include "ui_qgsembeddedsymbolrendererwidgetbase.h"
|
#include "ui_qgsembeddedsymbolrendererwidgetbase.h"
|
||||||
#include "qgis_sip.h"
|
#include "qgis_sip.h"
|
||||||
#include "qgsembeddedsymbolrenderer.h"
|
|
||||||
#include "qgsrendererwidget.h"
|
#include "qgsrendererwidget.h"
|
||||||
#include "qgis_gui.h"
|
#include "qgis_gui.h"
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QgsEmbeddedSymbolRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup gui
|
* \ingroup gui
|
||||||
@ -50,6 +50,7 @@ class GUI_EXPORT QgsEmbeddedSymbolRendererWidget : public QgsRendererWidget, pub
|
|||||||
* \param renderer the merged feature renderer (will not take ownership)
|
* \param renderer the merged feature renderer (will not take ownership)
|
||||||
*/
|
*/
|
||||||
QgsEmbeddedSymbolRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
QgsEmbeddedSymbolRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
||||||
|
~QgsEmbeddedSymbolRendererWidget() override;
|
||||||
|
|
||||||
QgsFeatureRenderer *renderer() override;
|
QgsFeatureRenderer *renderer() override;
|
||||||
void setContext( const QgsSymbolWidgetContext &context ) override;
|
void setContext( const QgsSymbolWidgetContext &context ) override;
|
||||||
|
|||||||
@ -464,7 +464,7 @@ QgsGraduatedSymbolRendererWidget::QgsGraduatedSymbolRendererWidget( QgsVectorLay
|
|||||||
// setup user interface
|
// setup user interface
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
mSymmetryPointValidator = new QDoubleValidator();
|
mSymmetryPointValidator = new QDoubleValidator( this );
|
||||||
cboSymmetryPoint->setEditable( true );
|
cboSymmetryPoint->setEditable( true );
|
||||||
cboSymmetryPoint->setValidator( mSymmetryPointValidator );
|
cboSymmetryPoint->setValidator( mSymmetryPointValidator );
|
||||||
|
|
||||||
|
|||||||
@ -196,7 +196,7 @@ class GUI_EXPORT QgsGraduatedSymbolRendererWidget : public QgsRendererWidget, pr
|
|||||||
|
|
||||||
QgsRangeList mCopyBuffer;
|
QgsRangeList mCopyBuffer;
|
||||||
|
|
||||||
QDoubleValidator *mSymmetryPointValidator;
|
QDoubleValidator *mSymmetryPointValidator = nullptr;
|
||||||
|
|
||||||
std::vector< std::unique_ptr< QgsAbstractProcessingParameterWidgetWrapper >> mParameterWidgetWrappers;
|
std::vector< std::unique_ptr< QgsAbstractProcessingParameterWidgetWrapper >> mParameterWidgetWrappers;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -105,11 +105,11 @@ QgsHeatmapRendererWidget::QgsHeatmapRendererWidget( QgsVectorLayer *layer, QgsSt
|
|||||||
|
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = QgsHeatmapRenderer::convertFromRenderer( renderer );
|
mRenderer.reset( QgsHeatmapRenderer::convertFromRenderer( renderer ) );
|
||||||
}
|
}
|
||||||
if ( !mRenderer )
|
if ( !mRenderer )
|
||||||
{
|
{
|
||||||
mRenderer = new QgsHeatmapRenderer();
|
mRenderer = std::make_unique< QgsHeatmapRenderer >();
|
||||||
}
|
}
|
||||||
|
|
||||||
btnColorRamp->setShowGradientOnly( true );
|
btnColorRamp->setShowGradientOnly( true );
|
||||||
@ -141,9 +141,11 @@ QgsHeatmapRendererWidget::QgsHeatmapRendererWidget( QgsVectorLayer *layer, QgsSt
|
|||||||
connect( mWeightExpressionWidget, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsHeatmapRendererWidget::weightExpressionChanged );
|
connect( mWeightExpressionWidget, static_cast < void ( QgsFieldExpressionWidget::* )( const QString & ) >( &QgsFieldExpressionWidget::fieldChanged ), this, &QgsHeatmapRendererWidget::weightExpressionChanged );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsHeatmapRendererWidget::~QgsHeatmapRendererWidget() = default;
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsHeatmapRendererWidget::renderer()
|
QgsFeatureRenderer *QgsHeatmapRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsHeatmapRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
void QgsHeatmapRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
||||||
|
|||||||
@ -48,12 +48,13 @@ class GUI_EXPORT QgsHeatmapRendererWidget : public QgsRendererWidget, private Ui
|
|||||||
* \param renderer the mask renderer (will not take ownership)
|
* \param renderer the mask renderer (will not take ownership)
|
||||||
*/
|
*/
|
||||||
QgsHeatmapRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
QgsHeatmapRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
||||||
|
~QgsHeatmapRendererWidget() override;
|
||||||
|
|
||||||
QgsFeatureRenderer *renderer() override;
|
QgsFeatureRenderer *renderer() override;
|
||||||
void setContext( const QgsSymbolWidgetContext &context ) override;
|
void setContext( const QgsSymbolWidgetContext &context ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsHeatmapRenderer *mRenderer = nullptr;
|
std::unique_ptr< QgsHeatmapRenderer > mRenderer;
|
||||||
|
|
||||||
QgsExpressionContext createExpressionContext() const override;
|
QgsExpressionContext createExpressionContext() const override;
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,8 @@ QgsInvertedPolygonRendererWidget::QgsInvertedPolygonRendererWidget( QgsVectorLay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsInvertedPolygonRendererWidget::~QgsInvertedPolygonRendererWidget() = default;
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsInvertedPolygonRendererWidget::renderer()
|
QgsFeatureRenderer *QgsInvertedPolygonRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
if ( mRenderer && mEmbeddedRendererWidget )
|
if ( mRenderer && mEmbeddedRendererWidget )
|
||||||
|
|||||||
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include "ui_qgsinvertedpolygonrendererwidgetbase.h"
|
#include "ui_qgsinvertedpolygonrendererwidgetbase.h"
|
||||||
#include "qgis_sip.h"
|
#include "qgis_sip.h"
|
||||||
#include "qgsinvertedpolygonrenderer.h"
|
|
||||||
#include "qgsrendererwidget.h"
|
#include "qgsrendererwidget.h"
|
||||||
#include "qgis_gui.h"
|
#include "qgis_gui.h"
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QgsInvertedPolygonRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup gui
|
* \ingroup gui
|
||||||
@ -50,6 +50,7 @@ class GUI_EXPORT QgsInvertedPolygonRendererWidget : public QgsRendererWidget, pr
|
|||||||
* \param renderer the mask renderer (will not take ownership)
|
* \param renderer the mask renderer (will not take ownership)
|
||||||
*/
|
*/
|
||||||
QgsInvertedPolygonRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
QgsInvertedPolygonRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
||||||
|
~QgsInvertedPolygonRendererWidget() override;
|
||||||
|
|
||||||
QgsFeatureRenderer *renderer() override;
|
QgsFeatureRenderer *renderer() override;
|
||||||
|
|
||||||
|
|||||||
@ -97,6 +97,8 @@ QgsMergedFeatureRendererWidget::QgsMergedFeatureRendererWidget( QgsVectorLayer *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QgsMergedFeatureRendererWidget::~QgsMergedFeatureRendererWidget() = default;
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsMergedFeatureRendererWidget::renderer()
|
QgsFeatureRenderer *QgsMergedFeatureRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
if ( mRenderer && mEmbeddedRendererWidget )
|
if ( mRenderer && mEmbeddedRendererWidget )
|
||||||
|
|||||||
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include "ui_qgsmergedfeaturerendererwidgetbase.h"
|
#include "ui_qgsmergedfeaturerendererwidgetbase.h"
|
||||||
#include "qgis_sip.h"
|
#include "qgis_sip.h"
|
||||||
#include "qgsmergedfeaturerenderer.h"
|
|
||||||
#include "qgsrendererwidget.h"
|
#include "qgsrendererwidget.h"
|
||||||
#include "qgis_gui.h"
|
#include "qgis_gui.h"
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QgsMergedFeatureRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup gui
|
* \ingroup gui
|
||||||
@ -50,6 +50,7 @@ class GUI_EXPORT QgsMergedFeatureRendererWidget : public QgsRendererWidget, priv
|
|||||||
* \param renderer the merged feature renderer (will not take ownership)
|
* \param renderer the merged feature renderer (will not take ownership)
|
||||||
*/
|
*/
|
||||||
QgsMergedFeatureRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
QgsMergedFeatureRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
||||||
|
~QgsMergedFeatureRendererWidget() override;
|
||||||
|
|
||||||
QgsFeatureRenderer *renderer() override;
|
QgsFeatureRenderer *renderer() override;
|
||||||
void setContext( const QgsSymbolWidgetContext &context ) override;
|
void setContext( const QgsSymbolWidgetContext &context ) override;
|
||||||
|
|||||||
@ -26,15 +26,14 @@ QgsRendererWidget *QgsNullSymbolRendererWidget::create( QgsVectorLayer *layer, Q
|
|||||||
|
|
||||||
QgsNullSymbolRendererWidget::QgsNullSymbolRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer )
|
QgsNullSymbolRendererWidget::QgsNullSymbolRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer )
|
||||||
: QgsRendererWidget( layer, style )
|
: QgsRendererWidget( layer, style )
|
||||||
|
|
||||||
{
|
{
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = QgsNullSymbolRenderer::convertFromRenderer( renderer );
|
mRenderer.reset( QgsNullSymbolRenderer::convertFromRenderer( renderer ) );
|
||||||
}
|
}
|
||||||
if ( !mRenderer )
|
if ( !mRenderer )
|
||||||
{
|
{
|
||||||
mRenderer = new QgsNullSymbolRenderer();
|
mRenderer = std::make_unique< QgsNullSymbolRenderer >();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGridLayout *layout = new QGridLayout( this );
|
QGridLayout *layout = new QGridLayout( this );
|
||||||
@ -42,12 +41,9 @@ QgsNullSymbolRendererWidget::QgsNullSymbolRendererWidget( QgsVectorLayer *layer,
|
|||||||
layout->addWidget( label );
|
layout->addWidget( label );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsNullSymbolRendererWidget::~QgsNullSymbolRendererWidget()
|
QgsNullSymbolRendererWidget::~QgsNullSymbolRendererWidget() = default;
|
||||||
{
|
|
||||||
delete mRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsNullSymbolRendererWidget::renderer()
|
QgsFeatureRenderer *QgsNullSymbolRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class GUI_EXPORT QgsNullSymbolRendererWidget : public QgsRendererWidget
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Renderer being configured by the widget
|
//! Renderer being configured by the widget
|
||||||
QgsNullSymbolRenderer *mRenderer = nullptr;
|
std::unique_ptr< QgsNullSymbolRenderer > mRenderer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -63,11 +63,11 @@ QgsPointClusterRendererWidget::QgsPointClusterRendererWidget( QgsVectorLayer *la
|
|||||||
|
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = QgsPointClusterRenderer::convertFromRenderer( renderer );
|
mRenderer.reset( QgsPointClusterRenderer::convertFromRenderer( renderer ) );
|
||||||
}
|
}
|
||||||
if ( !mRenderer )
|
if ( !mRenderer )
|
||||||
{
|
{
|
||||||
mRenderer = new QgsPointClusterRenderer();
|
mRenderer = std::make_unique< QgsPointClusterRenderer >();
|
||||||
}
|
}
|
||||||
|
|
||||||
blockAllSignals( true );
|
blockAllSignals( true );
|
||||||
@ -109,14 +109,11 @@ QgsPointClusterRendererWidget::QgsPointClusterRendererWidget( QgsVectorLayer *la
|
|||||||
mCenterSymbolToolButton->registerExpressionContextGenerator( this );
|
mCenterSymbolToolButton->registerExpressionContextGenerator( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPointClusterRendererWidget::~QgsPointClusterRendererWidget()
|
QgsPointClusterRendererWidget::~QgsPointClusterRendererWidget() = default;
|
||||||
{
|
|
||||||
delete mRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsPointClusterRendererWidget::renderer()
|
QgsFeatureRenderer *QgsPointClusterRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsPointClusterRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
void QgsPointClusterRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class GUI_EXPORT QgsPointClusterRendererWidget: public QgsRendererWidget, public
|
|||||||
QgsExpressionContext createExpressionContext() const override;
|
QgsExpressionContext createExpressionContext() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsPointClusterRenderer *mRenderer = nullptr;
|
std::unique_ptr< QgsPointClusterRenderer > mRenderer;
|
||||||
|
|
||||||
void blockAllSignals( bool block );
|
void blockAllSignals( bool block );
|
||||||
void setupBlankUi( const QString &layerName );
|
void setupBlankUi( const QString &layerName );
|
||||||
|
|||||||
@ -71,11 +71,11 @@ QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget( QgsVecto
|
|||||||
|
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = QgsPointDisplacementRenderer::convertFromRenderer( renderer );
|
mRenderer.reset( QgsPointDisplacementRenderer::convertFromRenderer( renderer ) );
|
||||||
}
|
}
|
||||||
if ( !mRenderer )
|
if ( !mRenderer )
|
||||||
{
|
{
|
||||||
mRenderer = new QgsPointDisplacementRenderer();
|
mRenderer = std::make_unique< QgsPointDisplacementRenderer >();
|
||||||
}
|
}
|
||||||
|
|
||||||
blockAllSignals( true );
|
blockAllSignals( true );
|
||||||
@ -176,14 +176,11 @@ QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget( QgsVecto
|
|||||||
mCenterSymbolToolButton->registerExpressionContextGenerator( this );
|
mCenterSymbolToolButton->registerExpressionContextGenerator( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPointDisplacementRendererWidget::~QgsPointDisplacementRendererWidget()
|
QgsPointDisplacementRendererWidget::~QgsPointDisplacementRendererWidget() = default;
|
||||||
{
|
|
||||||
delete mRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsPointDisplacementRendererWidget::renderer()
|
QgsFeatureRenderer *QgsPointDisplacementRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsPointDisplacementRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
void QgsPointDisplacementRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class GUI_EXPORT QgsPointDisplacementRendererWidget: public QgsRendererWidget, p
|
|||||||
QgsExpressionContext createExpressionContext() const override;
|
QgsExpressionContext createExpressionContext() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsPointDisplacementRenderer *mRenderer = nullptr;
|
std::unique_ptr< QgsPointDisplacementRenderer > mRenderer;
|
||||||
|
|
||||||
void blockAllSignals( bool block );
|
void blockAllSignals( bool block );
|
||||||
void setupBlankUi( const QString &layerName );
|
void setupBlankUi( const QString &layerName );
|
||||||
|
|||||||
@ -61,20 +61,20 @@ QgsRuleBasedRendererWidget::QgsRuleBasedRendererWidget( QgsVectorLayer *layer, Q
|
|||||||
|
|
||||||
if ( renderer )
|
if ( renderer )
|
||||||
{
|
{
|
||||||
mRenderer = QgsRuleBasedRenderer::convertFromRenderer( renderer, layer );
|
mRenderer.reset( QgsRuleBasedRenderer::convertFromRenderer( renderer, layer ) );
|
||||||
}
|
}
|
||||||
if ( !mRenderer )
|
if ( !mRenderer )
|
||||||
{
|
{
|
||||||
// some default options
|
// some default options
|
||||||
QgsSymbol *symbol = QgsSymbol::defaultSymbol( mLayer->geometryType() );
|
QgsSymbol *symbol = QgsSymbol::defaultSymbol( mLayer->geometryType() );
|
||||||
|
|
||||||
mRenderer = new QgsRuleBasedRenderer( symbol );
|
mRenderer = std::make_unique< QgsRuleBasedRenderer >( symbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
this->layout()->setContentsMargins( 0, 0, 0, 0 );
|
this->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
mModel = new QgsRuleBasedRendererModel( mRenderer, viewRules );
|
mModel = new QgsRuleBasedRendererModel( mRenderer.get(), viewRules );
|
||||||
#ifdef ENABLE_MODELTEST
|
#ifdef ENABLE_MODELTEST
|
||||||
new ModelTest( mModel, this ); // for model validity checking
|
new ModelTest( mModel, this ); // for model validity checking
|
||||||
#endif
|
#endif
|
||||||
@ -135,12 +135,11 @@ QgsRuleBasedRendererWidget::QgsRuleBasedRendererWidget( QgsVectorLayer *layer, Q
|
|||||||
QgsRuleBasedRendererWidget::~QgsRuleBasedRendererWidget()
|
QgsRuleBasedRendererWidget::~QgsRuleBasedRendererWidget()
|
||||||
{
|
{
|
||||||
qDeleteAll( mCopyBuffer );
|
qDeleteAll( mCopyBuffer );
|
||||||
delete mRenderer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsFeatureRenderer *QgsRuleBasedRendererWidget::renderer()
|
QgsFeatureRenderer *QgsRuleBasedRendererWidget::renderer()
|
||||||
{
|
{
|
||||||
return mRenderer;
|
return mRenderer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRuleBasedRendererWidget::setDockMode( bool dockMode )
|
void QgsRuleBasedRendererWidget::setDockMode( bool dockMode )
|
||||||
@ -452,7 +451,7 @@ void QgsRuleBasedRendererWidget::setRenderingOrder()
|
|||||||
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
|
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
|
||||||
if ( panel && panel->dockMode() )
|
if ( panel && panel->dockMode() )
|
||||||
{
|
{
|
||||||
QgsSymbolLevelsWidget *widget = new QgsSymbolLevelsWidget( mRenderer, true, panel );
|
QgsSymbolLevelsWidget *widget = new QgsSymbolLevelsWidget( mRenderer.get(), true, panel );
|
||||||
widget->setForceOrderingEnabled( true );
|
widget->setForceOrderingEnabled( true );
|
||||||
widget->setPanelTitle( tr( "Symbol Levels" ) );
|
widget->setPanelTitle( tr( "Symbol Levels" ) );
|
||||||
connect( widget, &QgsPanelWidget::widgetChanged, this, [ = ]()
|
connect( widget, &QgsPanelWidget::widgetChanged, this, [ = ]()
|
||||||
@ -463,7 +462,7 @@ void QgsRuleBasedRendererWidget::setRenderingOrder()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QgsSymbolLevelsDialog dlg( mRenderer, true, panel );
|
QgsSymbolLevelsDialog dlg( mRenderer.get(), true, panel );
|
||||||
dlg.setForceOrderingEnabled( true );
|
dlg.setForceOrderingEnabled( true );
|
||||||
if ( dlg.exec() )
|
if ( dlg.exec() )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -166,7 +166,7 @@ class GUI_EXPORT QgsRuleBasedRendererWidget : public QgsRendererWidget, private
|
|||||||
void refreshSymbolView() override;
|
void refreshSymbolView() override;
|
||||||
void keyPressEvent( QKeyEvent *event ) override;
|
void keyPressEvent( QKeyEvent *event ) override;
|
||||||
|
|
||||||
QgsRuleBasedRenderer *mRenderer = nullptr;
|
std::unique_ptr< QgsRuleBasedRenderer > mRenderer;
|
||||||
QgsRuleBasedRendererModel *mModel = nullptr;
|
QgsRuleBasedRendererModel *mModel = nullptr;
|
||||||
|
|
||||||
QMenu *mRefineMenu = nullptr;
|
QMenu *mRefineMenu = nullptr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user