Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ça marche tjs pas...
  • Loading branch information
redlegoreng authored and mhugent committed Jan 22, 2013
1 parent 310875e commit 8912dd3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -304,7 +304,7 @@ void QgsComposerScaleBarWidget::on_mFontColorPushButton_clicked()
return;
}

QColor oldColor = mComposerScaleBar->fontPen().color();
QColor oldColor = mComposerScaleBar->fontColor();
QColor newColor = QColorDialog::getColor( oldColor, 0 );

if ( !newColor.isValid() ) //user canceled the dialog
Expand All @@ -314,8 +314,7 @@ void QgsComposerScaleBarWidget::on_mFontColorPushButton_clicked()

mComposerScaleBar->beginCommand( tr( "Scalebar font color changed" ) );
disconnectUpdateSignal();
QPen newPen( newColor );
mComposerScaleBar->setFontPen( newPen );
mComposerScaleBar->setFontColor( newColor );
mComposerScaleBar->update();
connectUpdateSignal();
mComposerScaleBar->endCommand();
Expand Down
5 changes: 3 additions & 2 deletions src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -40,6 +40,7 @@ QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition )
, mSegmentMillimeters( 0.0 )
, mAlignment( Left )
, mUnits( MapUnits )
, mFontColor( QColor( 255, 0, 0 ) )//TODO : set to 0,0,0
{
applyDefaultSettings();
applyDefaultSize();
Expand All @@ -60,7 +61,7 @@ void QgsComposerScaleBar::paint( QPainter* painter, const QStyleOptionGraphicsIt
}

drawBackground( painter );
painter->setPen( mFontPen ); //draw all text black
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 Expand Up @@ -228,7 +229,7 @@ void QgsComposerScaleBar::applyDefaultSettings()
mBrush.setStyle( Qt::SolidPattern );

mFont.setPointSizeF( 12.0 );
mFontColor = QColor(0,0,0);
mFontColor = QColor( 255, 0, 0 );//TODO : set to 0,0,0

mLabelBarSpace = 3.0;
mBoxContentSpace = 1.0;
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposerscalebar.h
Expand Up @@ -75,8 +75,8 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem

QFont font() const;

QPen fontPen()const {return mFontPen;}
void setFontPen( const QPen& pen ) {mFontPen = pen;}
QColor fontColor() const {return mFontColor;}
void setFontColor( const QColor& c ) {mFontColor = c;}

void setFont( const QFont& font );

Expand Down Expand Up @@ -176,7 +176,7 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
QString mUnitLabeling;
/**Font*/
QFont mFont;
QPen mFontPen;
QColor mFontColor;
/**Outline*/
QPen mPen;
/**Fill*/
Expand Down
6 changes: 4 additions & 2 deletions src/core/composer/qgsscalebarstyle.cpp
Expand Up @@ -78,7 +78,8 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const

if ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft ) //don't draw label for intermediate left segments
{
p->setPen( mScaleBar->fontColor() );//THIS SEEMS USELESS ?
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 @@ -93,7 +94,8 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
if ( !segmentInfo.isEmpty() )
{
currentNumericLabel = QString::number( currentLabelNumber / mScaleBar->numMapUnitsPerScaleBarUnit() );
p->setPen( mScaleBar->fontColor() );//THIS SEEMS USELESS ?
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 8912dd3

Please sign in to comment.