Skip to content

Commit

Permalink
Modernise diagram properties UI:
Browse files Browse the repository at this point in the history
Switch to stacked widget, QgsScaleRangeWidget, QgsFieldExpression
widget, QgsDoubleSpinBoxes.

Rearrange and reword controls to clarify their behaviour.
  • Loading branch information
nyalldawson committed Apr 22, 2015
1 parent 16af787 commit b2ca7fa
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 490 deletions.
1 change: 1 addition & 0 deletions python/core/qgsdiagramrendererv2.sip
Expand Up @@ -87,6 +87,7 @@ class QgsDiagramSettings
bool scaleByArea;
int angleOffset;

bool scaleBasedVisibility;
//scale range (-1 if no lower / upper bound )
double minScaleDenominator;
double maxScaleDenominator;
Expand Down
194 changes: 84 additions & 110 deletions src/app/qgsdiagramproperties.cpp

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/app/qgsdiagramproperties.h
Expand Up @@ -38,15 +38,13 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr
public slots:
void apply();
void on_mDiagramTypeComboBox_currentIndexChanged( int index );
void on_mTransparencySlider_valueChanged( int value );
void on_mAddCategoryPushButton_clicked();
void on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column );
void on_mFindMaximumValueButton_clicked();
void on_mRemoveCategoryPushButton_clicked();
void on_mDiagramFontButton_clicked();
void on_mDiagramAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column );
void on_mEngineSettingsButton_clicked();
void showSizeAttributeExpressionDialog();
void showAddAttributeExpressionDialog();
void on_mDiagramStackedWidget_currentChanged( int index );
void on_mPlacementComboBox_currentIndexChanged( int index );
Expand All @@ -56,9 +54,6 @@ class APP_EXPORT QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPr

QgsVectorLayer* mLayer;

private:
int mAvailableAttributes;

};

#endif // QGSDIAGRAMPROPERTIES_H
9 changes: 9 additions & 0 deletions src/core/qgsdiagramrendererv2.cpp
Expand Up @@ -91,6 +91,14 @@ void QgsDiagramSettings::readXML( const QDomElement& elem, const QgsVectorLayer*

minScaleDenominator = elem.attribute( "minScaleDenominator", "-1" ).toDouble();
maxScaleDenominator = elem.attribute( "maxScaleDenominator", "-1" ).toDouble();
if ( elem.hasAttribute( "scaleBasedVisibility" ) )
{
scaleBasedVisibility = ( elem.attribute( "scaleBasedVisibility", "1" ) != "0" );
}
else
{
scaleBasedVisibility = minScaleDenominator >= 0 && maxScaleDenominator >= 0;
}

//mm vs map units
if ( elem.attribute( "sizeType" ) == "MM" )
Expand Down Expand Up @@ -199,6 +207,7 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc,
categoryElem.setAttribute( "penColor", penColor.name() );
categoryElem.setAttribute( "penAlpha", penColor.alpha() );
categoryElem.setAttribute( "penWidth", QString::number( penWidth ) );
categoryElem.setAttribute( "scaleBasedVisibility", scaleBasedVisibility );
categoryElem.setAttribute( "minScaleDenominator", QString::number( minScaleDenominator ) );
categoryElem.setAttribute( "maxScaleDenominator", QString::number( maxScaleDenominator ) );
categoryElem.setAttribute( "transparency", QString::number( transparency ) );
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsdiagramrendererv2.h
Expand Up @@ -120,6 +120,7 @@ class CORE_EXPORT QgsDiagramSettings
, transparency( 0 )
, scaleByArea( true )
, angleOffset( 90 * 16 ) //top
, scaleBasedVisibility( false )
, minScaleDenominator( -1 )
, maxScaleDenominator( -1 )
, minimumSize( 0.0 )
Expand All @@ -140,6 +141,7 @@ class CORE_EXPORT QgsDiagramSettings
bool scaleByArea;
int angleOffset;

bool scaleBasedVisibility;
//scale range (-1 if no lower / upper bound )
double minScaleDenominator;
double maxScaleDenominator;
Expand Down

0 comments on commit b2ca7fa

Please sign in to comment.