Qwt User's Guide: qwt_scale_draw.cpp Source File

Qwt User's Guide 6.2.0

qwt_scale_draw.cpp
1 /******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #include "qwt_scale_draw.h"
11 #include "qwt_scale_div.h"
12 #include "qwt_scale_map.h"
13 #include "qwt_math.h"
14 #include "qwt_painter.h"
15 #include "qwt_text.h"
16
17 #include <qpainter.h>
18 #include <qpaintengine.h>
19 #include <qmath.h>
20
21 static inline double qwtEffectivePenWidth( const QwtAbstractScaleDraw* scaleDraw )
22 {
23 return qwtMaxF( scaleDraw->penWidthF(), 1.0 );
24 }
25
26 namespace QwtScaleRendererReal
27 {
28 inline qreal penWidth( const QPainter* painter, const QwtScaleDraw* scaleDraw )
29 {
30 qreal width = scaleDraw->penWidthF();
31 #if 1
32 if ( width <= 0.0 )
33 width = 1.0;
34 #endif
35
36 if ( painter->pen().isCosmetic() )
37 {
38 const QTransform& transform = painter->transform();
39
40 switch ( scaleDraw->alignment() )
41 {
42 case QwtScaleDraw::LeftScale:
43 case QwtScaleDraw::RightScale:
44 {
45 width /= transform.m11();
46 break;
47 }
48 case QwtScaleDraw::TopScale:
49 case QwtScaleDraw::BottomScale:
50 {
51 width /= transform.m22();
52 break;
53 }
54 }
55 }
56
57 return width;
58 }
59
60 inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
61 {
62 const qreal pw2 = 0.5 * penWidth( painter, scaleDraw );
63
64 const QPointF pos = scaleDraw->pos();
65 const qreal length = scaleDraw->length();
66
67 switch ( scaleDraw->alignment() )
68 {
69 case QwtScaleDraw::LeftScale:
70 {
71 const qreal x = pos.x() + 1.0 - pw2;
72 QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
73
74 break;
75 }
76 case QwtScaleDraw::RightScale:
77 {
78 const qreal x = pos.x() - 1.0 + pw2;
79 QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
80
81 break;
82 }
83 case QwtScaleDraw::TopScale:
84 {
85 const qreal y = pos.y() + 1.0 - pw2;
86 QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
87
88 break;
89 }
90 case QwtScaleDraw::BottomScale:
91 {
92 const qreal y = pos.y() - 1.0 + pw2;
93 QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
94
95 break;
96 }
97 }
98 }
99
100 inline void drawTick( QPainter* painter,
101 const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
102 {
103 const QPointF pos = scaleDraw->pos();
104
105 qreal pw = 0.0;
106
107 if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
108 pw = penWidth( painter, scaleDraw );
109
110 const qreal length = tickLength + pw;
111
112 /*
113 Those correction offsets have been found by try and error.
114 They need to be understood and replaced by a calculation,
115 that makes sense. TODO ...
116 */
117 const qreal off1 = 1.0;
118 const qreal off2 = ( scaleDraw->penWidthF() <= 0.0 ) ? 0.5 : 0.0;
119
120 switch ( scaleDraw->alignment() )
121 {
122 case QwtScaleDraw::LeftScale:
123 {
124 const qreal x = pos.x() + off1 - off2;
125 QwtPainter::drawLine( painter, x, tickPos, x - length, tickPos );
126
127 break;
128 }
129 case QwtScaleDraw::RightScale:
130 {
131 const qreal x = pos.x() - off1 + off2;
132 QwtPainter::drawLine( painter, x, tickPos, x + length, tickPos );
133 break;
134 }
135 case QwtScaleDraw::TopScale:
136 {
137 const qreal y = pos.y() + off1 - 2 * off2;
138 QwtPainter::drawLine( painter, tickPos, y, tickPos, y - length );
139
140 break;
141 }
142 case QwtScaleDraw::BottomScale:
143 {
144 const qreal y = pos.y() - off1 + off2;
145 QwtPainter::drawLine( painter, tickPos, y, tickPos, y + length );
146
147 break;
148 }
149 }
150 }
151 }
152
153 namespace QwtScaleRendererInt
154 {
155 inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
156 {
157 const int pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
158
159 const qreal length = scaleDraw->length();
160 const QPointF pos = scaleDraw->pos();
161
162 switch ( scaleDraw->alignment() )
163 {
164 case QwtScaleDraw::LeftScale:
165 {
166 const qreal x = qRound( pos.x() - ( pw - 1 ) / 2 );
167 QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
168
169 break;
170 }
171 case QwtScaleDraw::RightScale:
172 {
173 const qreal x = qRound( pos.x() + pw / 2 );
174 QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
175
176 break;
177 }
178 case QwtScaleDraw::TopScale:
179 {
180 const qreal y = qRound( pos.y() - ( pw - 1 ) / 2 );
181 QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
182
183 break;
184 }
185 case QwtScaleDraw::BottomScale:
186 {
187 const qreal y = qRound( pos.y() + pw / 2 );
188 QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
189
190 break;
191 }
192 }
193 }
194
195 inline void drawTick( QPainter* painter,
196 const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
197 {
198 const QPointF pos = scaleDraw->pos();
199 tickPos = qRound( tickPos );
200
201 int pw = 0;
202 if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
203 pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
204
205 int len = qMax( qRound( tickLength ), 1 );
206
207 // the width of ticks at the borders might extent the backbone
208 len += pw;
209
210 if ( painter->pen().capStyle() == Qt::FlatCap )
211 len++; // the end point is not rendered
212
213 qreal off = 0.0;
214
215 if ( painter->paintEngine()->type() == QPaintEngine::X11 )
216 {
217 if ( pw == 1 )
218 {
219 // In opposite to raster, X11 paints the end point
220 off = 1.0;
221 }
222 }
223
224 switch ( scaleDraw->alignment() )
225 {
226 case QwtScaleDraw::LeftScale:
227 {
228 const qreal x1 = qRound( pos.x() ) + 1;
229 const qreal x2 = x1 - len + 1;
230
231 QwtPainter::drawLine( painter, x2, tickPos, x1 - off, tickPos );
232
233 break;
234 }
235 case QwtScaleDraw::RightScale:
236 {
237 const qreal x1 = qRound( pos.x() );
238 const qreal x2 = x1 + len - 1;
239
240 QwtPainter::drawLine( painter, x1, tickPos, x2 - off, tickPos );
241
242 break;
243 }
244 case QwtScaleDraw::BottomScale:
245 {
246 const qreal y1 = qRound( pos.y() );
247 const qreal y2 = y1 + len - 1;
248
249 QwtPainter::drawLine( painter, tickPos, y1, tickPos, y2 - off );
250
251 break;
252 }
253 case QwtScaleDraw::TopScale:
254 {
255 const qreal y1 = qRound( pos.y() );
256 const qreal y2 = y1 - len + 1;
257
258 QwtPainter::drawLine( painter, tickPos, y2 + 1, tickPos, y1 + 1 - off );
259
260 break;
261 }
262 }
263 }
264 }
265
266 class QwtScaleDraw::PrivateData
267 {
268 public:
269 PrivateData()
270 : len( 0 )
271 , alignment( QwtScaleDraw::BottomScale )
272 , labelRotation( 0.0 )
273 {
274 }
275
276 QPointF pos;
277 double len;
278
279 Alignment alignment;
280
281 Qt::Alignment labelAlignment;
282 double labelRotation;
283 };
284
292 QwtScaleDraw::QwtScaleDraw()
293 {
294 m_data = new QwtScaleDraw::PrivateData;
295 setLength( 100 );
296 }
297
299 QwtScaleDraw::~QwtScaleDraw()
300 {
301 delete m_data;
302 }
303
309 QwtScaleDraw::Alignment QwtScaleDraw::alignment() const
310 {
311 return m_data->alignment;
312 }
313
322 void QwtScaleDraw::setAlignment( Alignment align )
323 {
324 m_data->alignment = align;
325 }
326
337 Qt::Orientation QwtScaleDraw::orientation() const
338 {
339 switch ( m_data->alignment )
340 {
341 case TopScale:
342 case BottomScale:
343 return Qt::Horizontal;
344 case LeftScale:
345 case RightScale:
346 default:
347 return Qt::Vertical;
348 }
349 }
350
361 void QwtScaleDraw::getBorderDistHint(
362 const QFont& font, int& start, int& end ) const
363 {
364 start = 0;
365 end = 1.0;
366
367 if ( !hasComponent( QwtAbstractScaleDraw::Labels ) )
368 return;
369
370 const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
371 if ( ticks.count() == 0 )
372 return;
373
374 // Find the ticks, that are mapped to the borders.
375 // minTick is the tick, that is mapped to the top/left-most position
376 // in widget coordinates.
377
378 double minTick = ticks[0];
379 double minPos = scaleMap().transform( minTick );
380 double maxTick = minTick;
381 double maxPos = minPos;
382
383 for ( int i = 1; i < ticks.count(); i++ )
384 {
385 const double tickPos = scaleMap().transform( ticks[i] );
386 if ( tickPos < minPos )
387 {
388 minTick = ticks[i];
389 minPos = tickPos;
390 }
391 if ( tickPos > scaleMap().transform( maxTick ) )
392 {
393 maxTick = ticks[i];
394 maxPos = tickPos;
395 }
396 }
397
398 double e = 0.0;
399 double s = 0.0;
400 if ( orientation() == Qt::Vertical )
401 {
402 s = -labelRect( font, minTick ).top();
403 s -= qAbs( minPos - qRound( scaleMap().p2() ) );
404
405 e = labelRect( font, maxTick ).bottom();
406 e -= qAbs( maxPos - scaleMap().p1() );
407 }
408 else
409 {
410 s = -labelRect( font, minTick ).left();
411 s -= qAbs( minPos - scaleMap().p1() );
412
413 e = labelRect( font, maxTick ).right();
414 e -= qAbs( maxPos - scaleMap().p2() );
415 }
416
417 if ( s < 0.0 )
418 s = 0.0;
419 if ( e < 0.0 )
420 e = 0.0;
421
422 start = qwtCeil( s );
423 end = qwtCeil( e );
424 }
425
436 int QwtScaleDraw::minLabelDist( const QFont& font ) const
437 {
438 if ( !hasComponent( QwtAbstractScaleDraw::Labels ) )
439 return 0;
440
441 const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
442 if ( ticks.isEmpty() )
443 return 0;
444
445 const QFontMetrics fm( font );
446
447 const bool vertical = ( orientation() == Qt::Vertical );
448
449 QRectF bRect1;
450 QRectF bRect2 = labelRect( font, ticks[0] );
451 if ( vertical )
452 {
453 bRect2.setRect( -bRect2.bottom(), 0.0, bRect2.height(), bRect2.width() );
454 }
455
456 double maxDist = 0.0;
457
458 for ( int i = 1; i < ticks.count(); i++ )
459 {
460 bRect1 = bRect2;
461 bRect2 = labelRect( font, ticks[i] );
462 if ( vertical )
463 {
464 bRect2.setRect( -bRect2.bottom(), 0.0,
465 bRect2.height(), bRect2.width() );
466 }
467
468 double dist = fm.leading(); // space between the labels
469 if ( bRect1.right() > 0 )
470 dist += bRect1.right();
471 if ( bRect2.left() < 0 )
472 dist += -bRect2.left();
473
474 if ( dist > maxDist )
475 maxDist = dist;
476 }
477
478 double angle = qwtRadians( labelRotation() );
479 if ( vertical )
480 angle += M_PI / 2;
481
482 const double sinA = qFastSin( angle ); // qreal -> double
483 if ( qFuzzyCompare( sinA + 1.0, 1.0 ) )
484 return qCeil( maxDist );
485
486 const int fmHeight = fm.ascent() - 2;
487
488 // The distance we need until there is
489 // the height of the label font. This height is needed
490 // for the neighbored label.
491
492 double labelDist = fmHeight / qFastSin( angle ) * qFastCos( angle );
493 if ( labelDist < 0 )
494 labelDist = -labelDist;
495
496 // For text orientations close to the scale orientation
497
498 if ( labelDist > maxDist )
499 labelDist = maxDist;
500
501 // For text orientations close to the opposite of the
502 // scale orientation
503
504 if ( labelDist < fmHeight )
505 labelDist = fmHeight;
506
507 return qCeil( labelDist );
508 }
509
523 double QwtScaleDraw::extent( const QFont& font ) const
524 {
525 double d = 0;
526
527 if ( hasComponent( QwtAbstractScaleDraw::Labels ) )
528 {
529 if ( orientation() == Qt::Vertical )
530 d = maxLabelWidth( font );
531 else
532 d = maxLabelHeight( font );
533
534 if ( d > 0 )
535 d += spacing();
536 }
537
538 if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
539 {
540 d += maxTickLength();
541 }
542
543 if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
544 {
545 d += qwtEffectivePenWidth( this );
546 }
547
548 d = qwtMaxF( d, minimumExtent() );
549 return d;
550 }
551
560 int QwtScaleDraw::minLength( const QFont& font ) const
561 {
562 int startDist, endDist;
563 getBorderDistHint( font, startDist, endDist );
564
565 const QwtScaleDiv& sd = scaleDiv();
566
567 const uint minorCount =
568 sd.ticks( QwtScaleDiv::MinorTick ).count() +
569 sd.ticks( QwtScaleDiv::MediumTick ).count();
570 const uint majorCount =
571 sd.ticks( QwtScaleDiv::MajorTick ).count();
572
573 int lengthForLabels = 0;
574 if ( hasComponent( QwtAbstractScaleDraw::Labels ) )
575 lengthForLabels = minLabelDist( font ) * majorCount;
576
577 int lengthForTicks = 0;
578 if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
579 {
580 const double pw = qwtEffectivePenWidth( this );
581 lengthForTicks = qCeil( ( majorCount + minorCount ) * ( pw + 1.0 ) );
582 }
583
584 return startDist + endDist + qMax( lengthForLabels, lengthForTicks );
585 }
586
596 QPointF QwtScaleDraw::labelPosition( double value ) const
597 {
598 const double tval = scaleMap().transform( value );
599 double dist = spacing();
600 if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
601 dist += qwtEffectivePenWidth( this );
602
603 if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
604 dist += tickLength( QwtScaleDiv::MajorTick );
605
606 double px = 0;
607 double py = 0;
608
609 switch ( alignment() )
610 {
611 case RightScale:
612 {
613 px = m_data->pos.x() + dist;
614 py = tval;
615 break;
616 }
617 case LeftScale:
618 {
619 px = m_data->pos.x() - dist;
620 py = tval;
621 break;
622 }
623 case BottomScale:
624 {
625 px = tval;
626 py = m_data->pos.y() + dist;
627 break;
628 }
629 case TopScale:
630 {
631 px = tval;
632 py = m_data->pos.y() - dist;
633 break;
634 }
635 }
636
637 return QPointF( px, py );
638 }
639
649 void QwtScaleDraw::drawTick( QPainter* painter, double value, double len ) const
650 {
651 if ( len <= 0 )
652 return;
653
654 const double tval = scaleMap().transform( value );
655
656 if ( QwtPainter::roundingAlignment( painter ) )
657 QwtScaleRendererInt::drawTick( painter, this, tval, len );
658 else
659 QwtScaleRendererReal::drawTick( painter, this, tval, len );
660 }
661
668 void QwtScaleDraw::drawBackbone( QPainter* painter ) const
669 {
670 if ( QwtPainter::roundingAlignment( painter ) )
671 QwtScaleRendererInt::drawBackbone( painter, this );
672 else
673 QwtScaleRendererReal::drawBackbone( painter, this );
674 }
675
707 void QwtScaleDraw::move( const QPointF& pos )
708 {
709 m_data->pos = pos;
710 updateMap();
711 }
712
717 QPointF QwtScaleDraw::pos() const
718 {
719 return m_data->pos;
720 }
721
732 void QwtScaleDraw::setLength( double length )
733 {
734 #if 0
735 if ( length >= 0 && length < 10 )
736 length = 10;
737
738 // why should we accept negative lengths ???
739 if ( length < 0 && length > -10 )
740 length = -10;
741 #else
742 length = qwtMaxF( length, 10.0 );
743 #endif
744
745 m_data->len = length;
746 updateMap();
747 }
748
753 double QwtScaleDraw::length() const
754 {
755 return m_data->len;
756 }
757
766 void QwtScaleDraw::drawLabel( QPainter* painter, double value ) const
767 {
768 QwtText lbl = tickLabel( painter->font(), value );
769 if ( lbl.isEmpty() )
770 return;
771
772 QPointF pos = labelPosition( value );
773
774 QSizeF labelSize = lbl.textSize( painter->font() );
775
776 const QTransform transform = labelTransformation( pos, labelSize );
777
778 painter->save();
779 painter->setWorldTransform( transform, true );
780
781 lbl.draw ( painter, QRect( QPoint( 0, 0 ), labelSize.toSize() ) );
782
783 painter->restore();
784 }
785
798 QRect QwtScaleDraw::boundingLabelRect( const QFont& font, double value ) const
799 {
800 QwtText lbl = tickLabel( font, value );
801 if ( lbl.isEmpty() )
802 return QRect();
803
804 const QPointF pos = labelPosition( value );
805 QSizeF labelSize = lbl.textSize( font );
806
807 const QTransform transform = labelTransformation( pos, labelSize );
808 return transform.mapRect( QRect( QPoint( 0, 0 ), labelSize.toSize() ) );
809 }
810
821 QTransform QwtScaleDraw::labelTransformation(
822 const QPointF& pos, const QSizeF& size ) const
823 {
824 QTransform transform;
825 transform.translate( pos.x(), pos.y() );
826 transform.rotate( labelRotation() );
827
828 int flags = labelAlignment();
829 if ( flags == 0 )
830 {
831 switch ( alignment() )
832 {
833 case RightScale:
834 {
835 if ( flags == 0 )
836 flags = Qt::AlignRight | Qt::AlignVCenter;
837 break;
838 }
839 case LeftScale:
840 {
841 if ( flags == 0 )
842 flags = Qt::AlignLeft | Qt::AlignVCenter;
843 break;
844 }
845 case BottomScale:
846 {
847 if ( flags == 0 )
848 flags = Qt::AlignHCenter | Qt::AlignBottom;
849 break;
850 }
851 case TopScale:
852 {
853 if ( flags == 0 )
854 flags = Qt::AlignHCenter | Qt::AlignTop;
855 break;
856 }
857 }
858 }
859
860 double x, y;
861
862 if ( flags & Qt::AlignLeft )
863 x = -size.width();
864 else if ( flags & Qt::AlignRight )
865 x = 0.0;
866 else // Qt::AlignHCenter
867 x = -( 0.5 * size.width() );
868
869 if ( flags & Qt::AlignTop )
870 y = -size.height();
871 else if ( flags & Qt::AlignBottom )
872 y = 0;
873 else // Qt::AlignVCenter
874 y = -( 0.5 * size.height() );
875
876 transform.translate( x, y );
877
878 return transform;
879 }
880
891 QRectF QwtScaleDraw::labelRect( const QFont& font, double value ) const
892 {
893 QwtText lbl = tickLabel( font, value );
894 if ( lbl.isEmpty() )
895 return QRectF( 0.0, 0.0, 0.0, 0.0 );
896
897 const QPointF pos = labelPosition( value );
898
899 const QSizeF labelSize = lbl.textSize( font );
900 const QTransform transform = labelTransformation( pos, labelSize );
901
902 QRectF br = transform.mapRect( QRectF( QPointF( 0, 0 ), labelSize ) );
903 br.translate( -pos.x(), -pos.y() );
904
905 return br;
906 }
907
916 QSizeF QwtScaleDraw::labelSize( const QFont& font, double value ) const
917 {
918 return labelRect( font, value ).size();
919 }
920
934 void QwtScaleDraw::setLabelRotation( double rotation )
935 {
936 m_data->labelRotation = rotation;
937 }
938
943 double QwtScaleDraw::labelRotation() const
944 {
945 return m_data->labelRotation;
946 }
947
973 void QwtScaleDraw::setLabelAlignment( Qt::Alignment alignment )
974 {
975 m_data->labelAlignment = alignment;
976 }
977
982 Qt::Alignment QwtScaleDraw::labelAlignment() const
983 {
984 return m_data->labelAlignment;
985 }
986
991 int QwtScaleDraw::maxLabelWidth( const QFont& font ) const
992 {
993 double maxWidth = 0.0;
994
995 const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
996 for ( int i = 0; i < ticks.count(); i++ )
997 {
998 const double v = ticks[i];
999 if ( scaleDiv().contains( v ) )
1000 {
1001 const double w = labelSize( font, ticks[i] ).width();
1002 if ( w > maxWidth )
1003 maxWidth = w;
1004 }
1005 }
1006
1007 return qCeil( maxWidth );
1008 }
1009
1014 int QwtScaleDraw::maxLabelHeight( const QFont& font ) const
1015 {
1016 double maxHeight = 0.0;
1017
1018 const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
1019 for ( int i = 0; i < ticks.count(); i++ )
1020 {
1021 const double v = ticks[i];
1022 if ( scaleDiv().contains( v ) )
1023 {
1024 const double h = labelSize( font, ticks[i] ).height();
1025 if ( h > maxHeight )
1026 maxHeight = h;
1027 }
1028 }
1029
1030 return qCeil( maxHeight );
1031 }
1032
1033 void QwtScaleDraw::updateMap()
1034 {
1035 const QPointF pos = m_data->pos;
1036 double len = m_data->len;
1037
1038 QwtScaleMap& sm = scaleMap();
1039 if ( orientation() == Qt::Vertical )
1040 sm.setPaintInterval( pos.y() + len, pos.y() );
1041 else
1042 sm.setPaintInterval( pos.x(), pos.x() + len );
1043 }
QList< double >
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition: qwt_abstract_scale_draw.h:32
QwtAbstractScaleDraw::scaleMap
const QwtScaleMap & scaleMap() const
Definition: qwt_abstract_scale_draw.cpp:121
QwtAbstractScaleDraw::Ticks
@ Ticks
Ticks.
Definition: qwt_abstract_scale_draw.h:45
QwtAbstractScaleDraw::Backbone
@ Backbone
Backbone = the line where the ticks are located.
Definition: qwt_abstract_scale_draw.h:42
QwtAbstractScaleDraw::Labels
@ Labels
Labels.
Definition: qwt_abstract_scale_draw.h:48
QwtAbstractScaleDraw::tickLength
double tickLength(QwtScaleDiv::TickType) const
Definition: qwt_abstract_scale_draw.cpp:338
QwtAbstractScaleDraw::hasComponent
bool hasComponent(ScaleComponent) const
Definition: qwt_abstract_scale_draw.cpp:95
QwtAbstractScaleDraw::tickLabel
const QwtText & tickLabel(const QFont &, double value) const
Convert a value into its representing label and cache it.
Definition: qwt_abstract_scale_draw.cpp:393
QwtAbstractScaleDraw::maxTickLength
double maxTickLength() const
Definition: qwt_abstract_scale_draw.cpp:355
QwtAbstractScaleDraw::minimumExtent
double minimumExtent() const
Definition: qwt_abstract_scale_draw.cpp:302
QwtAbstractScaleDraw::penWidthF
qreal penWidthF() const
Definition: qwt_abstract_scale_draw.cpp:156
QwtAbstractScaleDraw::scaleDiv
const QwtScaleDiv & scaleDiv() const
Definition: qwt_abstract_scale_draw.cpp:133
QwtAbstractScaleDraw::spacing
double spacing() const
Get the spacing.
Definition: qwt_abstract_scale_draw.cpp:271
QwtPainter::roundingAlignment
static bool roundingAlignment()
Definition: qwt_painter.h:183
QwtPainter::drawLine
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:154
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:34
QwtScaleDiv::ticks
QList< double > ticks(int tickType) const
Definition: qwt_scale_div.cpp:309
QwtScaleDiv::MediumTick
@ MediumTick
Medium ticks.
Definition: qwt_scale_div.h:46
QwtScaleDiv::MinorTick
@ MinorTick
Minor ticks.
Definition: qwt_scale_div.h:43
QwtScaleDiv::MajorTick
@ MajorTick
Major ticks.
Definition: qwt_scale_div.h:49
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:36
QwtScaleDraw::setLength
void setLength(double length)
Definition: qwt_scale_draw.cpp:732
QwtScaleDraw::boundingLabelRect
QRect boundingLabelRect(const QFont &, double value) const
Find the bounding rectangle for the label.
Definition: qwt_scale_draw.cpp:798
QwtScaleDraw::labelTransformation
QTransform labelTransformation(const QPointF &, const QSizeF &) const
Definition: qwt_scale_draw.cpp:821
QwtScaleDraw::labelAlignment
Qt::Alignment labelAlignment() const
Definition: qwt_scale_draw.cpp:982
QwtScaleDraw::move
void move(double x, double y)
Definition: qwt_scale_draw.h:118
QwtScaleDraw::labelRotation
double labelRotation() const
Definition: qwt_scale_draw.cpp:943
QwtScaleDraw::drawLabel
virtual void drawLabel(QPainter *, double value) const override
Definition: qwt_scale_draw.cpp:766
QwtScaleDraw::extent
virtual double extent(const QFont &) const override
Definition: qwt_scale_draw.cpp:523
QwtScaleDraw::getBorderDistHint
void getBorderDistHint(const QFont &, int &start, int &end) const
Determine the minimum border distance.
Definition: qwt_scale_draw.cpp:361
QwtScaleDraw::setLabelAlignment
void setLabelAlignment(Qt::Alignment)
Change the label flags.
Definition: qwt_scale_draw.cpp:973
QwtScaleDraw::minLength
int minLength(const QFont &) const
Definition: qwt_scale_draw.cpp:560
QwtScaleDraw::drawTick
virtual void drawTick(QPainter *, double value, double len) const override
Definition: qwt_scale_draw.cpp:649
QwtScaleDraw::length
double length() const
Definition: qwt_scale_draw.cpp:753
QwtScaleDraw::pos
QPointF pos() const
Definition: qwt_scale_draw.cpp:717
QwtScaleDraw::labelPosition
QPointF labelPosition(double value) const
Definition: qwt_scale_draw.cpp:596
QwtScaleDraw::setAlignment
void setAlignment(Alignment)
Definition: qwt_scale_draw.cpp:322
QwtScaleDraw::drawBackbone
virtual void drawBackbone(QPainter *) const override
Definition: qwt_scale_draw.cpp:668
QwtScaleDraw::alignment
Alignment alignment() const
Definition: qwt_scale_draw.cpp:309
QwtScaleDraw::~QwtScaleDraw
virtual ~QwtScaleDraw()
Destructor.
Definition: qwt_scale_draw.cpp:299
QwtScaleDraw::maxLabelHeight
int maxLabelHeight(const QFont &) const
Definition: qwt_scale_draw.cpp:1014
QwtScaleDraw::orientation
Qt::Orientation orientation() const
Definition: qwt_scale_draw.cpp:337
QwtScaleDraw::setLabelRotation
void setLabelRotation(double rotation)
Definition: qwt_scale_draw.cpp:934
QwtScaleDraw::maxLabelWidth
int maxLabelWidth(const QFont &) const
Definition: qwt_scale_draw.cpp:991
QwtScaleDraw::Alignment
Alignment
Definition: qwt_scale_draw.h:43
QwtScaleDraw::BottomScale
@ BottomScale
The scale is below.
Definition: qwt_scale_draw.h:45
QwtScaleDraw::TopScale
@ TopScale
The scale is above.
Definition: qwt_scale_draw.h:48
QwtScaleDraw::RightScale
@ RightScale
The scale is right.
Definition: qwt_scale_draw.h:54
QwtScaleDraw::LeftScale
@ LeftScale
The scale is left.
Definition: qwt_scale_draw.h:51
QwtScaleDraw::minLabelDist
int minLabelDist(const QFont &) const
Definition: qwt_scale_draw.cpp:436
QwtScaleDraw::QwtScaleDraw
QwtScaleDraw()
Constructor.
Definition: qwt_scale_draw.cpp:292
QwtScaleDraw::labelRect
QRectF labelRect(const QFont &, double value) const
Definition: qwt_scale_draw.cpp:891
QwtScaleDraw::labelSize
QSizeF labelSize(const QFont &, double value) const
Definition: qwt_scale_draw.cpp:916
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtScaleMap::transform
double transform(double s) const
Definition: qwt_scale_map.h:137
QwtScaleMap::setPaintInterval
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
Definition: qwt_scale_map.cpp:119
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtText::textSize
QSizeF textSize() const
Definition: qwt_text.cpp:570
QwtText::isEmpty
bool isEmpty() const
Definition: qwt_text.cpp:739
QwtText::draw
void draw(QPainter *painter, const QRectF &rect) const
Definition: qwt_text.cpp:615