Skip to content
Permalink
Browse files

Update the QgsRatioLockButton use for fixedAspectRatio in SVG marker

  • Loading branch information
rldhont committed Sep 28, 2017
1 parent aee93b0 commit f8152c1eecd39d480d6803e793b944565e2d8ce5
@@ -1756,7 +1756,7 @@ QgsSvgMarkerSymbolLayerWidget::QgsSvgMarkerSymbolLayerWidget( const QgsVectorLay
connect( viewGroups->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsSvgMarkerSymbolLayerWidget::populateIcons );
connect( spinWidth, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setWidth );
connect( spinHeight, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setHeight );
connect( mLockAspectRatio, static_cast < void ( QgsRatioLockButton::* )( bool ) > ( &QgsRatioLockButton::lockChanged ), this, &QgsSvgMarkerSymbolLayerWidget::stateChangedAspectRatio );
connect( mLockAspectRatio, static_cast < void ( QgsRatioLockButton::* )( bool ) > ( &QgsRatioLockButton::lockChanged ), this, &QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged );
connect( spinAngle, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setAngle );
connect( spinOffsetX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
connect( spinOffsetY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsSvgMarkerSymbolLayerWidget::setOffset );
@@ -1876,9 +1876,9 @@ void QgsSvgMarkerSymbolLayerWidget::setGuiForSvg( const QgsSvgMarkerSymbolLayer
{
spinHeight->setValue( layer->size() * layer->fixedAspectRatio() );
}
spinHeight->setEnabled( layer->defaultAspectRatio() > 0.0 );
spinHeight->blockSignals( false );
spinHeight->setEnabled( !preservedAspectRatio );
mLockAspectRatio->setLocked( preservedAspectRatio );
whileBlocking( mLockAspectRatio )->setLocked( preservedAspectRatio );
}

void QgsSvgMarkerSymbolLayerWidget::updateAssistantSymbol()
@@ -2036,11 +2036,24 @@ void QgsSvgMarkerSymbolLayerWidget::setHeight()
emit changed();
}

void QgsSvgMarkerSymbolLayerWidget::stateChangedAspectRatio()
void QgsSvgMarkerSymbolLayerWidget::lockAspectRatioChanged( const bool locked )
{
spinHeight->setEnabled( !mLockAspectRatio->locked() );
setWidth();
emit changed();
//spinHeight->setEnabled( !locked );
double defaultAspectRatio = mLayer->defaultAspectRatio();
if ( defaultAspectRatio <= 0.0 )
{
whileBlocking( mLockAspectRatio )->setLocked( true );
}
else if ( locked )
{
mLayer->setFixedAspectRatio( 0.0 );
setWidth();
}
else
{
mLayer->setFixedAspectRatio( spinHeight->value() / spinWidth->value() );
}
//emit changed();
}

void QgsSvgMarkerSymbolLayerWidget::setAngle()
@@ -459,7 +459,7 @@ class GUI_EXPORT QgsSvgMarkerSymbolLayerWidget : public QgsSymbolLayerWidget, pr
private slots:
void setWidth();
void setHeight();
void stateChangedAspectRatio();
void lockAspectRatioChanged( const bool locked );
void setAngle();
void setOffset();
void updateAssistantSymbol();
@@ -163,7 +163,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Lock aspect ratio (including while drawing extent onto canvas)</string>
<string>Lock aspect ratio</string>
</property>
<property name="leftMargin" stdset="0">
<number>13</number>

0 comments on commit f8152c1

Please sign in to comment.
You can’t perform that action at this time.