Skip to content

Commit 8224a16

Browse files
committedAug 25, 2014
Fix unit choice for ellipse symbol layer type
1 parent 8766cd1 commit 8224a16

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed
 

‎src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLay
2323
{
2424
setupUi( this );
2525

26+
mSymbolWidthUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
27+
mSymbolHeightUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
28+
mOutlineWidthUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
29+
mOffsetUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
30+
2631
btnChangeColorFill->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
2732
btnChangeColorFill->setColorDialogTitle( tr( "Select fill color" ) );
2833
btnChangeColorFill->setContext( "symbology" );
@@ -90,6 +95,8 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
9095
mOutlineWidthUnitWidget->setMapUnitScale( mLayer->outlineWidthMapUnitScale() );
9196
mSymbolHeightUnitWidget->setUnit( mLayer->symbolHeightUnit() );
9297
mSymbolHeightUnitWidget->setMapUnitScale( mLayer->symbolHeightMapUnitScale() );
98+
mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
99+
mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
93100
}
94101

95102
QPointF offsetPt = mLayer->offset();
@@ -187,38 +194,46 @@ void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorFill_colorChanged( const QC
187194
emit changed();
188195
}
189196

190-
void QgsEllipseSymbolLayerV2Widget::on_mSymbolWidthUnitComboBox_currentIndexChanged( int index )
197+
void QgsEllipseSymbolLayerV2Widget::on_mSymbolWidthUnitWidget_changed()
191198
{
192199
if ( mLayer )
193200
{
194-
mLayer->setSymbolWidthUnit(( QgsSymbolV2::OutputUnit ) index );
201+
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mSymbolWidthUnitWidget->getUnit() );
202+
mLayer->setSymbolWidthUnit( unit );
203+
mLayer->setSymbolWidthMapUnitScale( mSymbolWidthUnitWidget->getMapUnitScale() );
195204
emit changed();
196205
}
197206
}
198207

199-
void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthUnitComboBox_currentIndexChanged( int index )
208+
void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthUnitWidget_changed()
200209
{
201210
if ( mLayer )
202211
{
203-
mLayer->setOutlineWidthUnit(( QgsSymbolV2::OutputUnit ) index );
212+
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mOutlineWidthUnitWidget->getUnit() );
213+
mLayer->setOutlineWidthUnit( unit );
214+
mLayer->setOutlineWidthMapUnitScale( mOutlineWidthUnitWidget->getMapUnitScale() );
204215
emit changed();
205216
}
206217
}
207218

208-
void QgsEllipseSymbolLayerV2Widget::on_mSymbolHeightUnitComboBox_currentIndexChanged( int index )
219+
void QgsEllipseSymbolLayerV2Widget::on_mSymbolHeightUnitWidget_changed()
209220
{
210221
if ( mLayer )
211222
{
212-
mLayer->setSymbolHeightUnit(( QgsSymbolV2::OutputUnit ) index );
223+
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mSymbolHeightUnitWidget->getUnit() );
224+
mLayer->setSymbolHeightUnit( unit );
225+
mLayer->setSymbolHeightMapUnitScale( mSymbolHeightUnitWidget->getMapUnitScale() );
213226
emit changed();
214227
}
215228
}
216229

217-
void QgsEllipseSymbolLayerV2Widget::on_mOffsetUnitComboBox_currentIndexChanged( int index )
230+
void QgsEllipseSymbolLayerV2Widget::on_mOffsetUnitWidget_changed()
218231
{
219232
if ( mLayer )
220233
{
221-
mLayer->setOffsetUnit(( QgsSymbolV2::OutputUnit ) index );
234+
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mOffsetUnitWidget->getUnit() );
235+
mLayer->setOffsetUnit( unit );
236+
mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
222237
emit changed();
223238
}
224239
}
@@ -230,6 +245,10 @@ void QgsEllipseSymbolLayerV2Widget::blockComboSignals( bool block )
230245
mSymbolHeightUnitWidget->blockSignals( block );
231246
mHorizontalAnchorComboBox->blockSignals( block );
232247
mVerticalAnchorComboBox->blockSignals( block );
248+
mSymbolWidthUnitWidget->blockSignals( block );
249+
mOutlineWidthUnitWidget->blockSignals( block );
250+
mSymbolHeightUnitWidget->blockSignals( block );
251+
mOffsetUnitWidget->blockSignals( block );
233252
}
234253

235254
void QgsEllipseSymbolLayerV2Widget::on_mHorizontalAnchorComboBox_currentIndexChanged( int index )

‎src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ class GUI_EXPORT QgsEllipseSymbolLayerV2Widget: public QgsSymbolLayerV2Widget, p
4949
void on_btnChangeColorBorder_colorChanged( const QColor& newColor );
5050
void on_btnChangeColorFill_colorChanged( const QColor& newColor );
5151

52-
void on_mSymbolWidthUnitComboBox_currentIndexChanged( int index );
53-
void on_mOutlineWidthUnitComboBox_currentIndexChanged( int index );
54-
void on_mSymbolHeightUnitComboBox_currentIndexChanged( int index );
55-
void on_mOffsetUnitComboBox_currentIndexChanged( int index );
52+
void on_mSymbolWidthUnitWidget_changed();
53+
void on_mOutlineWidthUnitWidget_changed();
54+
void on_mSymbolHeightUnitWidget_changed();
55+
void on_mOffsetUnitWidget_changed();
5656
void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
5757
void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
5858
void on_mDataDefinedPropertiesButton_clicked();

0 commit comments

Comments
 (0)
Please sign in to comment.