Skip to content
Permalink
Browse files

[Diagrams] UI-Improvements

 * Do not allow "fixed size" histograms (makes no sense)
 * Rewire slots and signals for the fixed size
 * Default pie dimensions set to 50 mm
  • Loading branch information
m-kuhn committed May 1, 2013
1 parent 9e870c7 commit 3c68312028f3a343b0fbb2465588e1384a86bb87
Showing with 61 additions and 11 deletions.
  1. +22 −8 src/app/qgsdiagramproperties.cpp
  2. +1 −1 src/core/diagram/qgshistogramdiagram.cpp
  3. +38 −2 src/ui/qgsdiagrampropertiesbase.ui
@@ -325,8 +325,10 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int inde
mBarWidthLabel->show();
mBarWidthSpinBox->show();
mOrientationFrame->show();
mLinearlyScalingLabel->setText( tr( "Multiplicator for attribute values:" ) );
mAttributeBasedScalingOptions->hide();
mFixedSizeCheckBox->setChecked( false );
mFixedSizeCheckBox->setVisible( false );
mDiagramSizeSpinBox->setVisible( false );
mLinearlyScalingLabel->setText( tr( "Bar length: Scale linearly, such as the following value matches the specified size." ) );
}
else
{
@@ -335,6 +337,8 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int inde
mOrientationFrame->hide();
mLinearlyScalingLabel->setText( tr( "Scale linearly between 0 and the following attribute value / diagram size:" ) );
mAttributeBasedScalingOptions->show();
mFixedSizeCheckBox->setVisible( true );
mDiagramSizeSpinBox->setVisible( true );
}

if ( DIAGRAM_NAME_HISTOGRAM == diagramType || DIAGRAM_NAME_TEXT == diagramType )
@@ -469,23 +473,33 @@ void QgsDiagramProperties::apply()
}
else
{
QgsDiagram* diagram = 0;
int index = mDiagramTypeComboBox->currentIndex();
QString diagramType = mDiagramTypeComboBox->itemData( index ).toString();

if ( 0 == mDiagramAttributesTreeWidget->topLevelItemCount() )
{
QMessageBox::warning( this, tr( "No attributes added." ),
tr( "You did not add any attributes to this diagram layer. Please specify the attributes to visualize on the diagrams or disable diagrams." ), QMessageBox::Ok );
}

bool scaleAttributeValueIsNumeric;
mValueLineEdit->text().toDouble( &scaleAttributeValueIsNumeric );
if ( !mFixedSizeCheckBox->isChecked() && !scaleAttributeValueIsNumeric )
bool scaleAttributeValueOk = false;
if ( diagramType == DIAGRAM_NAME_HISTOGRAM )
{
// We don't need a scale attribute, the field is used as a multiplicator
scaleAttributeValueOk = true;
}
else
{
// Check if a (usable) scale attribute value is inserted
mValueLineEdit->text().toDouble( &scaleAttributeValueOk );
}
if ( !mFixedSizeCheckBox->isChecked() && !scaleAttributeValueOk )
{
QMessageBox::warning( this, tr( "No attribute value specified" ),
tr( "You did not specify a maximum value for the diagram size. Please specify the attribute and a reference value as a base for scaling in the Tab Diagram / Size." ), QMessageBox::Ok );
}

QgsDiagram* diagram = 0;
int index = mDiagramTypeComboBox->currentIndex();
QString diagramType = mDiagramTypeComboBox->itemData( index ).toString();
if ( diagramType == DIAGRAM_NAME_TEXT )
{
diagram = new QgsTextDiagram();
@@ -55,7 +55,7 @@ QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributes& attributes, const
{
case QgsDiagramSettings::Up:
case QgsDiagramSettings::Down:
mScaleFactor = (( is.upperSize.width() - is.lowerSize.height() ) / ( is.upperValue - is.lowerValue ) );
mScaleFactor = ( ( is.upperSize.width() - is.lowerSize.height() ) / ( is.upperValue - is.lowerValue ) );
size.scale( s.barWidth * attributes.size(), maxValue * mScaleFactor, Qt::IgnoreAspectRatio );
break;

@@ -380,6 +380,9 @@
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="mLinearlyScalingLabel">
<property name="text">
@@ -441,7 +444,7 @@
<number>10000000</number>
</property>
<property name="value">
<number>100</number>
<number>50</number>
</property>
</widget>
</item>
@@ -952,7 +955,40 @@
<resources>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>mFixedSizeCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>mDiagramSizeSpinBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>122</y>
</hint>
<hint type="destinationlabel">
<x>78</x>
<y>122</y>
</hint>
</hints>
</connection>
<connection>
<sender>mFixedSizeCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>mLinearScaleFrame</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>122</y>
</hint>
<hint type="destinationlabel">
<x>77</x>
<y>132</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="mOrientationButtonGroup"/>
</buttongroups>

0 comments on commit 3c68312

Please sign in to comment.
You can’t perform that action at this time.