Skip to content

Commit 2c9a3a7

Browse files
committedAug 10, 2012
Diagram option page reloaded, pt. 1
1 parent edd14f7 commit 2c9a3a7

File tree

3 files changed

+557
-538
lines changed

3 files changed

+557
-538
lines changed
 

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

13681379
void 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+
15911617
void 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
}

‎src/app/qgsvectorlayerproperties.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
127127
void on_mFindMaximumValueButton_clicked();
128128
void on_mBackgroundColorButton_clicked();
129129
void on_mDiagramPenColorButton_clicked();
130+
void on_mDisplayDiagramsCheckBox_stateChanged( int state );
130131
void on_pbnUpdateExtents_clicked();
131132
void on_mIncreaseSmallDiagramsCheckBox_stateChanged( int state );
132133

@@ -197,6 +198,9 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
197198
/**Actions dialog. If apply is pressed, the actions are stored for later use */
198199
QgsAttributeActionDialog* actionDialog;
199200

201+
/**A list of all widgets to enable/disable when diagrams are enabled / disabled */
202+
QList<QWidget *> mDiagramDetailWidgets;
203+
200204
QList<QgsApplyDialog*> mOverlayDialogs;
201205
QMap<int, QPushButton*> mButtonMap;
202206
QMap<int, QgsVectorLayer::EditType> mEditTypeMap;

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 518 additions & 531 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.