.TH "QwtScaleDraw" 3 "Mon Aug 1 2011" "Version 5.2.2" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtScaleDraw \- .PP A class for drawing scales. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtAbstractScaleDraw\fP. .SS "Public Types" .in +1c .ti -1c .RI "enum \fBAlignment\fP { \fBBottomScale\fP, \fBTopScale\fP, \fBLeftScale\fP, \fBRightScale\fP }" .br .ti -1c .RI "enum \fBScaleComponent\fP { \fBBackbone\fP = 1, \fBTicks\fP = 2, \fBLabels\fP = 4 }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBAlignment\fP \fBalignment\fP () const " .br .ti -1c .RI "QRect \fBboundingLabelRect\fP (const QFont &, double val) const " .br .ti -1c .RI "virtual void \fBdraw\fP (QPainter *, const QPalette &) const " .br .ti -1c .RI "void \fBenableComponent\fP (\fBScaleComponent\fP, bool enable=true)" .br .ti -1c .RI "virtual int \fBextent\fP (const QPen &, const QFont &) const " .br .ti -1c .RI "void \fBgetBorderDistHint\fP (const QFont &, int &start, int &end) const " .br .ti -1c .RI "bool \fBhasComponent\fP (\fBScaleComponent\fP) const " .br .ti -1c .RI "virtual \fBQwtText\fP \fBlabel\fP (double) const " .br .ti -1c .RI "Qt::Alignment \fBlabelAlignment\fP () const " .br .ti -1c .RI "QPoint \fBlabelPosition\fP (double val) const " .br .ti -1c .RI "QRect \fBlabelRect\fP (const QFont &, double val) const " .br .ti -1c .RI "double \fBlabelRotation\fP () const " .br .ti -1c .RI "QSize \fBlabelSize\fP (const QFont &, double val) const " .br .ti -1c .RI "int \fBlength\fP () const " .br .ti -1c .RI "int \fBmajTickLength\fP () const " .br .ti -1c .RI "const \fBQwtScaleMap\fP & \fBmap\fP () const " .br .ti -1c .RI "int \fBmaxLabelHeight\fP (const QFont &) const " .br .ti -1c .RI "int \fBmaxLabelWidth\fP (const QFont &) const " .br .ti -1c .RI "int \fBminimumExtent\fP () const " .br .ti -1c .RI "int \fBminLabelDist\fP (const QFont &) const " .br .ti -1c .RI "int \fBminLength\fP (const QPen &, const QFont &) const " .br .ti -1c .RI "void \fBmove\fP (int x, int y)" .br .ti -1c .RI "void \fBmove\fP (const QPoint &)" .br .ti -1c .RI "\fBQwtScaleDraw\fP & \fBoperator=\fP (const \fBQwtScaleDraw\fP &other)" .br .ti -1c .RI "Qt::Orientation \fBorientation\fP () const " .br .ti -1c .RI "QPoint \fBpos\fP () const " .br .ti -1c .RI "\fBQwtScaleDraw\fP (const \fBQwtScaleDraw\fP &)" .br .ti -1c .RI "\fBQwtScaleDraw\fP ()" .br .ti -1c .RI "const \fBQwtScaleDiv\fP & \fBscaleDiv\fP () const " .br .ti -1c .RI "\fBQwtScaleMap\fP & \fBscaleMap\fP ()" .br .ti -1c .RI "void \fBsetAlignment\fP (\fBAlignment\fP)" .br .ti -1c .RI "void \fBsetLabelAlignment\fP (Qt::Alignment)" .br .ti -1c .RI "void \fBsetLabelRotation\fP (double rotation)" .br .ti -1c .RI "void \fBsetLength\fP (int length)" .br .ti -1c .RI "void \fBsetMinimumExtent\fP (int)" .br .ti -1c .RI "void \fBsetScaleDiv\fP (const \fBQwtScaleDiv\fP &s)" .br .ti -1c .RI "void \fBsetSpacing\fP (int margin)" .br .ti -1c .RI "void \fBsetTickLength\fP (\fBQwtScaleDiv::TickType\fP, int length)" .br .ti -1c .RI "void \fBsetTransformation\fP (\fBQwtScaleTransformation\fP *)" .br .ti -1c .RI "int \fBspacing\fP () const " .br .ti -1c .RI "int \fBtickLength\fP (\fBQwtScaleDiv::TickType\fP) const " .br .ti -1c .RI "virtual \fB~QwtScaleDraw\fP ()" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual void \fBdrawBackbone\fP (QPainter *p) const " .br .ti -1c .RI "virtual void \fBdrawLabel\fP (QPainter *p, double val) const " .br .ti -1c .RI "virtual void \fBdrawTick\fP (QPainter *p, double val, int len) const " .br .ti -1c .RI "void \fBinvalidateCache\fP ()" .br .ti -1c .RI "QMatrix \fBlabelMatrix\fP (const QPoint &, const QSize &) const " .br .ti -1c .RI "const \fBQwtText\fP & \fBtickLabel\fP (const QFont &, double value) const " .br .in -1c .SH "Detailed Description" .PP A class for drawing scales. \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. .PP 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. .SH "Member Enumeration Documentation" .PP .SS "enum \fBQwtScaleDraw::Alignment\fP"Alignment of the scale draw .PP \fBSee also:\fP .RS 4 \fBsetAlignment()\fP, \fBalignment()\fP .RE .PP .SS "enum \fBQwtAbstractScaleDraw::ScaleComponent\fP\fC [inherited]\fP"Components of a scale .PP .IP "\(bu" 2 Backbone .IP "\(bu" 2 Ticks .IP "\(bu" 2 Labels .PP .PP \fBSee also:\fP .RS 4 \fBenableComponent()\fP, \fBhasComponent\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "QwtScaleDraw::QwtScaleDraw ()" .PP Constructor. 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. .SS "QwtScaleDraw::QwtScaleDraw (const \fBQwtScaleDraw\fP &other)" .PP Copy constructor. .SS "QwtScaleDraw::~QwtScaleDraw ()\fC [virtual]\fP" .PP Destructor. .SH "Member Function Documentation" .PP .SS "\fBQwtScaleDraw::Alignment\fP QwtScaleDraw::alignment () const"Return alignment of the scale .PP \fBSee also:\fP .RS 4 \fBsetAlignment()\fP .RE .PP .SS "QRect QwtScaleDraw::boundingLabelRect (const QFont &font, doublevalue) const"Find the bounding rect for the label. The coordinates of the rect are absolute coordinates ( calculated from \fBpos()\fP ). in direction of the tick. .PP \fBParameters:\fP .RS 4 \fIfont\fP Font used for painting .br \fIvalue\fP Value .RE .PP \fBSee also:\fP .RS 4 \fBlabelRect()\fP .RE .PP .SS "void QwtAbstractScaleDraw::draw (QPainter *painter, const QPalette &palette) const\fC [virtual, inherited]\fP" .PP Draw the scale. \fBParameters:\fP .RS 4 \fIpainter\fP The painter .br \fIpalette\fP Palette, text color is used for the labels, foreground color for ticks and backbone .RE .PP .SS "void QwtScaleDraw::drawBackbone (QPainter *painter) const\fC [protected, virtual]\fP"Draws the baseline of the scale .PP \fBParameters:\fP .RS 4 \fIpainter\fP Painter .RE .PP \fBSee also:\fP .RS 4 \fBdrawTick()\fP, \fBdrawLabel()\fP .RE .PP .PP Implements \fBQwtAbstractScaleDraw\fP. .SS "void QwtScaleDraw::drawLabel (QPainter *painter, doublevalue) const\fC [protected, virtual]\fP"Draws the label for a major scale tick .PP \fBParameters:\fP .RS 4 \fIpainter\fP Painter .br \fIvalue\fP Value .RE .PP \fBSee also:\fP .RS 4 \fBdrawTick()\fP, \fBdrawBackbone()\fP, \fBboundingLabelRect()\fP .RE .PP .PP Implements \fBQwtAbstractScaleDraw\fP. .SS "void QwtScaleDraw::drawTick (QPainter *painter, doublevalue, intlen) const\fC [protected, virtual]\fP"Draw a tick .PP \fBParameters:\fP .RS 4 \fIpainter\fP Painter .br \fIvalue\fP Value of the tick .br \fIlen\fP Length of the tick .RE .PP \fBSee also:\fP .RS 4 \fBdrawBackbone()\fP, \fBdrawLabel()\fP .RE .PP .PP Implements \fBQwtAbstractScaleDraw\fP. .SS "void QwtAbstractScaleDraw::enableComponent (\fBScaleComponent\fPcomponent, boolenable = \fCtrue\fP)\fC [inherited]\fP"En/Disable a component of the scale .PP \fBParameters:\fP .RS 4 \fIcomponent\fP Scale component .br \fIenable\fP On/Off .RE .PP \fBSee also:\fP .RS 4 \fBhasComponent()\fP .RE .PP .SS "int QwtScaleDraw::extent (const QPen &pen, const QFont &font) const\fC [virtual]\fP"Calculate the width/height that is needed for a vertical/horizontal scale. .PP 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. .PP \fBParameters:\fP .RS 4 \fIpen\fP Pen that is used for painting backbone and ticks .br \fIfont\fP Font used for painting the labels .RE .PP \fBSee also:\fP .RS 4 \fBminLength()\fP .RE .PP .PP Implements \fBQwtAbstractScaleDraw\fP. .SS "void QwtScaleDraw::getBorderDistHint (const QFont &font, int &start, int &end) const" .PP Determine the minimum border distance. This member function returns the minimum space needed to draw the mark labels at the scale's endpoints. .PP \fBParameters:\fP .RS 4 \fIfont\fP Font .br \fIstart\fP Start border distance .br \fIend\fP End border distance .RE .PP .SS "bool QwtAbstractScaleDraw::hasComponent (\fBScaleComponent\fPcomponent) const\fC [inherited]\fP"Check if a component is enabled .PP \fBSee also:\fP .RS 4 \fBenableComponent()\fP .RE .PP .SS "void QwtAbstractScaleDraw::invalidateCache ()\fC [protected, inherited]\fP"Invalidate the cache used by \fBQwtAbstractScaleDraw::tickLabel\fP .PP 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. .SS "\fBQwtText\fP QwtAbstractScaleDraw::label (doublevalue) const\fC [virtual, inherited]\fP" .PP Convert a value into its representing label. The value is converted to a plain text using QLocale::system().toString(value). This method is often overloaded by applications to have individual labels. .PP \fBParameters:\fP .RS 4 \fIvalue\fP Value .RE .PP \fBReturns:\fP .RS 4 Label string. .RE .PP .PP Reimplemented in \fBQwtDialScaleDraw\fP. .SS "Qt::Alignment QwtScaleDraw::labelAlignment () const"\fBReturns:\fP .RS 4 the label flags .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelAlignment()\fP, \fBlabelRotation()\fP .RE .PP .SS "QMatrix QwtScaleDraw::labelMatrix (const QPoint &pos, const QSize &size) const\fC [protected]\fP"Calculate the matrix that is needed to paint a label depending on its alignment and rotation. .PP \fBParameters:\fP .RS 4 \fIpos\fP Position where to paint the label .br \fIsize\fP Size of the label .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelAlignment()\fP, \fBsetLabelRotation()\fP .RE .PP .SS "QPoint QwtScaleDraw::labelPosition (doublevalue) const"Find the position, where to paint a label .PP The position has a distance of \fBmajTickLength()\fP + \fBspacing()\fP + 1 from the backbone. The direction depends on the \fBalignment()\fP .PP \fBParameters:\fP .RS 4 \fIvalue\fP Value .RE .PP .SS "QRect QwtScaleDraw::labelRect (const QFont &font, doublevalue) const"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. .PP \fBParameters:\fP .RS 4 \fIfont\fP Font used for painting .br \fIvalue\fP Value .RE .PP .SS "double QwtScaleDraw::labelRotation () const"\fBReturns:\fP .RS 4 the label rotation .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelRotation()\fP, \fBlabelAlignment()\fP .RE .PP .SS "QSize QwtScaleDraw::labelSize (const QFont &font, doublevalue) const"Calculate the size that is needed to draw a label .PP \fBParameters:\fP .RS 4 \fIfont\fP Label font .br \fIvalue\fP Value .RE .PP .SS "int QwtScaleDraw::length () const"\fBReturns:\fP .RS 4 the length of the backbone .RE .PP \fBSee also:\fP .RS 4 \fBsetLength()\fP, \fBpos()\fP .RE .PP .SS "int QwtAbstractScaleDraw::majTickLength () const\fC [inherited]\fP"The same as QwtAbstractScaleDraw::tickLength(QwtScaleDiv::MajorTick). .SS "const \fBQwtScaleMap\fP & QwtAbstractScaleDraw::map () const\fC [inherited]\fP"\fBReturns:\fP .RS 4 Map how to translate between scale and pixel values .RE .PP .SS "int QwtScaleDraw::maxLabelHeight (const QFont &font) const"\fBParameters:\fP .RS 4 \fIfont\fP Font .RE .PP \fBReturns:\fP .RS 4 the maximum height of a label .RE .PP .SS "int QwtScaleDraw::maxLabelWidth (const QFont &font) const"\fBParameters:\fP .RS 4 \fIfont\fP Font .RE .PP \fBReturns:\fP .RS 4 the maximum width of a label .RE .PP .SS "int QwtAbstractScaleDraw::minimumExtent () const\fC [inherited]\fP"Get the minimum extent .PP \fBSee also:\fP .RS 4 \fBextent()\fP, \fBsetMinimumExtent()\fP .RE .PP .SS "int QwtScaleDraw::minLabelDist (const QFont &font) const"Determine the minimum distance between two labels, that is necessary that the texts don't overlap. .PP \fBParameters:\fP .RS 4 \fIfont\fP Font .RE .PP \fBReturns:\fP .RS 4 The maximum width of a label .RE .PP \fBSee also:\fP .RS 4 \fBgetBorderDistHint()\fP .RE .PP .SS "int QwtScaleDraw::minLength (const QPen &pen, const QFont &font) const"Calculate the minimum length that is needed to draw the scale .PP \fBParameters:\fP .RS 4 \fIpen\fP Pen that is used for painting backbone and ticks .br \fIfont\fP Font used for painting the labels .RE .PP \fBSee also:\fP .RS 4 \fBextent()\fP .RE .PP .SS "void QwtScaleDraw::move (intx, inty)\fC [inline]\fP"Move the position of the scale .PP \fBSee also:\fP .RS 4 \fBmove(const QPoint &)\fP .RE .PP .SS "void QwtScaleDraw::move (const QPoint &pos)" .PP Move the position of the scale. The meaning of the parameter pos depends on the alignment: .IP "\fBQwtScaleDraw::LeftScale \fP" 1c 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. .IP "\fBQwtScaleDraw::RightScale \fP" 1c 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. .IP "\fBQwtScaleDraw::TopScale \fP" 1c The origin is the leftmost point of the backbone. The backbone is a horizontal line. Scale marks and labels are drawn above the backbone. .IP "\fBQwtScaleDraw::BottomScale \fP" 1c The origin is the leftmost point of the backbone. The backbone is a horizontal line Scale marks and labels are drawn below the backbone. .PP .PP \fBParameters:\fP .RS 4 \fIpos\fP Origin of the scale .RE .PP \fBSee also:\fP .RS 4 \fBpos()\fP, \fBsetLength()\fP .RE .PP .SS "\fBQwtScaleDraw\fP & QwtScaleDraw::operator= (const \fBQwtScaleDraw\fP &other)" .PP Assignment operator. .SS "Qt::Orientation QwtScaleDraw::orientation () const"Return the orientation .PP TopScale, BottomScale are horizontal (Qt::Horizontal) scales, LeftScale, RightScale are vertical (Qt::Vertical) scales. .PP \fBSee also:\fP .RS 4 \fBalignment()\fP .RE .PP .SS "QPoint QwtScaleDraw::pos () const"\fBReturns:\fP .RS 4 Origin of the scale .RE .PP \fBSee also:\fP .RS 4 \fBmove()\fP, \fBlength()\fP .RE .PP .SS "const \fBQwtScaleDiv\fP & QwtAbstractScaleDraw::scaleDiv () const\fC [inherited]\fP"\fBReturns:\fP .RS 4 scale division .RE .PP .SS "\fBQwtScaleMap\fP & QwtAbstractScaleDraw::scaleMap ()\fC [inherited]\fP"\fBReturns:\fP .RS 4 Map how to translate between scale and pixel values .RE .PP .SS "void QwtScaleDraw::setAlignment (\fBAlignment\fPalign)"Set the alignment of the scale .PP The default alignment is QwtScaleDraw::BottomScale .PP \fBSee also:\fP .RS 4 \fBalignment()\fP .RE .PP .SS "void QwtScaleDraw::setLabelAlignment (Qt::Alignmentalignment)" .PP Change the label flags. Labels are aligned to the point ticklength + spacing away from the backbone. .PP 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: .PP QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop .br QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom .br QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter .br QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter .br .PP Changing the alignment is often necessary for rotated labels. .PP \fBParameters:\fP .RS 4 \fIalignment\fP Or'd Qt::AlignmentFlags .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelRotation()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP .RE .PP \fBWarning:\fP .RS 4 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. .RE .PP .SS "void QwtScaleDraw::setLabelRotation (doublerotation)"Rotate all labels. .PP 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. .PP \fBParameters:\fP .RS 4 \fIrotation\fP Angle in degrees. When changing the label rotation, the label flags often needs to be adjusted too. .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelAlignment()\fP, \fBlabelRotation()\fP, \fBlabelAlignment()\fP. .RE .PP .SS "void QwtScaleDraw::setLength (intlength)"Set the length of the backbone. .PP The length doesn't include the space needed for overlapping labels. .PP \fBSee also:\fP .RS 4 \fBmove()\fP, \fBminLabelDist()\fP .RE .PP .SS "void QwtAbstractScaleDraw::setMinimumExtent (intminExtent)\fC [inherited]\fP" .PP Set a minimum for the extent. 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. .PP \fBParameters:\fP .RS 4 \fIminExtent\fP Minimum extent .RE .PP \fBSee also:\fP .RS 4 \fBextent()\fP, \fBminimumExtent()\fP .RE .PP .SS "void QwtAbstractScaleDraw::setScaleDiv (const \fBQwtScaleDiv\fP &sd)\fC [inherited]\fP"Change the scale division .PP \fBParameters:\fP .RS 4 \fIsd\fP New scale division .RE .PP .SS "void QwtAbstractScaleDraw::setSpacing (intspacing)\fC [inherited]\fP" .PP Set the spacing between tick and labels. The spacing is the distance between ticks and labels. The default spacing is 4 pixels. .PP \fBParameters:\fP .RS 4 \fIspacing\fP Spacing .RE .PP \fBSee also:\fP .RS 4 \fBspacing()\fP .RE .PP .SS "void QwtAbstractScaleDraw::setTickLength (\fBQwtScaleDiv::TickType\fPtickType, intlength)\fC [inherited]\fP"Set the length of the ticks .PP \fBParameters:\fP .RS 4 \fItickType\fP Tick type .br \fIlength\fP New length .RE .PP \fBWarning:\fP .RS 4 the length is limited to [0..1000] .RE .PP .SS "void QwtAbstractScaleDraw::setTransformation (\fBQwtScaleTransformation\fP *transformation)\fC [inherited]\fP"Change the transformation of the scale .PP \fBParameters:\fP .RS 4 \fItransformation\fP New scale transformation .RE .PP .SS "int QwtAbstractScaleDraw::spacing () const\fC [inherited]\fP" .PP Get the spacing. The spacing is the distance between ticks and labels. The default spacing is 4 pixels. .PP \fBSee also:\fP .RS 4 \fBsetSpacing()\fP .RE .PP .SS "const \fBQwtText\fP & QwtAbstractScaleDraw::tickLabel (const QFont &font, doublevalue) const\fC [protected, inherited]\fP" .PP Convert a value into its representing label and cache it. 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. .PP \fBParameters:\fP .RS 4 \fIfont\fP Font .br \fIvalue\fP Value .RE .PP \fBReturns:\fP .RS 4 Tick label .RE .PP .SS "int QwtAbstractScaleDraw::tickLength (\fBQwtScaleDiv::TickType\fPtickType) const\fC [inherited]\fP"Return the length of the ticks .PP \fBSee also:\fP .RS 4 \fBsetTickLength()\fP, \fBmajTickLength()\fP .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code.