diff --git a/src/app/composer/qgscomposerscalebarwidget.cpp b/src/app/composer/qgscomposerscalebarwidget.cpp index e7f669a415b2..580ff4f69d90 100644 --- a/src/app/composer/qgscomposerscalebarwidget.cpp +++ b/src/app/composer/qgscomposerscalebarwidget.cpp @@ -204,7 +204,7 @@ void QgsComposerScaleBarWidget::on_mLineWidthSpinBox_valueChanged( double d ) mComposerScaleBar->beginCommand( tr( "Scalebar line width" ), QgsComposerMergeCommand::ScaleBarLineWidth ); disconnectUpdateSignal(); - QPen newPen( QColor( 0, 0, 0 ) ); + QPen newPen( mComposerScaleBar->pen().color() ); newPen.setWidthF( d ); mComposerScaleBar->setPen( newPen ); mComposerScaleBar->update(); @@ -321,6 +321,30 @@ void QgsComposerScaleBarWidget::on_mColorPushButton_clicked() mComposerScaleBar->endCommand(); } +void QgsComposerScaleBarWidget::on_mStrokeColorPushButton_clicked() +{ + if ( !mComposerScaleBar ) + { + return; + } + + QColor oldColor = mComposerScaleBar->pen().color(); + QColor newColor = QColorDialog::getColor( oldColor, 0 ); + + if ( !newColor.isValid() ) //user canceled the dialog + { + return; + } + + mComposerScaleBar->beginCommand( tr( "Scalebar color changed" ) ); + disconnectUpdateSignal(); + QPen newPen( newColor ); + mComposerScaleBar->setPen( newBrush ); + mComposerScaleBar->update(); + connectUpdateSignal(); + mComposerScaleBar->endCommand(); +} + void QgsComposerScaleBarWidget::on_mUnitLabelLineEdit_textChanged( const QString& text ) { if ( !mComposerScaleBar ) diff --git a/src/app/composer/qgscomposerscalebarwidget.h b/src/app/composer/qgscomposerscalebarwidget.h index 63b67066b711..bd0d9a214359 100644 --- a/src/app/composer/qgscomposerscalebarwidget.h +++ b/src/app/composer/qgscomposerscalebarwidget.h @@ -42,6 +42,7 @@ class QgsComposerScaleBarWidget: public QWidget, private Ui::QgsComposerScaleBar void on_mUnitLabelLineEdit_textChanged( const QString& text ); void on_mMapUnitsPerBarUnitSpinBox_valueChanged( double d ); void on_mColorPushButton_clicked(); + void on_mStrokeColorPushButton_clicked(); void on_mFontButton_clicked(); void on_mStyleComboBox_currentIndexChanged( const QString& text ); void on_mLabelBarSpaceSpinBox_valueChanged( double d ); diff --git a/src/ui/qgscomposerscalebarwidgetbase.ui b/src/ui/qgscomposerscalebarwidgetbase.ui index 2fd4ccf7908c..58e89da29516 100644 --- a/src/ui/qgscomposerscalebarwidgetbase.ui +++ b/src/ui/qgscomposerscalebarwidgetbase.ui @@ -6,8 +6,8 @@ 0 0 - 325 - 537 + 436 + 499 @@ -19,22 +19,25 @@ Barscale Options - + 0 - + 0 + + true + 0 - 0 - 315 - 501 + -138 + 415 + 636 @@ -42,77 +45,103 @@ - QFormLayout::ExpandingFieldsGrow + QFormLayout::AllNonFixedFieldsGrow - - + + - Segment size + Units + + + + + + + + + + Unit label true - mSegmentSizeSpinBox + mUnitLabelLineEdit - - - - 4 + + + + + + + Map units per bar unit - - 9999999999999.000000000000000 + + true + + + mMapUnitsPerBarUnitSpinBox - - - - Units + + + + 9999999999999.000000000000000 - - + + - Map units per bar unit + Segment size true - mMapUnitsPerBarUnitSpinBox + mSegmentSizeSpinBox - - + + + + 4 + 9999999999999.000000000000000 - + + + + Segments + + + + - Left segments + left - Right segments + right - + Style @@ -122,10 +151,10 @@ - + - + @@ -144,7 +173,7 @@ - + true @@ -157,17 +186,17 @@ - + Alignment - + - + mm @@ -177,7 +206,17 @@ - + + + + Label space + + + mm + + + + @@ -202,17 +241,7 @@ - - - - Label space - - - mm - - - - + Box space @@ -222,43 +251,37 @@ - - - - Unit label + + + + 0 - - true - - - mUnitLabelLineEdit - - - - - - - - - - - 0 - 0 - - - - Font... - - - - - - - Color... - - + + + + + 0 + 0 + + + + Font... + + + + + + + false + + + Font color... + + + + - + Qt::Vertical @@ -271,8 +294,26 @@ - - + + + + 0 + + + + + Fill color... + + + + + + + Stroke color... + + + +