Skip to content
Permalink
Browse files
color works for scalebars
  • Loading branch information
olivierdalang authored and mhugent committed Jan 22, 2013
1 parent 4066b91 commit f6cda0960f9226a859315572928dadcef481a2b8
Showing with 1 addition and 5 deletions.
  1. +0 −1 src/core/composer/qgscomposerscalebar.cpp
  2. +1 −4 src/core/composer/qgsscalebarstyle.cpp
@@ -61,7 +61,6 @@ void QgsComposerScaleBar::paint( QPainter* painter, const QStyleOptionGraphicsIt
}

drawBackground( painter );
painter->setPen( QPen( QColor( mFontColor ) ) ); //draw all text black

//x-offset is half of first label width because labels are drawn centered
QString firstLabel = firstLabelString();
@@ -44,6 +44,7 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
p->save();

p->setFont( mScaleBar->font() );
p->setPen( QPen(mScaleBar->fontColor()) );

QString firstLabel = mScaleBar->firstLabelString();
double xOffset = mScaleBar->textWidthMillimeters( mScaleBar->font(), firstLabel ) / 2;
@@ -78,8 +79,6 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const

if ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft ) //don't draw label for intermediate left segments
{
p->setPen( QPen(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
p->setBrush( QBrush(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
mScaleBar->drawText( p, segmentIt->first - mScaleBar->textWidthMillimeters( mScaleBar->font(), currentNumericLabel ) / 2 + xOffset, mScaleBar->fontAscentMillimeters( mScaleBar->font() ) + mScaleBar->boxContentSpace(), currentNumericLabel, mScaleBar->font() );
}

@@ -94,8 +93,6 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
if ( !segmentInfo.isEmpty() )
{
currentNumericLabel = QString::number( currentLabelNumber / mScaleBar->numMapUnitsPerScaleBarUnit() );
p->setPen( QPen(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
p->setBrush( QBrush(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
mScaleBar->drawText( p, segmentInfo.last().first + mScaleBar->segmentMillimeters() - mScaleBar->textWidthMillimeters( mScaleBar->font(), currentNumericLabel ) / 2 + xOffset, mScaleBar->fontAscentMillimeters( mScaleBar->font() ) + mScaleBar->boxContentSpace(), currentNumericLabel + " " + mScaleBar->unitLabeling(), mScaleBar->font() );
}

0 comments on commit f6cda09

Please sign in to comment.