Skip to content

Commit

Permalink
Fix some QGIS 3.0 symbology todos
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 13, 2016
1 parent 098f69d commit b711177
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 34 deletions.
14 changes: 14 additions & 0 deletions doc/api_break.dox
Expand Up @@ -920,9 +920,16 @@ be returned instead of a null pointer if no transformation is required.</li>

<ul>
<li>QgsRuleBasedRenderer.Rule checkState() and setCheckState() were removed. Use active() and setActive() instead.</li>
<li>QgsRuleBasedRenderer.Rule updateElseRules() was removed.</li>
<li>startRender( QgsRenderContext& context, const QgsFields& fields ) was removed. Use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsRuleBasedRendererWidget QgsRuleBasedRendererWidget

<ul>
<li>refineRuleCategoriesGui() and refineRuleRangesGui() no longer take a QModelIndexList argument.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSimpleMarkerSymbolLayer QgsSimpleMarkerSymbolLayer

<ul>
Expand All @@ -931,6 +938,13 @@ be returned instead of a null pointer if no transformation is required.</li>
<li>prepareShape() and preparePath() were removed. Calling these methods manually should no longer be required.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSimpleMarkerSymbolLayerWidget QgsSimpleMarkerSymbolLayerWidget

<ul>
<li>setName() was removed.</li>
</ul>


\subsection qgis_api_break_3_0_QgsSingleSymbolRendererWidget QgsSingleSymbolRendererWidget
<ul>
<li>sizeScaleFieldChanged() and scaleMethodChanged() were removed. These settings are no longer exposed in the widget's GUI.</li>
Expand Down
7 changes: 0 additions & 7 deletions python/core/symbology-ng/qgsrulebasedrenderer.sip
Expand Up @@ -295,13 +295,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
//! @note added in 2.6
QgsRuleBasedRenderer::Rule* findRuleByKey( const QString& key );

/**
* Check which child rules are else rules and update the internal list of else rules
*
* TODO QGIS 3: Does this need to be public?
*/
void updateElseRules();

/**
* Sets if this rule is an ELSE rule
*
Expand Down
6 changes: 4 additions & 2 deletions python/gui/symbology-ng/qgsrulebasedrendererwidget.sip
Expand Up @@ -86,8 +86,10 @@ class QgsRuleBasedRendererWidget : QgsRendererWidget

protected:
void refineRule( int type );
void refineRuleCategoriesGui( const QModelIndexList& index );
void refineRuleRangesGui( const QModelIndexList& index );
//! Opens the dialog for refining a rule using categories
void refineRuleCategoriesGui();
//! Opens the dialog for refining a rule using ranges
void refineRuleRangesGui();
void refineRuleScalesGui( const QModelIndexList& index );

QgsRuleBasedRenderer::Rule* currentRule();
Expand Down
1 change: 0 additions & 1 deletion python/gui/symbology-ng/qgssymbollayerwidget.sip
Expand Up @@ -126,7 +126,6 @@ class QgsSimpleMarkerSymbolLayerWidget : QgsSymbolLayerWidget
virtual QgsSymbolLayer* symbolLayer();

public slots:
void setName();
void setColorBorder( const QColor& color );
void setColorFill( const QColor& color );
void setSize();
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology-ng/qgsmarkersymbollayer.cpp
Expand Up @@ -689,7 +689,6 @@ QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLay
, mOutlineWidth( 0 )
, mOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
, mPenJoinStyle( penJoinStyle )
, mName( encodeShape( shape ) )
, mUsingCache( false )
{
mColor = color;
Expand Down
3 changes: 0 additions & 3 deletions src/core/symbology-ng/qgsmarkersymbollayer.h
Expand Up @@ -366,9 +366,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
//! QBrush corresponding to marker's fill style
QBrush mBrush;

//TODO QGIS 3.0 - remove
QString mName;

//! Cached image of marker, if using cached version
QImage mCache;
//! QPen to use as outline of selected symbols
Expand Down
13 changes: 6 additions & 7 deletions src/core/symbology-ng/qgsrulebasedrenderer.h
Expand Up @@ -353,13 +353,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
//! @note added in 2.6
Rule* findRuleByKey( const QString& key );

/**
* Check which child rules are else rules and update the internal list of else rules
*
* TODO QGIS 3: Does this need to be public?
*/
void updateElseRules();

/**
* Sets if this rule is an ELSE rule
*
Expand Down Expand Up @@ -398,6 +391,12 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer

Rule( const Rule& rh );
Rule& operator=( const Rule& rh );

/**
* Check which child rules are else rules and update the internal list of else rules
*
*/
void updateElseRules();
};

/////
Expand Down
8 changes: 4 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererwidget.cpp
Expand Up @@ -227,9 +227,9 @@ void QgsRuleBasedRendererWidget::refineRule( int type )


if ( type == 0 ) // categories
refineRuleCategoriesGui( indexlist );
refineRuleCategoriesGui();
else if ( type == 1 ) // ranges
refineRuleRangesGui( indexlist );
refineRuleRangesGui();
else // scales
refineRuleScalesGui( indexlist );

Expand All @@ -255,7 +255,7 @@ void QgsRuleBasedRendererWidget::refineRuleScales()
refineRule( 2 );
}

void QgsRuleBasedRendererWidget::refineRuleCategoriesGui( const QModelIndexList& )
void QgsRuleBasedRendererWidget::refineRuleCategoriesGui()
{
QgsCategorizedSymbolRendererWidget* w = new QgsCategorizedSymbolRendererWidget( mLayer, mStyle, nullptr );
w->setPanelTitle( tr( "Add categories to rules" ) );
Expand All @@ -265,7 +265,7 @@ void QgsRuleBasedRendererWidget::refineRuleCategoriesGui( const QModelIndexList&
openPanel( w );
}

void QgsRuleBasedRendererWidget::refineRuleRangesGui( const QModelIndexList& )
void QgsRuleBasedRendererWidget::refineRuleRangesGui()
{
QgsGraduatedSymbolRendererWidget* w = new QgsGraduatedSymbolRendererWidget( mLayer, mStyle, nullptr );
w->setPanelTitle( tr( "Add ranges to rules" ) );
Expand Down
8 changes: 4 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererwidget.h
Expand Up @@ -137,10 +137,10 @@ class GUI_EXPORT QgsRuleBasedRendererWidget : public QgsRendererWidget, private

protected:
void refineRule( int type );
//TODO QGIS 3.0 - remove index parameter
void refineRuleCategoriesGui( const QModelIndexList& index );
//TODO QGIS 3.0 - remove index parameter
void refineRuleRangesGui( const QModelIndexList& index );
//! Opens the dialog for refining a rule using categories
void refineRuleCategoriesGui();
//! Opens the dialog for refining a rule using ranges
void refineRuleRangesGui();
void refineRuleScalesGui( const QModelIndexList& index );

QgsRuleBasedRenderer::Rule* currentRule();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgssymbollayerwidget.cpp
Expand Up @@ -428,7 +428,7 @@ QgsSimpleMarkerSymbolLayerWidget::QgsSimpleMarkerSymbolLayerWidget( const QgsVec
delete lyr;
}

connect( lstNames, SIGNAL( currentRowChanged( int ) ), this, SLOT( setName() ) );
connect( lstNames, SIGNAL( currentRowChanged( int ) ), this, SLOT( setShape() ) );
connect( btnChangeColorBorder, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColorBorder( const QColor& ) ) );
connect( btnChangeColorFill, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColorFill( const QColor& ) ) );
connect( cboJoinStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penJoinStyleChanged() ) );
Expand Down Expand Up @@ -539,7 +539,7 @@ QgsSymbolLayer* QgsSimpleMarkerSymbolLayerWidget::symbolLayer()
return mLayer;
}

void QgsSimpleMarkerSymbolLayerWidget::setName()
void QgsSimpleMarkerSymbolLayerWidget::setShape()
{
mLayer->setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
btnChangeColorFill->setEnabled( QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( mLayer->shape() ) );
Expand Down
5 changes: 2 additions & 3 deletions src/gui/symbology-ng/qgssymbollayerwidget.h
Expand Up @@ -191,8 +191,7 @@ class GUI_EXPORT QgsSimpleMarkerSymbolLayerWidget : public QgsSymbolLayerWidget,
virtual QgsSymbolLayer* symbolLayer() override;

public slots:
//TODO QGIS 3.0 - rename to setShape
void setName();

void setColorBorder( const QColor& color );
void setColorFill( const QColor& color );
void setSize();
Expand All @@ -210,7 +209,7 @@ class GUI_EXPORT QgsSimpleMarkerSymbolLayerWidget : public QgsSymbolLayerWidget,
QgsSimpleMarkerSymbolLayer* mLayer;

private slots:

void setShape();
void updateAssistantSymbol();
void penJoinStyleChanged();

Expand Down

0 comments on commit b711177

Please sign in to comment.