.TH "QwtScaleDraw" 3 "Wed Jan 2 2019" "Version 6.1.4" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtScaleDraw \- A class for drawing scales\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtAbstractScaleDraw\fP\&. .PP Inherited by \fBQwtDateScaleDraw\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 .RI "Constructor\&. " .ti -1c .RI "virtual \fB~QwtScaleDraw\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "void \fBgetBorderDistHint\fP (const QFont &, int &start, int &end) const" .br .RI "Determine the minimum border distance\&. " .ti -1c .RI "int \fBminLabelDist\fP (const QFont &) const" .br .ti -1c .RI "int \fBminLength\fP (const QFont &) const" .br .ti -1c .RI "virtual double \fBextent\fP (const QFont &) const" .br .ti -1c .RI "void \fBmove\fP (double x, double y)" .br .ti -1c .RI "void \fBmove\fP (const QPointF &)" .br .RI "Move the position of the scale\&. " .ti -1c .RI "void \fBsetLength\fP (double \fBlength\fP)" .br .ti -1c .RI "\fBAlignment\fP \fBalignment\fP () const" .br .ti -1c .RI "void \fBsetAlignment\fP (\fBAlignment\fP)" .br .ti -1c .RI "Qt::Orientation \fBorientation\fP () const" .br .ti -1c .RI "QPointF \fBpos\fP () const" .br .ti -1c .RI "double \fBlength\fP () const" .br .ti -1c .RI "void \fBsetLabelAlignment\fP (Qt::Alignment)" .br .RI "Change the label flags\&. " .ti -1c .RI "Qt::Alignment \fBlabelAlignment\fP () const" .br .ti -1c .RI "void \fBsetLabelRotation\fP (double rotation)" .br .ti -1c .RI "double \fBlabelRotation\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 "QPointF \fBlabelPosition\fP (double value) const" .br .ti -1c .RI "QRectF \fBlabelRect\fP (const QFont &, double value) const" .br .ti -1c .RI "QSizeF \fBlabelSize\fP (const QFont &, double value) const" .br .ti -1c .RI "QRect \fBboundingLabelRect\fP (const QFont &, double value) const" .br .RI "Find the bounding rectangle for the label\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "QTransform \fBlabelTransformation\fP (const QPointF &, const QSizeF &) const" .br .ti -1c .RI "virtual void \fBdrawTick\fP (QPainter *, double value, double len) const" .br .ti -1c .RI "virtual void \fBdrawBackbone\fP (QPainter *) const" .br .ti -1c .RI "virtual void \fBdrawLabel\fP (QPainter *, 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 .PP \fBEnumerator\fP .in +1c .TP \fB\fIBottomScale \fP\fP The scale is below\&. .TP \fB\fITopScale \fP\fP The scale is above\&. .TP \fB\fILeftScale \fP\fP The scale is left\&. .TP \fB\fIRightScale \fP\fP The scale is right\&. .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 \fBReturns:\fP .RS 4 Alignment of the scale .RE .PP .SS "QRect QwtScaleDraw::boundingLabelRect (const QFont & font, double value) const" .PP Find the bounding rectangle for the label\&. The coordinates of the rectangle are absolute ( 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 \fBReturns:\fP .RS 4 Bounding rectangle .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, double value) 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, double value, double len) 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 "double QwtScaleDraw::extent (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 \fIfont\fP Font used for painting the labels .RE .PP \fBReturns:\fP .RS 4 Extent .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" .PP \fBReturns:\fP .RS 4 the label flags .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelAlignment()\fP, \fBlabelRotation()\fP .RE .PP .SS "QPointF QwtScaleDraw::labelPosition (double value) const" Find the position, where to paint a label .PP The position has a distance that depends on the length of the ticks in direction of the \fBalignment()\fP\&. .PP \fBParameters:\fP .RS 4 \fIvalue\fP Value .RE .PP \fBReturns:\fP .RS 4 Position, where to paint a label .RE .PP .SS "QRectF QwtScaleDraw::labelRect (const QFont & font, double value) const" Find the bounding rectangle for the label\&. The coordinates of the rectangle are relative to spacing + tick length 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 \fBReturns:\fP .RS 4 Bounding rectangle that is needed to draw a label .RE .PP .SS "double QwtScaleDraw::labelRotation () const" .PP \fBReturns:\fP .RS 4 the label rotation .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelRotation()\fP, \fBlabelAlignment()\fP .RE .PP .SS "QSizeF QwtScaleDraw::labelSize (const QFont & font, double value) 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 \fBReturns:\fP .RS 4 Size that is needed to draw a label .RE .PP .SS "QTransform QwtScaleDraw::labelTransformation (const QPointF & pos, const QSizeF & size) const\fC [protected]\fP" Calculate the transformation 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 \fBReturns:\fP .RS 4 Transformation matrix .RE .PP \fBSee also:\fP .RS 4 \fBsetLabelAlignment()\fP, \fBsetLabelRotation()\fP .RE .PP .SS "double QwtScaleDraw::length () const" .PP \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" .PP \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" .PP \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 QFont & font) const" Calculate the minimum length that is needed to draw the scale .PP \fBParameters:\fP .RS 4 \fIfont\fP Font used for painting the labels .RE .PP \fBReturns:\fP .RS 4 Minimum length that is needed to draw the scale .RE .PP \fBSee also:\fP .RS 4 \fBextent()\fP .RE .PP .SS "void QwtScaleDraw::move (double x, double y)\fC [inline]\fP" Move the position of the scale .PP \fBParameters:\fP .RS 4 \fIx\fP X coordinate .br \fIy\fP Y coordinate .RE .PP \fBSee also:\fP .RS 4 \fBmove(const QPointF &)\fP .RE .PP .SS "void QwtScaleDraw::move (const QPointF & pos)" .PP Move the position of the scale\&. The meaning of the parameter pos depends on the alignment: .IP "\fB\fBQwtScaleDraw::LeftScale\fP \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 "\fB\fBQwtScaleDraw::RightScale\fP \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 "\fB\fBQwtScaleDraw::TopScale\fP \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 "\fB\fBQwtScaleDraw::BottomScale\fP \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 \fBReturns:\fP .RS 4 Orientation of the scale .RE .PP \fBSee also:\fP .RS 4 \fBalignment()\fP .RE .PP .SS "QPointF QwtScaleDraw::pos () const" .PP \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\fP align)" Set the alignment of the scale .PP \fBParameters:\fP .RS 4 \fIalign\fP Alignment of the scale .RE .PP The default alignment is \fBQwtScaleDraw::BottomScale\fP .PP \fBSee also:\fP .RS 4 \fBalignment()\fP .RE .PP .SS "void QwtScaleDraw::setLabelAlignment (Qt::Alignment alignment)" .PP Change the label flags\&. Labels are aligned to the point tick length + 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 see .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 (double rotation)" 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 (double length)" Set the length of the backbone\&. .PP The length doesn't include the space needed for overlapping labels\&. .PP \fBParameters:\fP .RS 4 \fIlength\fP Length of the backbone .RE .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\&.