1
.TH "QwtScaleDraw" 3 "22 Mar 2009" "Qwt User's Guide" \" -*- nroff -*-
5
QwtScaleDraw \- A class for drawing scales.
11
\fC#include <qwt_scale_draw.h>\fP
13
Inherits \fBQwtAbstractScaleDraw\fP.
19
.RI "enum \fBAlignment\fP { \fBBottomScale\fP, \fBTopScale\fP, \fBLeftScale\fP, \fBRightScale\fP }"
21
.SS "Public Member Functions"
25
.RI "\fBQwtScaleDraw\fP ()"
28
.RI "\fBQwtScaleDraw\fP (const \fBQwtScaleDraw\fP &)"
31
.RI "virtual \fB~QwtScaleDraw\fP ()"
34
.RI "\fBQwtScaleDraw\fP & \fBoperator=\fP (const \fBQwtScaleDraw\fP &other)"
37
.RI "void \fBgetBorderDistHint\fP (const QFont &, int &start, int &end) const "
40
.RI "int \fBminLabelDist\fP (const QFont &) const "
43
.RI "int \fBminLength\fP (const QPen &, const QFont &) const "
46
.RI "virtual int \fBextent\fP (const QPen &, const QFont &) const "
49
.RI "void \fBmove\fP (int x, int y)"
52
.RI "void \fBmove\fP (const QPoint &)"
55
.RI "void \fBsetLength\fP (int length)"
58
.RI "\fBAlignment\fP \fBalignment\fP () const "
61
.RI "void \fBsetAlignment\fP (\fBAlignment\fP)"
64
.RI "Qt::Orientation \fBorientation\fP () const "
67
.RI "QPoint \fBpos\fP () const "
70
.RI "int \fBlength\fP () const "
73
.RI "void \fBsetLabelAlignment\fP (Qt::Alignment)"
76
.RI "Qt::Alignment \fBlabelAlignment\fP () const "
79
.RI "void \fBsetLabelRotation\fP (double rotation)"
82
.RI "double \fBlabelRotation\fP () const "
85
.RI "int \fBmaxLabelHeight\fP (const QFont &) const "
88
.RI "int \fBmaxLabelWidth\fP (const QFont &) const "
91
.RI "QPoint \fBlabelPosition\fP (double val) const "
94
.RI "QRect \fBlabelRect\fP (const QFont &, double val) const "
97
.RI "QSize \fBlabelSize\fP (const QFont &, double val) const "
100
.RI "QRect \fBboundingLabelRect\fP (const QFont &, double val) const "
103
.SS "Protected Member Functions"
107
.RI "QMatrix \fBlabelMatrix\fP (const QPoint &, const QSize &) const "
110
.RI "virtual void \fBdrawTick\fP (QPainter *p, double val, int len) const "
113
.RI "virtual void \fBdrawBackbone\fP (QPainter *p) const "
116
.RI "virtual void \fBdrawLabel\fP (QPainter *p, double val) const "
119
.SH "Detailed Description"
121
A class for drawing scales.
123
\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.
125
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.
126
.SH "Member Enumeration Documentation"
128
.SS "enum \fBQwtScaleDraw::Alignment\fP"
130
Alignment of the scale draw
134
\fBsetAlignment()\fP, \fBalignment()\fP
138
.SH "Constructor & Destructor Documentation"
140
.SS "QwtScaleDraw::QwtScaleDraw ()"
144
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.
145
.SS "QwtScaleDraw::QwtScaleDraw (const \fBQwtScaleDraw\fP & other)"
149
.SS "QwtScaleDraw::~QwtScaleDraw ()\fC [virtual]\fP"
153
.SH "Member Function Documentation"
155
.SS "\fBQwtScaleDraw::Alignment\fP QwtScaleDraw::alignment () const"
157
Return alignment of the scale
165
.SS "QRect QwtScaleDraw::boundingLabelRect (const QFont & font, double value) const"
167
Find the bounding rect for the label. The coordinates of the rect are absolute coordinates ( calculated from \fBpos()\fP ). in direction of the tick.
171
\fIfont\fP Font used for painting
182
.SS "void QwtScaleDraw::drawBackbone (QPainter * painter) const\fC [protected, virtual]\fP"
184
Draws the baseline of the scale
188
\fIpainter\fP Painter
193
\fBdrawTick()\fP, \fBdrawLabel()\fP
198
Implements \fBQwtAbstractScaleDraw\fP.
199
.SS "void QwtScaleDraw::drawLabel (QPainter * painter, double value) const\fC [protected, virtual]\fP"
201
Draws the label for a major scale tick
205
\fIpainter\fP Painter
212
\fBdrawTick()\fP, \fBdrawBackbone()\fP, \fBboundingLabelRect()\fP
217
Implements \fBQwtAbstractScaleDraw\fP.
218
.SS "void QwtScaleDraw::drawTick (QPainter * painter, double value, int len) const\fC [protected, virtual]\fP"
224
\fIpainter\fP Painter
226
\fIvalue\fP Value of the tick
228
\fIlen\fP Lenght of the tick
233
\fBdrawBackbone()\fP, \fBdrawLabel()\fP
238
Implements \fBQwtAbstractScaleDraw\fP.
239
.SS "int QwtScaleDraw::extent (const QPen & pen, const QFont & font) const\fC [virtual]\fP"
241
Calculate the width/height that is needed for a vertical/horizontal scale.
243
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.
247
\fIpen\fP Pen that is used for painting backbone and ticks
249
\fIfont\fP Font used for painting the labels
259
Implements \fBQwtAbstractScaleDraw\fP.
260
.SS "void QwtScaleDraw::getBorderDistHint (const QFont & font, int & start, int & end) const"
262
Determine the minimum border distance.
264
This member function returns the minimum space needed to draw the mark labels at the scale's endpoints.
270
\fIstart\fP Start border distance
272
\fIend\fP End border distance
276
.SS "Qt::Alignment QwtScaleDraw::labelAlignment () const"
285
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP
289
.SS "QMatrix QwtScaleDraw::labelMatrix (const QPoint & pos, const QSize & size) const\fC [protected]\fP"
291
Calculate the matrix that is needed to paint a label depending on its alignment and rotation.
295
\fIpos\fP Position where to paint the label
297
\fIsize\fP Size of the label
302
\fBsetLabelAlignment()\fP, \fBsetLabelRotation()\fP
306
.SS "QPoint QwtScaleDraw::labelPosition (double value) const"
308
Find the position, where to paint a label
310
The position has a distance of \fBmajTickLength()\fP + \fBspacing()\fP + 1 from the backbone. The direction depends on the \fBalignment()\fP
318
.SS "QRect QwtScaleDraw::labelRect (const QFont & font, double value) const"
320
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.
324
\fIfont\fP Font used for painting
330
.SS "double QwtScaleDraw::labelRotation () const"
339
\fBsetLabelRotation()\fP, \fBlabelAlignment()\fP
343
.SS "QSize QwtScaleDraw::labelSize (const QFont & font, double value) const"
345
Calculate the size that is needed to draw a label
349
\fIfont\fP Label font
355
.SS "int QwtScaleDraw::length () const"
359
the length of the backbone
364
\fBsetLength()\fP, \fBpos()\fP
368
.SS "int QwtScaleDraw::maxLabelHeight (const QFont & font) const"
377
the maximum height of a label
381
.SS "int QwtScaleDraw::maxLabelWidth (const QFont & font) const"
390
the maximum width of a label
394
.SS "int QwtScaleDraw::minLabelDist (const QFont & font) const"
396
Determine the minimum distance between two labels, that is necessary that the texts don't overlap.
405
The maximum width of a label
410
\fBgetBorderDistHint()\fP
414
.SS "int QwtScaleDraw::minLength (const QPen & pen, const QFont & font) const"
416
Calculate the minimum length that is needed to draw the scale
420
\fIpen\fP Pen that is used for painting backbone and ticks
422
\fIfont\fP Font used for painting the labels
431
.SS "void QwtScaleDraw::move (const QPoint & pos)"
433
Move the position of the scale.
435
The meaning of the parameter pos depends on the alignment:
436
.IP "\fBQwtScaleDraw::LeftScale \fP" 1c
437
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.
438
.IP "\fBQwtScaleDraw::RightScale \fP" 1c
439
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.
440
.IP "\fBQwtScaleDraw::TopScale \fP" 1c
441
The origin is the leftmost point of the backbone. The backbone is a horizontal line. Scale marks and labels are drawn above the backbone.
442
.IP "\fBQwtScaleDraw::BottomScale \fP" 1c
443
The origin is the leftmost point of the backbone. The backbone is a horizontal line Scale marks and labels are drawn below the backbone.
448
\fIpos\fP Origin of the scale
453
\fBpos()\fP, \fBsetLength()\fP
457
.SS "void QwtScaleDraw::move (int x, int y)\fC [inline]\fP"
459
Move the position of the scale
463
\fBmove(const QPoint &)\fP
467
.SS "\fBQwtScaleDraw\fP & QwtScaleDraw::operator= (const \fBQwtScaleDraw\fP & other)"
471
.SS "Qt::Orientation QwtScaleDraw::orientation () const"
473
Return the orientation
475
TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales.
483
.SS "QPoint QwtScaleDraw::pos () const"
492
\fBmove()\fP, \fBlength()\fP
496
.SS "void QwtScaleDraw::setAlignment (\fBAlignment\fP align)"
498
Set the alignment of the scale
500
The default alignment is QwtScaleDraw::BottomScale
508
.SS "void QwtScaleDraw::setLabelAlignment (Qt::Alignment alignment)"
510
Change the label flags.
512
Labels are aligned to the point ticklength + spacing away from the backbone.
514
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:
516
QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop
518
QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom
520
QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter
522
QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter
525
Changing the alignment is often necessary for rotated labels.
529
\fIalignment\fP Or'd Qt::AlignmentFlags <see qnamespace.h>
534
\fBsetLabelRotation()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP
539
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.
543
.SS "void QwtScaleDraw::setLabelRotation (double rotation)"
547
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.
551
\fIrotation\fP Angle in degrees. When changing the label rotation, the label flags often needs to be adjusted too.
556
\fBsetLabelAlignment()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP.
560
.SS "void QwtScaleDraw::setLength (int length)"
562
Set the length of the backbone.
564
The length doesn't include the space needed for overlapping labels.
568
\fBmove()\fP, \fBminLabelDist()\fP
575
Generated automatically by Doxygen for Qwt User's Guide from the source code.