.TH "QwtScaleDraw" 3 "Tue Nov 20 2012" "Version 5.2.3" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtScaleDraw \- .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 .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBQwtScaleDraw\fP ()" .br .ti -1c .RI "\fBQwtScaleDraw\fP (const \fBQwtScaleDraw\fP &)" .br .ti -1c .RI "virtual \fB~QwtScaleDraw\fP ()" .br .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 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 "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 \fBmaxLabelHeight\fP (const QFont &) const " .br .ti -1c .RI "int \fBmaxLabelWidth\fP (const QFont &) 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 "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 \fBlength\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 "QMatrix \fBlabelMatrix\fP (const QPoint &, const QSize &) 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 .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\&. .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 QwtScaleDraw::drawBackbone (QPainter *painter) const\fC [protected]\fP, \fC [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]\fP, \fC [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]\fP, \fC [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 "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 "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 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 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 "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 "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 .nf QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop\n QwtScaleDraw::BottomScale: Qt::AlignHCenter | Qt::AlignBottom\n QwtScaleDraw::LeftScale: Qt::AlignLeft | Qt::AlignVCenter\n QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter\n .fi .PP .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 .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code\&.