@@ -1363,6 +1363,17 @@ void QgsVectorLayerProperties::handleDiagramTypeChanged( const QString& itemtext
13631363 mLabelPlacementComboBox ->hide ();
13641364 mLabelPlacementLabel ->hide ();
13651365 }
1366+
1367+ if ( tr ( " Histogram" ) == itemtext )
1368+ {
1369+ mDiagramOptionsGroupBox ->show ();
1370+ mBarWidthLabel ->show ();
1371+ }
1372+ else
1373+ {
1374+ mDiagramOptionsGroupBox ->hide ();
1375+ mBarWidthLabel ->hide ();
1376+ }
13661377}
13671378
13681379void QgsVectorLayerProperties::on_mIncreaseSmallDiagramsCheckBox_stateChanged ( int state )
@@ -1588,6 +1599,21 @@ void QgsVectorLayerProperties::on_mDiagramPenColorButton_clicked()
15881599 }
15891600}
15901601
1602+ void QgsVectorLayerProperties::on_mDisplayDiagramsCheckBox_stateChanged ( int state )
1603+ {
1604+ // Set all widget enabled states
1605+ foreach ( QWidget *widget, mDiagramDetailWidgets )
1606+ {
1607+ widget->setEnabled ( Qt::Checked == state );
1608+ }
1609+
1610+ // if enabled show diagram specific options
1611+ if ( Qt::Checked == state )
1612+ {
1613+ handleDiagramTypeChanged ( mDiagramTypeComboBox ->currentText () );
1614+ }
1615+ }
1616+
15911617void QgsVectorLayerProperties::initDiagramTab ()
15921618{
15931619 if ( !layer )
@@ -1698,7 +1724,7 @@ void QgsVectorLayerProperties::initDiagramTab()
16981724 }
16991725 mBackgroundColorButton ->setColor ( QColor ( 255 , 255 , 255 , 255 ) );
17001726 }
1701- else
1727+ else // already a diagram renderer present
17021728 {
17031729 mDisplayDiagramsCheckBox ->setChecked ( true );
17041730
@@ -1813,13 +1839,15 @@ void QgsVectorLayerProperties::initDiagramTab()
18131839 mDiagramTypeComboBox ->setCurrentIndex ( mDiagramTypeComboBox ->findText ( tr ( " Histogram" ) ) );
18141840 }
18151841 }
1816- }
1842+ } // if ( !dr ), else
1843+
1844+ // Popuplate the widget list with all widgets which should be enabled/disabled when diagrams are
1845+ // enabled / disabled
1846+ mDiagramDetailWidgets << mTypeLabel << mDiagramTypeComboBox << mPriorityLabel << mPriorityLowLabel
1847+ << mPrioritySlider << mPriorityHighLabel << mAppearanceGroupBox << mVisibilityGroupBox << mSizeGroupBox
1848+ << mPlacementGroupBox << mAttributesLabel << mDiagramAttributesComboBox << mRemoveCategoryPushButton
1849+ << mAddCategoryPushButton << mDiagramAttributesTreeWidget << mDiagramOptionsGroupBox ;
18171850
1818- // Hide/Show diagram specific widgets
1819- // handleDiagramTypeChanged( mDiagramTypeComboBox->currentText() );
1820- // Enable / disable small diagram scaling related widgets
1821- // on_mFixedSizeCheckBox_stateChanged( mIncreaseSmallDiagramsCheckBox->checkState() );
18221851 connect ( mDiagramAttributesTreeWidget , SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), this , SLOT ( handleDiagramItemDoubleClick ( QTreeWidgetItem*, int ) ) );
18231852 connect ( mDiagramTypeComboBox , SIGNAL ( currentIndexChanged ( const QString& ) ), this , SLOT ( handleDiagramTypeChanged ( const QString& ) ) );
1824- // connect( mIncreaseSmallDiagramsCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( handleIncreaseSmallDiagramsChanged( int ) ) );
18251853}
0 commit comments