1
.TH "QwtScaleDraw" 3 "26 Feb 2007" "Version 5.0.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 (Qt::Alignment)"
82
.RI "Qt::Alignment \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
.SS "Protected Member Functions"
110
.RI "QMatrix \fBlabelMatrix\fP (const QPoint &, const QSize &) const "
113
.RI "virtual void \fBdrawTick\fP (QPainter *p, double val, int len) const "
116
.RI "virtual void \fBdrawBackbone\fP (QPainter *p) const "
119
.RI "virtual void \fBdrawLabel\fP (QPainter *p, double val) const "
122
.SH "Member Enumeration Documentation"
124
.SS "enum \fBQwtScaleDraw::Alignment\fP"
126
Alignment of the scale draw
130
\fBsetAlignment()\fP, \fBalignment()\fP
135
Definition at line 37 of file qwt_scale_draw.h.
136
.SH "Constructor & Destructor Documentation"
138
.SS "QwtScaleDraw::QwtScaleDraw ()"
142
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.
144
Definition at line 60 of file qwt_scale_draw.cpp.
146
References setLength().
147
.SS "QwtScaleDraw::QwtScaleDraw (const \fBQwtScaleDraw\fP &)"
151
Definition at line 67 of file qwt_scale_draw.cpp.
154
.SS "QwtScaleDraw::~QwtScaleDraw ()\fC [virtual]\fP"
158
Definition at line 74 of file qwt_scale_draw.cpp.
159
.SH "Member Function Documentation"
161
.SS "\fBQwtScaleDraw::Alignment\fP QwtScaleDraw::alignment () const"
163
Return alignment of the scale
172
Definition at line 91 of file qwt_scale_draw.cpp.
174
Referenced by QwtScaleWidget::alignment(), drawBackbone(), labelMatrix(), and labelPosition().
175
.SS "void QwtScaleDraw::drawBackbone (QPainter * painter) const\fC [protected, virtual]\fP"
177
Draws the baseline of the scale
181
\fIpainter\fP Painter
186
\fBdrawTick()\fP, \fBdrawLabel()\fP
191
Implements \fBQwtAbstractScaleDraw\fP.
193
Definition at line 507 of file qwt_scale_draw.cpp.
195
References alignment(), QwtPainter::drawLine(), and pos().
196
.SS "void QwtScaleDraw::drawLabel (QPainter * painter, double value) const\fC [protected, virtual]\fP"
198
Draws the label for a major scale tick
202
\fIpainter\fP Painter
209
\fBdrawTick\fP, \fBdrawBackbone\fP
214
Implements \fBQwtAbstractScaleDraw\fP.
216
Definition at line 612 of file qwt_scale_draw.cpp.
218
References QwtText::draw(), QwtText::isEmpty(), labelMatrix(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel().
219
.SS "void QwtScaleDraw::drawTick (QPainter * painter, double value, int len) const\fC [protected, virtual]\fP"
225
\fIpainter\fP Painter
227
\fIvalue\fP Value of the tick
229
\fIlen\fP Lenght of the tick
234
\fBdrawBackbone()\fP, \fBdrawLabel()\fP
239
Implements \fBQwtAbstractScaleDraw\fP.
241
Definition at line 406 of file qwt_scale_draw.cpp.
243
References QwtMetricsMap::isIdentity(), QwtMetricsMap::layoutToDevice(), QwtMetricsMap::layoutToDeviceX(), QwtMetricsMap::layoutToDeviceY(), QwtAbstractScaleDraw::map(), QwtPainter::metricsMap(), orientation(), pos(), QwtPainter::resetMetricsMap(), and QwtAbstractScaleDraw::scaleMap().
244
.SS "int QwtScaleDraw::extent (const QPen & pen, const QFont & font) const\fC [virtual]\fP"
246
Calculate the width/height that is needed for a vertical/horizontal scale.
248
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.
252
\fIpen\fP Pen that is used for painting backbone and ticks
254
\fIfont\fP Font used for painting the labels
264
Implements \fBQwtAbstractScaleDraw\fP.
266
Definition at line 280 of file qwt_scale_draw.cpp.
268
References QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), maxLabelHeight(), maxLabelWidth(), QwtAbstractScaleDraw::minimumExtent(), orientation(), and QwtAbstractScaleDraw::spacing().
270
Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint().
271
.SS "void QwtScaleDraw::getBorderDistHint (const QFont & font, int & start, int & end) const"
273
Determine the minimum border distance.
275
This member function returns the minimum space needed to draw the mark labels at the scale's endpoints.
281
\fIstart\fP Start border distance
283
\fIend\fP End border distance
288
Definition at line 139 of file qwt_scale_draw.cpp.
290
References QwtAbstractScaleDraw::hasComponent(), labelRect(), QwtAbstractScaleDraw::map(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
292
Referenced by QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), QwtSlider::minimumSizeHint(), and minLength().
293
.SS "Qt::Alignment QwtScaleDraw::labelAlignment () const"
302
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP
307
Definition at line 834 of file qwt_scale_draw.cpp.
309
Referenced by labelMatrix().
310
.SS "QMatrix QwtScaleDraw::labelMatrix (const QPoint & pos, const QSize & size) const\fC [protected]\fP"
312
Calculate the matrix that is needed to paint a label depending on its alignment and rotation.
316
\fIpos\fP Position where to paint the label
318
\fIsize\fP Size of the label
323
\fBsetLabelAlignment()\fP, \fBsetLabelRotation()\fP
328
Definition at line 646 of file qwt_scale_draw.cpp.
330
References alignment(), labelAlignment(), and labelRotation().
332
Referenced by drawLabel().
333
.SS "QPoint QwtScaleDraw::labelPosition (double value) const"
335
Find the position, where to paint a label
337
The position has a distance of \fBmajTickLength()\fP + \fBspacing()\fP + 1 from the backbone. The direction depends on the \fBalignment()\fP
346
Definition at line 356 of file qwt_scale_draw.cpp.
348
References alignment(), QwtAbstractScaleDraw::hasComponent(), QwtAbstractScaleDraw::majTickLength(), QwtAbstractScaleDraw::map(), QwtAbstractScaleDraw::spacing(), and QwtScaleMap::transform().
350
Referenced by drawLabel(), and labelRect().
351
.SS "QRect QwtScaleDraw::labelRect (const QFont & font, double value) const"
353
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.
357
\fIfont\fP Font used for painting
364
Definition at line 717 of file qwt_scale_draw.cpp.
366
References QwtText::isEmpty(), labelPosition(), labelSize(), pos(), QwtText::textSize(), and QwtAbstractScaleDraw::tickLabel().
368
Referenced by getBorderDistHint(), labelSize(), and minLabelDist().
369
.SS "double QwtScaleDraw::labelRotation () const"
378
\fBsetLabelRotation()\fP, \fBlabelAlignment()\fP
383
Definition at line 788 of file qwt_scale_draw.cpp.
385
Referenced by labelMatrix().
386
.SS "QSize QwtScaleDraw::labelSize (const QFont & font, double value) const"
388
Calculate the size that is needed to draw a label
392
\fIfont\fP Label font
399
Definition at line 761 of file qwt_scale_draw.cpp.
401
References labelRect().
403
Referenced by drawLabel(), labelRect(), maxLabelHeight(), and maxLabelWidth().
404
.SS "int QwtScaleDraw::length () const"
408
the length of the backbone
413
\fBsetLength()\fP, \fBpos()\fP
418
Definition at line 599 of file qwt_scale_draw.cpp.
419
.SS "int QwtScaleDraw::maxLabelHeight (const QFont & font) const"
428
the maximum height of a label
433
Definition at line 867 of file qwt_scale_draw.cpp.
435
References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
437
Referenced by extent().
438
.SS "int QwtScaleDraw::maxLabelWidth (const QFont & font) const"
447
the maximum width of a label
452
Definition at line 844 of file qwt_scale_draw.cpp.
454
References labelSize(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
456
Referenced by extent().
457
.SS "int QwtScaleDraw::minLabelDist (const QFont & font) const"
459
Determine the minimum distance between two labels, that is necessary that the texts don't overlap.
468
The maximum width of a label
473
\fBgetBorderDistHint()\fP
478
Definition at line 192 of file qwt_scale_draw.cpp.
480
References QwtAbstractScaleDraw::hasComponent(), labelRect(), orientation(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
482
Referenced by minLength().
483
.SS "int QwtScaleDraw::minLength (const QPen & pen, const QFont & font) const"
485
Calculate the minimum length that is needed to draw the scale
489
\fIpen\fP Pen that is used for painting backbone and ticks
491
\fIfont\fP Font used for painting the labels
501
Definition at line 318 of file qwt_scale_draw.cpp.
503
References getBorderDistHint(), QwtAbstractScaleDraw::hasComponent(), minLabelDist(), QwtAbstractScaleDraw::scaleDiv(), and QwtScaleDiv::ticks().
505
Referenced by QwtThermo::minimumSizeHint(), and QwtSlider::minimumSizeHint().
506
.SS "void QwtScaleDraw::move (const QPoint & pos)"
508
Move the position of the scale.
510
The meaning of the parameter pos depends on the alignment:
511
.IP "\fBQwtScaleDraw::LeftScale \fP" 1c
512
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.
513
.IP "\fBQwtScaleDraw::RightScale \fP" 1c
514
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.
515
.IP "\fBQwtScaleDraw::TopScale \fP" 1c
516
The origin is the leftmost point of the backbone. The backbone is a horizontal line. Scale marks and labels are drawn above the backbone.
517
.IP "\fBQwtScaleDraw::BottomScale \fP" 1c
518
The origin is the leftmost point of the backbone. The backbone is a horizontal line Scale marks and labels are drawn below the backbone.
523
\fIpos\fP Origin of the scale
528
\fBpos()\fP, \fBsetLength()\fP
533
Definition at line 566 of file qwt_scale_draw.cpp.
534
.SS "\fBQwtScaleDraw\fP & QwtScaleDraw::operator= (const \fBQwtScaleDraw\fP & other)"
538
Definition at line 80 of file qwt_scale_draw.cpp.
541
.SS "Qt::Orientation QwtScaleDraw::orientation () const"
543
Return the orientation
545
TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales.
554
Definition at line 115 of file qwt_scale_draw.cpp.
556
Referenced by QwtScaleWidget::drawColorBar(), drawTick(), extent(), getBorderDistHint(), minLabelDist(), and QwtPlot::printScale().
557
.SS "QPoint QwtScaleDraw::pos () const"
566
\fBmove()\fP, \fBlength()\fP
571
Definition at line 576 of file qwt_scale_draw.cpp.
573
Referenced by drawBackbone(), drawLabel(), drawTick(), and labelRect().
574
.SS "void QwtScaleDraw::setAlignment (\fBAlignment\fP align)"
576
Set the alignment of the scale
578
The default alignment is QwtScaleDraw::BottomScale
587
Definition at line 102 of file qwt_scale_draw.cpp.
589
Referenced by QwtThermo::layoutThermo(), and QwtScaleWidget::setScaleDraw().
590
.SS "void QwtScaleDraw::setLabelAlignment (Qt::Alignment alignment)"
592
Change the label flags.
594
Labels are aligned to the point ticklength + spacing away from the backbone.
596
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:
598
QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop
600
QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom
602
QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter
604
QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter
607
Changing the alignment is often necessary for rotated labels.
611
\fIalignment\fP Or'd Qt::AlignmentFlags <see qnamespace.h>
616
\fBsetLabelRotation()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP
621
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.
626
Definition at line 821 of file qwt_scale_draw.cpp.
627
.SS "void QwtScaleDraw::setLabelRotation (double rotation)"
631
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.
635
\fIrotation\fP Angle in degrees. When changing the label rotation, the label flags often needs to be adjusted too.
640
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP.
645
Definition at line 779 of file qwt_scale_draw.cpp.
646
.SS "void QwtScaleDraw::setLength (int length)"
648
Set the length of the backbone.
650
The length doesn't include the space needed for overlapping labels.
654
\fBmove()\fP, \fBminLabelDist()\fP
659
Definition at line 589 of file qwt_scale_draw.cpp.
661
Referenced by QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), and QwtScaleDraw().
665
Generated automatically by Doxygen for Qwt User's Guide from the source code.