Skip to content

Commit 8912dd3

Browse files
redlegorengmhugent
redlegoreng
authored andcommittedJan 22, 2013
ça marche tjs pas...
1 parent 310875e commit 8912dd3

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed
 

‎src/app/composer/qgscomposerscalebarwidget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void QgsComposerScaleBarWidget::on_mFontColorPushButton_clicked()
304304
return;
305305
}
306306

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

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

315315
mComposerScaleBar->beginCommand( tr( "Scalebar font color changed" ) );
316316
disconnectUpdateSignal();
317-
QPen newPen( newColor );
318-
mComposerScaleBar->setFontPen( newPen );
317+
mComposerScaleBar->setFontColor( newColor );
319318
mComposerScaleBar->update();
320319
connectUpdateSignal();
321320
mComposerScaleBar->endCommand();

‎src/core/composer/qgscomposerscalebar.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition )
4040
, mSegmentMillimeters( 0.0 )
4141
, mAlignment( Left )
4242
, mUnits( MapUnits )
43+
, mFontColor( QColor( 255, 0, 0 ) )//TODO : set to 0,0,0
4344
{
4445
applyDefaultSettings();
4546
applyDefaultSize();
@@ -60,7 +61,7 @@ void QgsComposerScaleBar::paint( QPainter* painter, const QStyleOptionGraphicsIt
6061
}
6162

6263
drawBackground( painter );
63-
painter->setPen( mFontPen ); //draw all text black
64+
painter->setPen( QPen( QColor( mFontColor ) ) ); //draw all text black
6465

6566
//x-offset is half of first label width because labels are drawn centered
6667
QString firstLabel = firstLabelString();
@@ -228,7 +229,7 @@ void QgsComposerScaleBar::applyDefaultSettings()
228229
mBrush.setStyle( Qt::SolidPattern );
229230

230231
mFont.setPointSizeF( 12.0 );
231-
mFontColor = QColor(0,0,0);
232+
mFontColor = QColor( 255, 0, 0 );//TODO : set to 0,0,0
232233

233234
mLabelBarSpace = 3.0;
234235
mBoxContentSpace = 1.0;

‎src/core/composer/qgscomposerscalebar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
7575

7676
QFont font() const;
7777

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

8181
void setFont( const QFont& font );
8282

@@ -176,7 +176,7 @@ class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem
176176
QString mUnitLabeling;
177177
/**Font*/
178178
QFont mFont;
179-
QPen mFontPen;
179+
QColor mFontColor;
180180
/**Outline*/
181181
QPen mPen;
182182
/**Fill*/

‎src/core/composer/qgsscalebarstyle.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
7878

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

@@ -93,7 +94,8 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
9394
if ( !segmentInfo.isEmpty() )
9495
{
9596
currentNumericLabel = QString::number( currentLabelNumber / mScaleBar->numMapUnitsPerScaleBarUnit() );
96-
p->setPen( mScaleBar->fontColor() );//THIS SEEMS USELESS ?
97+
p->setPen( QPen(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
98+
p->setBrush( QBrush(mScaleBar->fontColor()) );//THIS SEEMS USELESS ?
9799
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() );
98100
}
99101

0 commit comments

Comments
 (0)
Please sign in to comment.