qwt_scale_draw.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 
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  {
44  {
45  width /= transform.m11();
46  break;
47  }
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  {
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  }
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  }
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  }
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  {
123  {
124  const qreal x = pos.x() + off1 - off2;
125  QwtPainter::drawLine( painter, x, tickPos, x - length, tickPos );
126 
127  break;
128  }
130  {
131  const qreal x = pos.x() - off1 + off2;
132  QwtPainter::drawLine( painter, x, tickPos, x + length, tickPos );
133  break;
134  }
136  {
137  const qreal y = pos.y() + off1 - 2 * off2;
138  QwtPainter::drawLine( painter, tickPos, y, tickPos, y - length );
139 
140  break;
141  }
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 
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  {
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  }
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  }
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  }
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  {
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  }
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  }
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  }
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 
267 {
268 public:
270  len( 0 ),
271  alignment( QwtScaleDraw::BottomScale ),
272  labelRotation( 0.0 )
273  {
274  }
275 
276  QPointF pos;
277  double len;
278 
280 
281  Qt::Alignment labelAlignment;
283 };
284 
293 {
294  d_data = new QwtScaleDraw::PrivateData;
295  setLength( 100 );
296 }
297 
300 {
301  delete d_data;
302 }
303 
310 {
311  return d_data->alignment;
312 }
313 
323 {
324  d_data->alignment = align;
325 }
326 
337 Qt::Orientation QwtScaleDraw::orientation() const
338 {
339  switch ( d_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 
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 = d_data->pos.x() + dist;
614  py = tval;
615  break;
616  }
617  case LeftScale:
618  {
619  px = d_data->pos.x() - dist;
620  py = tval;
621  break;
622  }
623  case BottomScale:
624  {
625  px = tval;
626  py = d_data->pos.y() + dist;
627  break;
628  }
629  case TopScale:
630  {
631  px = tval;
632  py = d_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  d_data->pos = pos;
710  updateMap();
711 }
712 
717 QPointF QwtScaleDraw::pos() const
718 {
719  return d_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  d_data->len = length;
746  updateMap();
747 }
748 
753 double QwtScaleDraw::length() const
754 {
755  return d_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 
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  d_data->labelRotation = rotation;
937 }
938 
944 {
945  return d_data->labelRotation;
946 }
947 
973 void QwtScaleDraw::setLabelAlignment( Qt::Alignment alignment )
974 {
975  d_data->labelAlignment = alignment;
976 }
977 
982 Qt::Alignment QwtScaleDraw::labelAlignment() const
983 {
984  return d_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 
1034 {
1035  const QPointF pos = d_data->pos;
1036  double len = d_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 }
A abstract base class for drawing scales.
Definition: format.h:1173
void setAlignment(Alignment)
void setLength(double length)
virtual void drawTick(QPainter *, double value, double len) const QWT_OVERRIDE
QSizeF textSize() const
Definition: qwt_text.cpp:547
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:152
static double qwtEffectivePenWidth(const QwtAbstractScaleDraw *scaleDraw)
MQTTClient d
Definition: test10.c:1656
QWT_CONSTEXPR float qwtMaxF(float a, float b)
Definition: qwt_math.h:123
The scale is above.
void draw(QPainter *painter, const QRectF &rect) const
Definition: qwt_text.cpp:592
QPointF labelPosition(double value) const
A class representing a scale division.
Definition: qwt_scale_div.h:33
void getBorderDistHint(const QFont &, int &start, int &end) const
Determine the minimum border distance.
QPointF pos() const
QwtScaleDraw()
Constructor.
int minLength(const QFont &) const
void drawBackbone(QPainter *painter, const QwtScaleDraw *scaleDraw)
QRect boundingLabelRect(const QFont &, double value) const
Find the bounding rectangle for the label.
int minLabelDist(const QFont &) const
virtual ~QwtScaleDraw()
Destructor.
int maxLabelWidth(const QFont &) const
virtual void drawBackbone(QPainter *) const QWT_OVERRIDE
QTransform labelTransformation(const QPointF &, const QSizeF &) const
virtual void drawLabel(QPainter *, double value) const QWT_OVERRIDE
void * align(std::size_t alignment, std::size_t size, void *&ptr, std::size_t &space, std::size_t &required_space)
Definition: sol.hpp:9768
Alignment alignment() const
double qwtRadians(double degrees)
Translate degrees into radians.
Definition: qwt_math.h:247
The scale is left.
void drawBackbone(QPainter *painter, const QwtScaleDraw *scaleDraw)
bool isEmpty() const
Definition: qwt_text.cpp:716
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
A class representing a text.
Definition: qwt_text.h:51
void setLabelRotation(double rotation)
Backbone = the line where the ticks are located.
A scale map.
Definition: qwt_scale_map.h:26
Qt::Orientation orientation() const
Qt::Alignment labelAlignment() const
#define M_PI
Definition: qwt_math.h:56
QRectF labelRect(const QFont &, double value) const
The scale is right.
double length() const
void drawTick(QPainter *painter, const QwtScaleDraw *scaleDraw, qreal tickPos, qreal tickLength)
virtual double extent(const QFont &) const QWT_OVERRIDE
int maxLabelHeight(const QFont &) const
bool hasComponent(ScaleComponent) const
QSizeF labelSize(const QFont &, double value) const
A class for drawing scales.
qreal penWidth(const QPainter *painter, const QwtScaleDraw *scaleDraw)
QList< double > ticks(int tickType) const
double labelRotation() const
void drawTick(QPainter *painter, const QwtScaleDraw *scaleDraw, qreal tickPos, qreal tickLength)
void setLabelAlignment(Qt::Alignment)
Change the label flags.
int qwtCeil(qreal value)
Definition: qwt_math.h:262
The scale is below.
static bool roundingAlignment()
Definition: qwt_painter.h:181
int len
Definition: utf-8.c:46
void move(double x, double y)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10