1
.TH "QwtScaleDraw" 3 "24 May 2008" "Version 5.1.1" "Qwt User's Guide" \" -*- nroff -*-
9
Inherits \fBQwtAbstractScaleDraw\fP.
11
.SH "Detailed Description"
13
A class for drawing scales.
15
\fBQwtScaleDraw\fP can be used to draw linear or logarithmic scales. A scale has a position, an alignment and a length, which can be specified . The labels can be rotated and aligned to the ticks using \fBsetLabelRotation()\fP and \fBsetLabelAlignment()\fP.
17
After a scale division has been specified as a \fBQwtScaleDiv\fP object using \fBQwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s)\fP, the scale can be drawn with the \fBQwtAbstractScaleDraw::draw()\fP member.
19
Definition at line 30 of file qwt_scale_draw.h.
24
.RI "enum \fBAlignment\fP { \fBBottomScale\fP, \fBTopScale\fP, \fBLeftScale\fP, \fBRightScale\fP }"
27
.SS "Public Member Functions"
31
.RI "\fBQwtScaleDraw\fP ()"
34
.RI "\fBQwtScaleDraw\fP (const \fBQwtScaleDraw\fP &)"
37
.RI "virtual \fB~QwtScaleDraw\fP ()"
40
.RI "\fBQwtScaleDraw\fP & \fBoperator=\fP (const \fBQwtScaleDraw\fP &other)"
43
.RI "void \fBgetBorderDistHint\fP (const QFont &, int &start, int &end) const"
46
.RI "int \fBminLabelDist\fP (const QFont &) const "
49
.RI "int \fBminLength\fP (const QPen &, const QFont &) const"
52
.RI "virtual int \fBextent\fP (const QPen &, const QFont &) const"
55
.RI "void \fBmove\fP (int x, int y)"
58
.RI "void \fBmove\fP (const QPoint &)"
61
.RI "void \fBsetLength\fP (int length)"
64
.RI "\fBAlignment\fP \fBalignment\fP () const"
67
.RI "void \fBsetAlignment\fP (\fBAlignment\fP)"
70
.RI "Qt::Orientation \fBorientation\fP () const"
73
.RI "QPoint \fBpos\fP () const"
76
.RI "int \fBlength\fP () const"
79
.RI "void \fBsetLabelAlignment\fP (\fBQt::Alignment\fP)"
82
.RI "\fBQt::Alignment\fP \fBlabelAlignment\fP () const"
85
.RI "void \fBsetLabelRotation\fP (double rotation)"
88
.RI "double \fBlabelRotation\fP () const"
91
.RI "int \fBmaxLabelHeight\fP (const QFont &) const "
94
.RI "int \fBmaxLabelWidth\fP (const QFont &) const "
97
.RI "QPoint \fBlabelPosition\fP (double val) const"
100
.RI "QRect \fBlabelRect\fP (const QFont &, double val) const"
103
.RI "QSize \fBlabelSize\fP (const QFont &, double val) const"
106
.RI "QRect \fBboundingLabelRect\fP (const QFont &, double val) const"
109
.SS "Protected Member Functions"
113
.RI "QMatrix \fBlabelMatrix\fP (const QPoint &, const QSize &) const "
116
.RI "virtual void \fBdrawTick\fP (QPainter *p, double val, int len) const"
119
.RI "virtual void \fBdrawBackbone\fP (QPainter *p) const "
122
.RI "virtual void \fBdrawLabel\fP (QPainter *p, double val) const"
125
.SH "Member Enumeration Documentation"
127
.SS "enum \fBQwtScaleDraw::Alignment\fP"
129
Alignment of the scale draw
133
\fBsetAlignment()\fP, \fBalignment()\fP
138
Definition at line 37 of file qwt_scale_draw.h.
139
.SH "Constructor & Destructor Documentation"
141
.SS "QwtScaleDraw::QwtScaleDraw ()"
145
The range of the scale is initialized to [0, 100], The position is at (0, 0) with a length of 100. The orientation is QwtAbstractScaleDraw::Bottom.
147
Definition at line 60 of file qwt_scale_draw.cpp.
149
References setLength().
150
.SS "QwtScaleDraw::QwtScaleDraw (const \fBQwtScaleDraw\fP &)"
154
Definition at line 67 of file qwt_scale_draw.cpp.
157
.SS "QwtScaleDraw::~QwtScaleDraw ()\fC [virtual]\fP"
161
Definition at line 74 of file qwt_scale_draw.cpp.
162
.SH "Member Function Documentation"
164
.SS "\fBQwtScaleDraw\fP & QwtScaleDraw::operator= (const \fBQwtScaleDraw\fP & other)"
168
Definition at line 80 of file qwt_scale_draw.cpp.
171
.SS "void QwtScaleDraw::getBorderDistHint (const QFont & font, int & start, int & end) const"
173
Determine the minimum border distance.
175
This member function returns the minimum space needed to draw the mark labels at the scale's endpoints.
181
\fIstart\fP Start border distance
183
\fIend\fP End border distance
188
Definition at line 139 of file qwt_scale_draw.cpp.
190
References QwtAbstractScaleDraw::hasComponent(), labelRect(), QwtAbstractScaleDraw::map(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
192
Referenced by QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), QwtSlider::minimumSizeHint(), and minLength().
193
.SS "int QwtScaleDraw::minLabelDist (const QFont & font) const"
195
Determine the minimum distance between two labels, that is necessary that the texts don't overlap.
204
The maximum width of a label
209
\fBgetBorderDistHint()\fP
214
Definition at line 192 of file qwt_scale_draw.cpp.
216
References QwtAbstractScaleDraw::hasComponent(), labelRect(), labelRotation(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
218
Referenced by minLength().
219
.SS "int QwtScaleDraw::minLength (const QPen & pen, const QFont & font) const"
221
Calculate the minimum length that is needed to draw the scale
225
\fIpen\fP Pen that is used for painting backbone and ticks
227
\fIfont\fP Font used for painting the labels
237
Definition at line 318 of file qwt_scale_draw.cpp.
239
References getBorderDistHint(), QwtAbstractScaleDraw::hasComponent(), minLabelDist(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
241
Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint().
242
.SS "int QwtScaleDraw::extent (const QPen & pen, const QFont & font) const\fC [virtual]\fP"
244
Calculate the width/height that is needed for a vertical/horizontal scale.
246
The extent is calculated from the pen width of the backbone, the major tick length, the spacing and the maximum width/height of the labels.
250
\fIpen\fP Pen that is used for painting backbone and ticks
252
\fIfont\fP Font used for painting the labels
262
Implements \fBQwtAbstractScaleDraw\fP.
264
Definition at line 280 of file qwt_scale_draw.cpp.
266
References QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), maxLabelHeight(), maxLabelWidth(), QwtAbstractScaleDraw::minimumExtent(), orientation(), and QwtAbstractScaleDraw::spacing().
268
Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint().
269
.SS "void QwtScaleDraw::move (const QPoint & pos)"
271
Move the position of the scale.
273
The meaning of the parameter pos depends on the alignment:
274
.IP "\fBQwtScaleDraw::LeftScale \fP" 1c
275
The origin is the topmost point of the backbone. The backbone is a vertical line. Scale marks and labels are drawn at the left of the backbone.
276
.IP "\fBQwtScaleDraw::RightScale \fP" 1c
277
The origin is the topmost point of the backbone. The backbone is a vertical line. Scale marks and labels are drawn at the right of the backbone.
278
.IP "\fBQwtScaleDraw::TopScale \fP" 1c
279
The origin is the leftmost point of the backbone. The backbone is a horizontal line. Scale marks and labels are drawn above the backbone.
280
.IP "\fBQwtScaleDraw::BottomScale \fP" 1c
281
The origin is the leftmost point of the backbone. The backbone is a horizontal line Scale marks and labels are drawn below the backbone.
286
\fIpos\fP Origin of the scale
291
\fBpos()\fP, \fBsetLength()\fP
296
Definition at line 566 of file qwt_scale_draw.cpp.
297
.SS "void QwtScaleDraw::setLength (int length)"
299
Set the length of the backbone.
301
The length doesn't include the space needed for overlapping labels.
305
\fBmove()\fP, \fBminLabelDist()\fP
310
Definition at line 589 of file qwt_scale_draw.cpp.
312
Referenced by QwtPlotScaleItem::draw(), QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), QwtPlot::printScale(), and QwtScaleDraw().
313
.SS "\fBQwtScaleDraw::Alignment\fP QwtScaleDraw::alignment () const"
315
Return alignment of the scale
324
Definition at line 91 of file qwt_scale_draw.cpp.
326
Referenced by QwtScaleWidget::alignment(), QwtPlotScaleItem::draw(), drawBackbone(), drawTick(), labelMatrix(), labelPosition(), QwtPlotScaleItem::setAlignment(), and QwtSlider::setScaleDraw().
327
.SS "void QwtScaleDraw::setAlignment (\fBAlignment\fP align)"
329
Set the alignment of the scale
331
The default alignment is QwtScaleDraw::BottomScale
340
Definition at line 102 of file qwt_scale_draw.cpp.
342
Referenced by QwtThermo::layoutThermo(), QwtPlotScaleItem::setAlignment(), QwtSlider::setScaleDraw(), QwtScaleWidget::setScaleDraw(), and QwtSlider::setScalePosition().
343
.SS "Qt::Orientation QwtScaleDraw::orientation () const"
345
Return the orientation
347
TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales.
356
Definition at line 115 of file qwt_scale_draw.cpp.
358
Referenced by QwtPlotScaleItem::draw(), QwtScaleWidget::drawColorBar(), drawTick(), extent(), getBorderDistHint(), minLabelDist(), QwtPlot::printScale(), and QwtPlotScaleItem::updateScaleDiv().
359
.SS "QPoint QwtScaleDraw::pos () const"
368
\fBmove()\fP, \fBlength()\fP
373
Definition at line 576 of file qwt_scale_draw.cpp.
375
Referenced by boundingLabelRect(), drawBackbone(), drawLabel(), drawTick(), labelRect(), and QwtPlot::printScale().
376
.SS "int QwtScaleDraw::length () const"
380
the length of the backbone
385
\fBsetLength()\fP, \fBpos()\fP
390
Definition at line 604 of file qwt_scale_draw.cpp.
392
Referenced by QwtPlot::printScale().
393
.SS "void QwtScaleDraw::setLabelAlignment (\fBQt::Alignment\fP alignment)"
395
Change the label flags.
397
Labels are aligned to the point ticklength + spacing away from the backbone.
399
The alignment is relative to the orientation of the label text. In case of an flags of 0 the label will be aligned depending on the orientation of the scale:
401
QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop
403
QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom
405
QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter
407
QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter
410
Changing the alignment is often necessary for rotated labels.
414
\fIalignment\fP Or'd Qt::AlignmentFlags <see qnamespace.h>
419
\fBsetLabelRotation()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP
424
The various alignments might be confusing. The alignment of the label is not the alignment of the scale and is not the alignment of the flags (QwtText::flags()) returned from \fBQwtAbstractScaleDraw::label()\fP.
429
Definition at line 851 of file qwt_scale_draw.cpp.
430
.SS "\fBQt::Alignment\fP QwtScaleDraw::labelAlignment () const"
439
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP
444
Definition at line 864 of file qwt_scale_draw.cpp.
446
Referenced by labelMatrix().
447
.SS "void QwtScaleDraw::setLabelRotation (double rotation)"
451
When changing the rotation, it might be necessary to adjust the label flags too. Finding a useful combination is often the result of try and error.
455
\fIrotation\fP Angle in degrees. When changing the label rotation, the label flags often needs to be adjusted too.
460
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP.
465
Definition at line 809 of file qwt_scale_draw.cpp.
466
.SS "double QwtScaleDraw::labelRotation () const"
475
\fBsetLabelRotation()\fP, \fBlabelAlignment()\fP
480
Definition at line 818 of file qwt_scale_draw.cpp.
482
Referenced by labelMatrix(), and minLabelDist().
483
.SS "int QwtScaleDraw::maxLabelHeight (const QFont & font) const"
492
the maximum height of a label
497
Definition at line 897 of file qwt_scale_draw.cpp.
499
References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
501
Referenced by extent().
502
.SS "int QwtScaleDraw::maxLabelWidth (const QFont & font) const"
511
the maximum width of a label
516
Definition at line 874 of file qwt_scale_draw.cpp.
518
References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
520
Referenced by extent().
521
.SS "QPoint QwtScaleDraw::labelPosition (double value) const"
523
Find the position, where to paint a label
525
The position has a distance of \fBmajTickLength()\fP + \fBspacing()\fP + 1 from the backbone. The direction depends on the \fBalignment()\fP
534
Definition at line 356 of file qwt_scale_draw.cpp.
536
References alignment(), QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), QwtAbstractScaleDraw::map(), QwtAbstractScaleDraw::spacing(), and QwtScaleMap::transform().
538
Referenced by boundingLabelRect(), drawLabel(), and labelRect().
539
.SS "QRect QwtScaleDraw::labelRect (const QFont & font, double value) const"
541
Find the bounding rect for the label. The coordinates of the rect are relative to spacing + ticklength from the backbone in direction of the tick.
545
\fIfont\fP Font used for painting
552
Definition at line 747 of file qwt_scale_draw.cpp.
554
References QwtText::isEmpty(), labelMatrix(), labelPosition(), labelSize(), pos(), QwtText::textSize(), QwtAbstractScaleDraw::tickLabel(), and QwtMetricsMap::translate().
556
Referenced by getBorderDistHint(), labelSize(), and minLabelDist().
557
.SS "QSize QwtScaleDraw::labelSize (const QFont & font, double value) const"
559
Calculate the size that is needed to draw a label
563
\fIfont\fP Label font
570
Definition at line 791 of file qwt_scale_draw.cpp.
572
References labelRect().
574
Referenced by boundingLabelRect(), drawLabel(), labelRect(), maxLabelHeight(), and maxLabelWidth().
575
.SS "QRect QwtScaleDraw::boundingLabelRect (const QFont & font, double value) const"
577
Find the bounding rect for the label. The coordinates of the rect are absolute coordinates ( calculated from \fBpos()\fP ). in direction of the tick.
581
\fIfont\fP Font used for painting
593
Definition at line 652 of file qwt_scale_draw.cpp.
595
References QwtText::isEmpty(), labelMatrix(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel().
596
.SS "QMatrix QwtScaleDraw::labelMatrix (const QPoint & pos, const QSize & size) const\fC [protected]\fP"
598
Calculate the matrix that is needed to paint a label depending on its alignment and rotation.
602
\fIpos\fP Position where to paint the label
604
\fIsize\fP Size of the label
609
\fBsetLabelAlignment()\fP, \fBsetLabelRotation()\fP
614
Definition at line 676 of file qwt_scale_draw.cpp.
616
References alignment(), labelAlignment(), and labelRotation().
618
Referenced by boundingLabelRect(), drawLabel(), and labelRect().
619
.SS "void QwtScaleDraw::drawTick (QPainter * painter, double value, int len) const\fC [protected, virtual]\fP"
625
\fIpainter\fP Painter
627
\fIvalue\fP Value of the tick
629
\fIlen\fP Lenght of the tick
634
\fBdrawBackbone()\fP, \fBdrawLabel()\fP
639
Implements \fBQwtAbstractScaleDraw\fP.
641
Definition at line 406 of file qwt_scale_draw.cpp.
643
References alignment(), QwtPainter::drawLine(), QwtMetricsMap::isIdentity(), QwtMetricsMap::layoutToDevice(), QwtMetricsMap::layoutToDeviceX(), QwtMetricsMap::layoutToDeviceY(), QwtAbstractScaleDraw::map(), QwtPainter::metricsMap(), orientation(), pos(), QwtPainter::resetMetricsMap(), QwtAbstractScaleDraw::scaleMap(), and QwtPainter::setMetricsMap().
644
.SS "void QwtScaleDraw::drawBackbone (QPainter * painter) const\fC [protected, virtual]\fP"
646
Draws the baseline of the scale
650
\fIpainter\fP Painter
655
\fBdrawTick()\fP, \fBdrawLabel()\fP
660
Implements \fBQwtAbstractScaleDraw\fP.
662
Definition at line 507 of file qwt_scale_draw.cpp.
664
References alignment(), QwtPainter::drawLine(), and pos().
665
.SS "void QwtScaleDraw::drawLabel (QPainter * painter, double value) const\fC [protected, virtual]\fP"
667
Draws the label for a major scale tick
671
\fIpainter\fP Painter
678
\fBdrawTick()\fP, \fBdrawBackbone()\fP, \fBboundingLabelRect()\fP
683
Implements \fBQwtAbstractScaleDraw\fP.
685
Definition at line 617 of file qwt_scale_draw.cpp.
687
References QwtText::draw(), QwtText::isEmpty(), labelMatrix(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel().
691
Generated automatically by Doxygen for Qwt User's Guide from the source code.