ça marche tjs pas...

This commit is contained in:
redlegoreng 2013-01-19 20:53:41 +00:00 committed by Marco Hugentobler
parent 310875ea89
commit 8912dd3361
4 changed files with 12 additions and 10 deletions

View File

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

View File

@ -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;

View File

@ -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*/

View File

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