Skip to content

Commit 52d9f3a

Browse files
committedJun 24, 2012
partial fix for label size + label tweaks
1 parent 02beea3 commit 52d9f3a

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
 

‎src/app/qgsdecorationgrid.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,19 @@ void QgsDecorationGrid::projectRead()
111111
"/AnnotationPosition", 0 );
112112
mGridAnnotationDirection = ( GridAnnotationDirection ) QgsProject::instance()->readNumEntry( mNameConfig,
113113
"/AnnotationDirection", 0 );
114-
mGridAnnotationFont.fromString( QgsProject::instance()->readEntry( mNameConfig, "/AnnotationFont", "" ) );
114+
QString fontStr = QgsProject::instance()->readEntry( mNameConfig, "/AnnotationFont", "" );
115+
if ( fontStr != "" )
116+
{
117+
mGridAnnotationFont.fromString( fontStr );
118+
}
119+
else
120+
{
121+
mGridAnnotationFont = QFont();
122+
// TODO fix font scaling problem - put a slightly large font for now
123+
mGridAnnotationFont.setPointSize( 16 );
124+
}
115125
mAnnotationFrameDistance = QgsProject::instance()->readDoubleEntry( mNameConfig, "/AnnotationFrameDistance", 0 );
116-
mGridAnnotationPrecision = QgsProject::instance()->readNumEntry( mNameConfig, "/AnnotationPrecision", 3 );
126+
mGridAnnotationPrecision = QgsProject::instance()->readNumEntry( mNameConfig, "/AnnotationPrecision", 0 );
117127

118128
// read symbol info from xml
119129
QDomDocument doc;
@@ -715,7 +725,9 @@ double QgsDecorationGrid::fontAscentMillimeters( const QFont& font ) const
715725

716726
double QgsDecorationGrid::pixelFontSize( double pointSize ) const
717727
{
718-
return ( pointSize * 0.3527 );
728+
// return ( pointSize * 0.3527 );
729+
// TODO fix font scaling problem - this seems to help, but text seems still a bit too small (about 5/6)
730+
return pointSize;
719731
}
720732

721733
QFont QgsDecorationGrid::scaledFontPixelSize( const QFont& font ) const

‎src/app/qgsdecorationgriddialog.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ void QgsDecorationGridDialog::on_mPbtnUpdateFromLayer_clicked()
284284
mIntervalYSpinBox->setValue( values[1] );
285285
mOffsetXSpinBox->setValue( values[2] );
286286
mOffsetYSpinBox->setValue( values[3] );
287+
if ( values[0] >= 1 )
288+
mCoordinatePrecisionSpinBox->setValue( 0 );
289+
else
290+
mCoordinatePrecisionSpinBox->setValue( 3 );
287291
}
288292
}
289293

@@ -313,6 +317,13 @@ void QgsDecorationGridDialog::updateInterval( bool force )
313317
mIntervalYSpinBox->setValue( values[1] );
314318
mOffsetXSpinBox->setValue( values[2] );
315319
mOffsetYSpinBox->setValue( values[3] );
320+
// also update coord. precision
321+
// if interval >= 1, set precision=0 because we have a rounded value
322+
// else set it to previous default of 3
323+
if ( values[0] >= 1 )
324+
mCoordinatePrecisionSpinBox->setValue( 0 );
325+
else
326+
mCoordinatePrecisionSpinBox->setValue( 3 );
316327
}
317328
}
318329
}

0 commit comments

Comments
 (0)
Please sign in to comment.