@@ -84,8 +84,8 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
84
84
85
85
mMaxValueSpinBox ->setShowClearButton ( false );
86
86
87
- mDiagramUnitComboBox ->insertItem ( 0 , tr ( " mm " ), QgsDiagramSettings ::MM );
88
- mDiagramUnitComboBox -> insertItem ( 1 , tr ( " Map units " ), QgsDiagramSettings::MapUnits );
87
+ mDiagramUnitComboBox ->setUnits ( QgsSymbolV2::OutputUnitList () << QgsSymbolV2 ::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
88
+ mDiagramLineUnitComboBox -> setUnits ( QgsSymbolV2::OutputUnitList () << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
89
89
90
90
QGis::GeometryType layerType = layer->geometryType ();
91
91
if ( layerType == QGis::UnknownGeometry || layerType == QGis::NoGeometry )
@@ -192,7 +192,8 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
192
192
mDiagramTypeFrame ->setEnabled ( false );
193
193
mDiagramFrame ->setEnabled ( false );
194
194
mFixedSizeRadio ->setChecked ( true );
195
- mDiagramUnitComboBox ->setCurrentIndex ( mDiagramUnitComboBox ->findText ( tr ( " mm" ) ) );
195
+ mDiagramUnitComboBox ->setUnit ( QgsSymbolV2::MM );
196
+ mDiagramLineUnitComboBox ->setUnit ( QgsSymbolV2::MM );
196
197
mLabelPlacementComboBox ->setCurrentIndex ( mLabelPlacementComboBox ->findText ( tr ( " x-height" ) ) );
197
198
mDiagramSizeSpinBox ->setEnabled ( true );
198
199
mDiagramSizeSpinBox ->setValue ( 15 );
@@ -263,14 +264,10 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
263
264
mScaleRangeWidget ->setScaleRange ( 1.0 / ( settingList.at ( 0 ).maxScaleDenominator > 0 ? settingList.at ( 0 ).maxScaleDenominator : layer->maximumScale () ),
264
265
1.0 / ( settingList.at ( 0 ).minScaleDenominator > 0 ? settingList.at ( 0 ).minScaleDenominator : layer->minimumScale () ) );
265
266
mScaleVisibilityGroupBox ->setChecked ( settingList.at ( 0 ).scaleBasedVisibility );
266
- if ( settingList.at ( 0 ).sizeType == QgsDiagramSettings::MM )
267
- {
268
- mDiagramUnitComboBox ->setCurrentIndex ( 0 );
269
- }
270
- else
271
- {
272
- mDiagramUnitComboBox ->setCurrentIndex ( 1 );
273
- }
267
+ mDiagramUnitComboBox ->setUnit ( settingList.at ( 0 ).sizeType );
268
+ mDiagramUnitComboBox ->setMapUnitScale ( settingList.at ( 0 ).sizeScale );
269
+ mDiagramLineUnitComboBox ->setUnit ( settingList.at ( 0 ).lineSizeType );
270
+ mDiagramLineUnitComboBox ->setMapUnitScale ( settingList.at ( 0 ).lineSizeScale );
274
271
275
272
if ( settingList.at ( 0 ).labelPlacementMethod == QgsDiagramSettings::Height )
276
273
{
@@ -700,7 +697,10 @@ void QgsDiagramProperties::apply()
700
697
ds.categoryAttributes = categoryAttributes;
701
698
ds.categoryLabels = categoryLabels;
702
699
ds.size = QSizeF ( mDiagramSizeSpinBox ->value (), mDiagramSizeSpinBox ->value () );
703
- ds.sizeType = static_cast <QgsDiagramSettings::SizeType>( mDiagramUnitComboBox ->itemData ( mDiagramUnitComboBox ->currentIndex () ).toInt () );
700
+ ds.sizeType = mDiagramUnitComboBox ->unit ();
701
+ ds.sizeScale = mDiagramUnitComboBox ->getMapUnitScale ();
702
+ ds.lineSizeType = mDiagramLineUnitComboBox ->unit ();
703
+ ds.lineSizeScale = mDiagramLineUnitComboBox ->getMapUnitScale ();
704
704
ds.labelPlacementMethod = static_cast <QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox ->itemData ( mLabelPlacementComboBox ->currentIndex () ).toInt () );
705
705
ds.scaleByArea = mScaleDependencyComboBox ->itemData ( mScaleDependencyComboBox ->currentIndex () ).toBool ();
706
706
0 commit comments