@@ -845,6 +845,16 @@ void QgsVectorLayerProperties::apply()
845
845
{
846
846
ds.sizeType = QgsDiagramSettings::MM;
847
847
}
848
+
849
+ if ( !tr ( " Height" ).compare ( mLabelPlacementComboBox ->currentText () ) )
850
+ {
851
+ ds.labelPlacementMethod = QgsDiagramSettings::Height;
852
+ }
853
+ else if ( !tr ( " x-height" ).compare ( mLabelPlacementComboBox ->currentText () ) )
854
+ {
855
+ ds.labelPlacementMethod = QgsDiagramSettings::XHeight;
856
+ }
857
+
848
858
ds.backgroundColor = mBackgroundColorButton ->color ();
849
859
ds.penColor = mDiagramPenColorButton ->color ();
850
860
ds.penWidth = mPenWidthSpinBox ->value ();
@@ -1306,6 +1316,19 @@ void QgsVectorLayerProperties::handleDiagramItemDoubleClick( QTreeWidgetItem * i
1306
1316
}
1307
1317
}
1308
1318
1319
+ void QgsVectorLayerProperties::handleDiagramTypeChanged ( const QString& itemtext )
1320
+ {
1321
+ if ( tr ( " Text diagram" ) == itemtext )
1322
+ {
1323
+ mLabelPlacementComboBox ->show ();
1324
+ mLabelPlacementLabel ->show ();
1325
+ }
1326
+ else {
1327
+ mLabelPlacementComboBox ->hide ();
1328
+ mLabelPlacementLabel ->hide ();
1329
+ }
1330
+ }
1331
+
1309
1332
void QgsVectorLayerProperties::useNewSymbology ()
1310
1333
{
1311
1334
int res = QMessageBox::question ( this , tr ( " Symbology" ),
@@ -1565,6 +1588,9 @@ void QgsVectorLayerProperties::initDiagramTab()
1565
1588
mDiagramTypeComboBox ->addItem ( tr ( " Pie chart" ) );
1566
1589
mDiagramTypeComboBox ->addItem ( tr ( " Text diagram" ) );
1567
1590
1591
+ mLabelPlacementComboBox ->addItem ( tr ( " Height" ) );
1592
+ mLabelPlacementComboBox ->addItem ( tr ( " x-height" ) );
1593
+
1568
1594
// insert all attributes into the combo boxes
1569
1595
const QgsFieldMap& layerFields = layer->pendingFields ();
1570
1596
QgsFieldMap::const_iterator fieldIt = layerFields.constBegin ();
@@ -1594,6 +1620,7 @@ void QgsVectorLayerProperties::initDiagramTab()
1594
1620
mDisplayDiagramsCheckBox ->setChecked ( false );
1595
1621
mFixedSizeCheckBox ->setChecked ( true );
1596
1622
mDiagramUnitComboBox ->setCurrentIndex ( mDiagramUnitComboBox ->findText ( tr ( " MM" ) ) );
1623
+ mLabelPlacementComboBox ->setCurrentIndex ( mLabelPlacementComboBox ->findText ( tr ( " XHeight" ) ) );
1597
1624
mDiagramSizeSpinBox ->setValue ( 30 );
1598
1625
mScaleDependentDiagramVisibilityCheckBox ->setChecked ( false );
1599
1626
@@ -1645,6 +1672,15 @@ void QgsVectorLayerProperties::initDiagramTab()
1645
1672
mDiagramUnitComboBox ->setCurrentIndex ( 1 );
1646
1673
}
1647
1674
1675
+ if ( settingList.at ( 0 ).labelPlacementMethod == QgsDiagramSettings::Height )
1676
+ {
1677
+ mLabelPlacementComboBox ->setCurrentIndex ( 0 );
1678
+ }
1679
+ else
1680
+ {
1681
+ mLabelPlacementComboBox ->setCurrentIndex ( 1 );
1682
+ }
1683
+
1648
1684
1649
1685
1650
1686
QList< QColor > categoryColors = settingList.at ( 0 ).categoryColors ;
@@ -1696,5 +1732,10 @@ void QgsVectorLayerProperties::initDiagramTab()
1696
1732
}
1697
1733
}
1698
1734
}
1735
+
1736
+ // Hide/Show diagram specific widgets
1737
+ handleDiagramTypeChanged ( mDiagramTypeComboBox ->currentText () );
1738
+
1699
1739
QObject::connect ( mDiagramAttributesTreeWidget , SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), this , SLOT ( handleDiagramItemDoubleClick ( QTreeWidgetItem*, int ) ) );
1740
+ QObject::connect ( mDiagramTypeComboBox , SIGNAL ( currentIndexChanged ( const QString& ) ), this , SLOT ( handleDiagramTypeChanged ( const QString& ) ) );
1700
1741
}
0 commit comments