@@ -27,10 +27,10 @@ void QgsComposerRuler::paintEvent( QPaintEvent* event )
27
27
28
28
if ( mDirection == Horizontal )
29
29
{
30
- if ( doubleNear ( width (), 0 ) )
31
- {
32
- return ;
33
- }
30
+ if ( doubleNear ( width (), 0 ) )
31
+ {
32
+ return ;
33
+ }
34
34
35
35
// start x-coordinate
36
36
double startX = t.map ( QPointF ( 0 , 0 ) ).x ();
@@ -43,7 +43,7 @@ void QgsComposerRuler::paintEvent( QPaintEvent* event )
43
43
{
44
44
double pixelCoord = mTransform .map ( QPointF ( markerPos, 0 ) ).x ();
45
45
p.drawLine ( pixelCoord, 0 , pixelCoord, RULER_MIN_SIZE );
46
- p.drawText ( QPointF ( pixelCoord + 2 , RULER_MIN_SIZE / 2.0 ), QString::number ( ( int )( markerPos ) ) );
46
+ p.drawText ( QPointF ( pixelCoord + 2 , RULER_MIN_SIZE / 2.0 ), QString::number (( int )( markerPos ) ) );
47
47
}
48
48
markerPos += 10.0 ;
49
49
}
@@ -53,25 +53,25 @@ void QgsComposerRuler::paintEvent( QPaintEvent* event )
53
53
}
54
54
else // vertical
55
55
{
56
- if ( doubleNear ( height (), 0 ) )
57
- {
58
- return ;
59
- }
56
+ if ( doubleNear ( height (), 0 ) )
57
+ {
58
+ return ;
59
+ }
60
60
61
- double startY = t.map ( QPointF ( 0 , 0 ) ).y ();
62
- double endY = t.map ( QPointF ( 0 , height () ) ).y ();
61
+ double startY = t.map ( QPointF ( 0 , 0 ) ).y ();
62
+ double endY = t.map ( QPointF ( 0 , height () ) ).y ();
63
63
64
- double markerPos = ( floor ( startY / 10.0 ) + 1 ) + 10.0 ; // marker position in mm
65
- while ( markerPos <= endY )
64
+ double markerPos = ( floor ( startY / 10.0 ) + 1 ) * 10.0 ; // marker position in mm
65
+ while ( markerPos <= endY )
66
+ {
67
+ if ( markerPos >= 0 && markerPos <= 210 )
66
68
{
67
- if ( markerPos >= 0 && markerPos <= 210 )
68
- {
69
- double pixelCoord = mTransform .map ( QPointF ( 0 , markerPos ) ).y ();
70
- p.drawLine ( 0 , pixelCoord, RULER_MIN_SIZE, pixelCoord );
71
- p.drawText ( QPointF ( RULER_MIN_SIZE / 2.0 , pixelCoord + 2.0 ), QString::number ( markerPos ) );
72
- }
73
- markerPos += 10.0 ;
69
+ double pixelCoord = mTransform .map ( QPointF ( 0 , markerPos ) ).y ();
70
+ p.drawLine ( 0 , pixelCoord, RULER_MIN_SIZE, pixelCoord );
71
+ p.drawText ( QPointF ( RULER_MIN_SIZE / 2.0 , pixelCoord + 2.0 ), QString::number ( markerPos ) );
74
72
}
73
+ markerPos += 10.0 ;
74
+ }
75
75
}
76
76
}
77
77
0 commit comments