Skip to content

Commit

Permalink
Fix rule based label/symbol renderers reset max scale for rules to
Browse files Browse the repository at this point in the history
1:100000

And improve dox

Fixes #21845
  • Loading branch information
nyalldawson committed May 23, 2019
1 parent 2e114ad commit 3794613
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
14 changes: 14 additions & 0 deletions python/gui/auto_generated/qgsscalerangewidget.sip.in
Expand Up @@ -68,6 +68,13 @@ The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
.. seealso:: :py:func:`setMaximumScale`

.. seealso:: :py:func:`setScaleRange`

.. warning::

Calling setMinimumScale() places a restriction on the acceptable maximum scale for the
widget, and will alter any previously set maximum scale to pass this constraint. Always
call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or
use the convenience method setScaleRange() instead.
%End

void setMaximumScale( double scale );
Expand All @@ -80,6 +87,13 @@ The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
.. seealso:: :py:func:`setMinimumScale`

.. seealso:: :py:func:`setScaleRange`

.. warning::

Calling setMinimumScale() places a restriction on the acceptable maximum scale for the
widget, and will alter any previously set maximum scale to pass this constraint. Always
call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or
use the convenience method setScaleRange() instead.
%End

void setScaleRange( double min, double max );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsrulebasedlabelingwidget.cpp
Expand Up @@ -596,8 +596,8 @@ QgsLabelingRulePropsWidget::QgsLabelingRulePropsWidget( QgsRuleBasedLabeling::Ru
{
groupScale->setChecked( true );
// caution: rule uses scale denom, scale widget uses true scales
mScaleRangeWidget->setMaximumScale( std::max( rule->maximumScale(), 0.0 ) );
mScaleRangeWidget->setMinimumScale( std::max( rule->minimumScale(), 0.0 ) );
mScaleRangeWidget->setScaleRange( std::max( rule->minimumScale(), 0.0 ),
std::max( rule->maximumScale(), 0.0 ) );
}
mScaleRangeWidget->setMapCanvas( mMapCanvas );

Expand Down
10 changes: 10 additions & 0 deletions src/gui/qgsscalerangewidget.h
Expand Up @@ -77,6 +77,11 @@ class GUI_EXPORT QgsScaleRangeWidget : public QWidget
* \see minimumScale()
* \see setMaximumScale()
* \see setScaleRange()
*
* \warning Calling setMinimumScale() places a restriction on the acceptable maximum scale for the
* widget, and will alter any previously set maximum scale to pass this constraint. Always
* call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or
* use the convenience method setScaleRange() instead.
*/
void setMinimumScale( double scale );

Expand All @@ -86,6 +91,11 @@ class GUI_EXPORT QgsScaleRangeWidget : public QWidget
* \see maximumScale()
* \see setMinimumScale()
* \see setScaleRange()
*
* \warning Calling setMinimumScale() places a restriction on the acceptable maximum scale for the
* widget, and will alter any previously set maximum scale to pass this constraint. Always
* call setMinimumScale() before setMaximumScale() when restoring a scale range in the widget, or
* use the convenience method setScaleRange() instead.
*/
void setMaximumScale( double scale );

Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology/qgsrulebasedrendererwidget.cpp
Expand Up @@ -647,8 +647,8 @@ QgsRendererRulePropsWidget::QgsRendererRulePropsWidget( QgsRuleBasedRenderer::Ru
if ( mRule->dependsOnScale() )
{
groupScale->setChecked( true );
mScaleRangeWidget->setMaximumScale( std::max( rule->maximumScale(), 0.0 ) );
mScaleRangeWidget->setMinimumScale( std::max( rule->minimumScale(), 0.0 ) );
mScaleRangeWidget->setScaleRange( std::max( rule->minimumScale(), 0.0 ),
std::max( rule->maximumScale(), 0.0 ) );
}
mScaleRangeWidget->setMapCanvas( mContext.mapCanvas() );

Expand Down

0 comments on commit 3794613

Please sign in to comment.