1
.TH "QwtAbstractScaleDraw" 3 "22 Mar 2009" "Qwt User's Guide" \" -*- nroff -*-
5
QwtAbstractScaleDraw \- A abstract base class for drawing scales.
11
\fC#include <qwt_abstract_scale_draw.h>\fP
13
Inherited by \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP.
19
.RI "enum \fBScaleComponent\fP { \fBBackbone\fP = 1, \fBTicks\fP = 2, \fBLabels\fP = 4 }"
21
.SS "Public Member Functions"
25
.RI "\fBQwtAbstractScaleDraw\fP ()"
28
.RI "\fBQwtAbstractScaleDraw\fP (const \fBQwtAbstractScaleDraw\fP &)"
31
.RI "virtual \fB~QwtAbstractScaleDraw\fP ()"
34
.RI "\fBQwtAbstractScaleDraw\fP & \fBoperator=\fP (const \fBQwtAbstractScaleDraw\fP &)"
37
.RI "void \fBsetScaleDiv\fP (const \fBQwtScaleDiv\fP &s)"
40
.RI "const \fBQwtScaleDiv\fP & \fBscaleDiv\fP () const "
43
.RI "void \fBsetTransformation\fP (\fBQwtScaleTransformation\fP *)"
46
.RI "const \fBQwtScaleMap\fP & \fBmap\fP () const "
49
.RI "void \fBenableComponent\fP (\fBScaleComponent\fP, bool enable=true)"
52
.RI "bool \fBhasComponent\fP (\fBScaleComponent\fP) const "
55
.RI "void \fBsetTickLength\fP (\fBQwtScaleDiv::TickType\fP, int length)"
58
.RI "int \fBtickLength\fP (\fBQwtScaleDiv::TickType\fP) const "
61
.RI "int \fBmajTickLength\fP () const "
64
.RI "void \fBsetSpacing\fP (int margin)"
67
.RI "int \fBspacing\fP () const "
70
.RI "virtual void \fBdraw\fP (QPainter *, const QPalette &) const "
73
.RI "virtual \fBQwtText\fP \fBlabel\fP (double) const "
76
.RI "virtual int \fBextent\fP (const QPen &, const QFont &) const =0"
79
.RI "void \fBsetMinimumExtent\fP (int)"
82
.RI "int \fBminimumExtent\fP () const "
85
.RI "\fBQwtScaleMap\fP & \fBscaleMap\fP ()"
88
.SS "Protected Member Functions"
92
.RI "virtual void \fBdrawTick\fP (QPainter *painter, double value, int len) const =0"
95
.RI "virtual void \fBdrawBackbone\fP (QPainter *painter) const =0"
98
.RI "virtual void \fBdrawLabel\fP (QPainter *painter, double value) const =0"
101
.RI "void \fBinvalidateCache\fP ()"
104
.RI "const \fBQwtText\fP & \fBtickLabel\fP (const QFont &, double value) const "
107
.SH "Detailed Description"
109
A abstract base class for drawing scales.
111
\fBQwtAbstractScaleDraw\fP can be used to draw linear or logarithmic scales.
113
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.
114
.SH "Member Enumeration Documentation"
116
.SS "enum \fBQwtAbstractScaleDraw::ScaleComponent\fP"
118
Components of a scale
130
\fBenableComponent()\fP, \fBhasComponent\fP
134
.SH "Constructor & Destructor Documentation"
136
.SS "QwtAbstractScaleDraw::QwtAbstractScaleDraw ()"
140
The range of the scale is initialized to [0, 100], The spacing (distance between ticks and labels) is set to 4, the tick lengths are set to 4,6 and 8 pixels
141
.SS "QwtAbstractScaleDraw::QwtAbstractScaleDraw (const \fBQwtAbstractScaleDraw\fP & other)"
145
.SS "QwtAbstractScaleDraw::~QwtAbstractScaleDraw ()\fC [virtual]\fP"
149
.SH "Member Function Documentation"
151
.SS "void QwtAbstractScaleDraw::draw (QPainter * painter, const QPalette & palette) const\fC [virtual]\fP"
157
\fIpainter\fP The painter
159
\fIpalette\fP Palette, text color is used for the labels, foreground color for ticks and backbone
163
.SS "virtual void QwtAbstractScaleDraw::drawBackbone (QPainter * painter) const\fC [protected, pure virtual]\fP"
165
Draws the baseline of the scale
169
\fIpainter\fP Painter
174
\fBdrawTick()\fP, \fBdrawLabel()\fP
179
Implemented in \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP.
180
.SS "virtual void QwtAbstractScaleDraw::drawLabel (QPainter * painter, double value) const\fC [protected, pure virtual]\fP"
182
Draws the label for a major scale tick
186
\fIpainter\fP Painter
193
\fBdrawTick\fP, \fBdrawBackbone\fP
198
Implemented in \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP.
199
.SS "virtual void QwtAbstractScaleDraw::drawTick (QPainter * painter, double value, int len) const\fC [protected, pure virtual]\fP"
205
\fIpainter\fP Painter
207
\fIvalue\fP Value of the tick
209
\fIlen\fP Lenght of the tick
214
\fBdrawBackbone()\fP, \fBdrawLabel()\fP
219
Implemented in \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP.
220
.SS "void QwtAbstractScaleDraw::enableComponent (\fBScaleComponent\fP component, bool enable = \fCtrue\fP)"
222
En/Disable a component of the scale
226
\fIcomponent\fP Scale component
237
.SS "virtual int QwtAbstractScaleDraw::extent (const QPen &, const QFont &) const\fC [pure virtual]\fP"
241
The extent is the distcance from the baseline to the outermost pixel of the scale draw in opposite to its orientation. It is at least \fBminimumExtent()\fP pixels.
245
\fBsetMinimumExtent()\fP, \fBminimumExtent()\fP
250
Implemented in \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP.
251
.SS "bool QwtAbstractScaleDraw::hasComponent (\fBScaleComponent\fP component) const"
253
Check if a component is enabled
257
\fBenableComponent()\fP
261
.SS "void QwtAbstractScaleDraw::invalidateCache ()\fC [protected]\fP"
263
Invalidate the cache used by \fBQwtAbstractScaleDraw::tickLabel\fP
265
The cache is invalidated, when a new \fBQwtScaleDiv\fP is set. If the labels need to be changed. while the same \fBQwtScaleDiv\fP is set, \fBQwtAbstractScaleDraw::invalidateCache\fP needs to be called manually.
266
.SS "\fBQwtText\fP QwtAbstractScaleDraw::label (double value) const\fC [virtual]\fP"
268
Convert a value into its representing label.
270
The value is converted to a plain text using QLocale::system().toString(value). This method is often overloaded by applications to have individual labels.
284
Reimplemented in \fBQwtDialScaleDraw\fP.
285
.SS "int QwtAbstractScaleDraw::majTickLength () const"
287
The same as QwtAbstractScaleDraw::tickLength(QwtScaleDiv::MajorTick).
288
.SS "const \fBQwtScaleMap\fP & QwtAbstractScaleDraw::map () const"
292
Map how to translate between scale and pixel values
296
.SS "int QwtAbstractScaleDraw::minimumExtent () const"
298
Get the minimum extent
302
\fBextent()\fP, \fBsetMinimumExtent()\fP
306
.SS "\fBQwtAbstractScaleDraw\fP & QwtAbstractScaleDraw::operator= (const \fBQwtAbstractScaleDraw\fP & other)"
310
.SS "const \fBQwtScaleDiv\fP & QwtAbstractScaleDraw::scaleDiv () const"
318
.SS "\fBQwtScaleMap\fP & QwtAbstractScaleDraw::scaleMap ()"
322
Map how to translate between scale and pixel values
326
.SS "void QwtAbstractScaleDraw::setMinimumExtent (int minExtent)"
328
Set a minimum for the extent.
330
The extent is calculated from the coomponents of the scale draw. In situations, where the labels are changing and the layout depends on the extent (f.e scrolling a scale), setting an upper limit as minimum extent will avoid jumps of the layout.
334
\fIminExtent\fP Minimum extent
339
\fBextent()\fP, \fBminimumExtent()\fP
343
.SS "void QwtAbstractScaleDraw::setScaleDiv (const \fBQwtScaleDiv\fP & sd)"
345
Change the scale division
349
\fIsd\fP New scale division
353
.SS "void QwtAbstractScaleDraw::setSpacing (int spacing)"
355
Set the spacing between tick and labels.
357
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
361
\fIspacing\fP Spacing
370
.SS "void QwtAbstractScaleDraw::setTickLength (\fBQwtScaleDiv::TickType\fP tickType, int length)"
372
Set the length of the ticks
376
\fItickType\fP Tick type
378
\fIlength\fP New length
383
the length is limited to [0..1000]
387
.SS "void QwtAbstractScaleDraw::setTransformation (\fBQwtScaleTransformation\fP * transformation)"
389
Change the transformation of the scale
393
\fItransformation\fP New scale transformation
397
.SS "int QwtAbstractScaleDraw::spacing () const"
401
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
409
.SS "const \fBQwtText\fP & QwtAbstractScaleDraw::tickLabel (const QFont & font, double value) const\fC [protected]\fP"
411
Convert a value into its representing label and cache it.
413
The conversion between value and label is called very often in the layout and painting code. Unfortunately the calculation of the label sizes might be slow (really slow for rich text in Qt4), so it's necessary to cache the labels.
428
.SS "int QwtAbstractScaleDraw::tickLength (\fBQwtScaleDiv::TickType\fP tickType) const"
430
Return the length of the ticks
434
\fBsetTickLength()\fP, \fBmajTickLength()\fP
441
Generated automatically by Doxygen for Qwt User's Guide from the source code.