Skip to content

Commit

Permalink
Diagram option page reloaded, pt. 1
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 10, 2012
1 parent edd14f7 commit 2c9a3a7
Show file tree
Hide file tree
Showing 3 changed files with 557 additions and 538 deletions.
42 changes: 35 additions & 7 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,17 @@ void QgsVectorLayerProperties::handleDiagramTypeChanged( const QString& itemtext
mLabelPlacementComboBox->hide();
mLabelPlacementLabel->hide();
}

if ( tr( "Histogram" ) == itemtext )
{
mDiagramOptionsGroupBox->show();
mBarWidthLabel->show();
}
else
{
mDiagramOptionsGroupBox->hide();
mBarWidthLabel->hide();
}
}

void QgsVectorLayerProperties::on_mIncreaseSmallDiagramsCheckBox_stateChanged( int state )
Expand Down Expand Up @@ -1588,6 +1599,21 @@ void QgsVectorLayerProperties::on_mDiagramPenColorButton_clicked()
}
}

void QgsVectorLayerProperties::on_mDisplayDiagramsCheckBox_stateChanged( int state )
{
// Set all widget enabled states
foreach( QWidget *widget, mDiagramDetailWidgets )
{
widget->setEnabled( Qt::Checked == state );
}

// if enabled show diagram specific options
if ( Qt::Checked == state )
{
handleDiagramTypeChanged( mDiagramTypeComboBox->currentText() );
}
}

void QgsVectorLayerProperties::initDiagramTab()
{
if ( !layer )
Expand Down Expand Up @@ -1698,7 +1724,7 @@ void QgsVectorLayerProperties::initDiagramTab()
}
mBackgroundColorButton->setColor( QColor( 255, 255, 255, 255 ) );
}
else
else // already a diagram renderer present
{
mDisplayDiagramsCheckBox->setChecked( true );

Expand Down Expand Up @@ -1813,13 +1839,15 @@ void QgsVectorLayerProperties::initDiagramTab()
mDiagramTypeComboBox->setCurrentIndex( mDiagramTypeComboBox->findText( tr( "Histogram" ) ) );
}
}
}
} // if ( !dr ), else

// Popuplate the widget list with all widgets which should be enabled/disabled when diagrams are
// enabled / disabled
mDiagramDetailWidgets << mTypeLabel << mDiagramTypeComboBox << mPriorityLabel << mPriorityLowLabel
<< mPrioritySlider << mPriorityHighLabel << mAppearanceGroupBox << mVisibilityGroupBox << mSizeGroupBox
<< mPlacementGroupBox << mAttributesLabel << mDiagramAttributesComboBox << mRemoveCategoryPushButton
<< mAddCategoryPushButton << mDiagramAttributesTreeWidget << mDiagramOptionsGroupBox;

// Hide/Show diagram specific widgets
// handleDiagramTypeChanged( mDiagramTypeComboBox->currentText() );
// Enable / disable small diagram scaling related widgets
// on_mFixedSizeCheckBox_stateChanged( mIncreaseSmallDiagramsCheckBox->checkState() );
connect( mDiagramAttributesTreeWidget, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( handleDiagramItemDoubleClick( QTreeWidgetItem*, int ) ) );
connect( mDiagramTypeComboBox, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( handleDiagramTypeChanged( const QString& ) ) );
// connect( mIncreaseSmallDiagramsCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( handleIncreaseSmallDiagramsChanged( int ) ) );
}
4 changes: 4 additions & 0 deletions src/app/qgsvectorlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
void on_mFindMaximumValueButton_clicked();
void on_mBackgroundColorButton_clicked();
void on_mDiagramPenColorButton_clicked();
void on_mDisplayDiagramsCheckBox_stateChanged( int state );
void on_pbnUpdateExtents_clicked();
void on_mIncreaseSmallDiagramsCheckBox_stateChanged( int state );

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

/**A list of all widgets to enable/disable when diagrams are enabled / disabled */
QList<QWidget *> mDiagramDetailWidgets;

QList<QgsApplyDialog*> mOverlayDialogs;
QMap<int, QPushButton*> mButtonMap;
QMap<int, QgsVectorLayer::EditType> mEditTypeMap;
Expand Down
Loading

0 comments on commit 2c9a3a7

Please sign in to comment.