Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
color works for scalebars
  • Loading branch information
olivierdalang authored and mhugent committed Jan 22, 2013
1 parent 4066b91 commit f6cda09
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/core/composer/qgsscalebarstyle.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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() );
}

Expand All @@ -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() );
}

Expand Down

0 comments on commit f6cda09

Please sign in to comment.