Skip to content
Permalink
Browse files
ça marche tjs pas...
  • Loading branch information
redlegoreng authored and mhugent committed Jan 22, 2013
1 parent 310875e commit 8912dd33617df00b758c98c9da62860358c29d4d
@@ -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
@@ -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();
@@ -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();
@@ -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();
@@ -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;
@@ -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 );

@@ -176,7 +176,7 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
QString mUnitLabeling;
/**Font*/
QFont mFont;
QPen mFontPen;
QColor mFontColor;
/**Outline*/
QPen mPen;
/**Fill*/
@@ -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() );
}

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

0 comments on commit 8912dd3

Please sign in to comment.