QwtAbstractScaleDraw(3)
πΈ QwtAbstractScaleDraw(3) πΈ
Hey bestie π this page is from the Library Functions Manual, and it's all about QwtAbstractScaleDraw β the abstract-base-class blueprint for drawing scales. It's giving βI define the vibe, subclasses do the actual drawing.β β¨
π NAME π
QwtAbstractScaleDraw β a abstract base class for drawing scales.
β¨ SYNOPSIS β¨
#include <qwt_abstract_scale_draw.h>
Inherited by QwtRoundScaleDraw, and QwtScaleDraw.
π Public Types
enum ScaleComponent { Backbone = 0x01, Ticks = 0x02, Labels = 0x04 }typedef QFlags< ScaleComponent > ScaleComponents
π«Ά Public Member Functions
QwtAbstractScaleDraw ()β Constructor.virtual ~QwtAbstractScaleDraw ()β Destructor.void setScaleDiv (const QwtScaleDiv &)const QwtScaleDiv & scaleDiv () constvoid setTransformation (QwtTransform *)const QwtScaleMap & scaleMap () constQwtScaleMap & scaleMap ()void enableComponent (ScaleComponent, bool enable=true)bool hasComponent (ScaleComponent) constvoid setTickLength (QwtScaleDiv::TickType, double length)double tickLength (QwtScaleDiv::TickType) constdouble maxTickLength () constvoid setSpacing (double)β Set the spacing between tick and labels.double spacing () constβ Get the spacing.void setPenWidthF (qreal width)β Specify the width of the scale pen.qreal penWidthF () constvirtual void draw (QPainter *, const QPalette &) constβ Draw the scale.virtual QwtText label (double) constβ Convert a value into its representing label.virtual double extent (const QFont &font) const =0void setMinimumExtent (double)β Set a minimum for the extent.double minimumExtent () constvoid invalidateCache ()
π‘οΈ Protected Member Functions
virtual void drawTick (QPainter *painter, double value, double len) const =0virtual void drawBackbone (QPainter *painter) const =0virtual void drawLabel (QPainter *painter, double value) const =0const QwtText & tickLabel (const QFont &, double value) constβ Convert a value into its representing label and cache it.
π¦ Detailed Description π¦
A abstract base class for drawing scales.
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
After a scale division has been specified as a QwtScaleDiv object using setScaleDiv(), the scale can be drawn with the draw() member.
Definition at line 31 of file qwt_abstract_scale_draw.h.
π Member Typedef Documentation π
typedef QFlags<ScaleComponent > QwtAbstractScaleDraw::ScaleComponents
An ORed combination of ScaleComponent values.
Definition at line 51 of file qwt_abstract_scale_draw.h.
π Member Enumeration Documentation π
enum QwtAbstractScaleDraw::ScaleComponent
Components of a scale
See also: enableComponent(), hasComponent
Enumerator
BackboneβBackbone = the line where the ticks are located.TicksβTicks.LabelsβLabels.
Definition at line 39 of file qwt_abstract_scale_draw.h.
π Constructor & Destructor Documentation π
QwtAbstractScaleDraw::QwtAbstractScaleDraw ()
Constructor. 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
Definition at line 60 of file qwt_abstract_scale_draw.cpp.
QwtAbstractScaleDraw::~QwtAbstractScaleDraw () [virtual]
Destructor.
Definition at line 66 of file qwt_abstract_scale_draw.cpp.
π₯ Member Function Documentation π₯
void QwtAbstractScaleDraw::draw (QPainter * painter, const QPalette & palette) const [virtual]
Draw the scale.
Parameters
painterβ The painterpaletteβ Palette, text color is used for the labels, foreground color for ticks and backbone
Definition at line 169 of file qwt_abstract_scale_draw.cpp.
virtual void QwtAbstractScaleDraw::drawBackbone (QPainter * painter) const [protected], [pure virtual]
Draws the baseline of the scale
Parameters
painterβ Painter
See also: drawTick(), drawLabel()
Implemented in QwtRoundScaleDraw, and QwtScaleDraw.
virtual void QwtAbstractScaleDraw::drawLabel (QPainter * painter, double value) const [protected], [pure virtual]
Draws the label for a major scale tick
Parameters
painterβ Paintervalueβ Value
See also: drawTick(), drawBackbone()
Implemented in QwtRoundScaleDraw, and QwtScaleDraw.
virtual void QwtAbstractScaleDraw::drawTick (QPainter * painter, double value, double len) const [protected], [pure virtual]
Draw a tick
Parameters
painterβ Paintervalueβ Value of the ticklenβ Length of the tick
See also: drawBackbone(), drawLabel()
Implemented in QwtRoundScaleDraw, and QwtScaleDraw.
void QwtAbstractScaleDraw::enableComponent (ScaleComponent component, bool enable = true)
En/Disable a component of the scale
Parameters
componentβ Scale componentenableβ On/Off
See also: hasComponent()
Definition at line 79 of file qwt_abstract_scale_draw.cpp.
virtual double QwtAbstractScaleDraw::extent (const QFont & font) const [pure virtual]
Calculate the extent
The extent is the distance from the baseline to the outermost pixel of the scale draw in opposite to its orientation. It is at least minimumExtent() pixels.
Parameters
fontβ Font used for drawing the tick labels
Returns
Number of pixels
See also: setMinimumExtent(), minimumExtent()
Implemented in QwtRoundScaleDraw, and QwtScaleDraw.
bool QwtAbstractScaleDraw::hasComponent (ScaleComponent component) const
Check if a component is enabled
Parameters
componentβ Component type
Returns
true, when component is enabled
See also: enableComponent()
Definition at line 95 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::invalidateCache ()
Invalidate the cache used by tickLabel()
The cache is invalidated, when a new QwtScaleDiv is set. If the labels need to be changed. while the same QwtScaleDiv is set, invalidateCache() needs to be called manually.
Definition at line 417 of file qwt_abstract_scale_draw.cpp.
QwtText QwtAbstractScaleDraw::label (double value) const [virtual]
Convert a value into its representing label. The value is converted to a plain text using QLocale().toString(value). This method is often overloaded by applications to have individual labels.
Parameters
valueβ Value
Returns
Label string.
Reimplemented in QwtCompassScaleDraw, and QwtDateScaleDraw.
Definition at line 375 of file qwt_abstract_scale_draw.cpp.
double QwtAbstractScaleDraw::maxTickLength () const
Returns
Length of the longest tick
Useful for layout calculations
See also: tickLength(), setTickLength()
Definition at line 355 of file qwt_abstract_scale_draw.cpp.
double QwtAbstractScaleDraw::minimumExtent () const
Get the minimum extent
Returns
Minimum extent
See also: extent(), setMinimumExtent()
Definition at line 302 of file qwt_abstract_scale_draw.cpp.
qreal QwtAbstractScaleDraw::penWidthF () const
Returns
Scale pen width
See also: setPenWidth()
Definition at line 156 of file qwt_abstract_scale_draw.cpp.
const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv () const
Returns
scale division
Definition at line 133 of file qwt_abstract_scale_draw.cpp.
QwtScaleMap & QwtAbstractScaleDraw::scaleMap ()
Returns
Map how to translate between scale and pixel values
Definition at line 127 of file qwt_abstract_scale_draw.cpp.
const QwtScaleMap & QwtAbstractScaleDraw::scaleMap () const
Returns
Map how to translate between scale and pixel values
Definition at line 121 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setMinimumExtent (double minExtent)
Set a minimum for the extent. The extent is calculated from the components 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.
Parameters
minExtentβ Minimum extent
See also: extent(), minimumExtent()
Definition at line 289 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setPenWidthF (qreal width)
Specify the width of the scale pen.
Parameters
widthβ Pen width
See also: penWidth()
Definition at line 144 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setScaleDiv (const QwtScaleDiv & scaleDiv)
Change the scale division
Parameters
scaleDivβ New scale division
Definition at line 104 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setSpacing (double spacing)
Set the spacing between tick and labels. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
Parameters
spacingβ Spacing
See also: spacing()
Definition at line 254 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setTickLength (QwtScaleDiv::TickType tickType, double length)
Set the length of the ticks
Parameters
tickTypeβ Tick typelengthβ New length
Warning: the length is limited to [0..1000]
Definition at line 315 of file qwt_abstract_scale_draw.cpp.
void QwtAbstractScaleDraw::setTransformation (QwtTransform * transformation)
Change the transformation of the scale
Parameters
transformationβ New scale transformation
Definition at line 115 of file qwt_abstract_scale_draw.cpp.
double QwtAbstractScaleDraw::spacing () const
Get the spacing. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
Returns
Spacing
See also: setSpacing()
Definition at line 271 of file qwt_abstract_scale_draw.cpp.
const QwtText & QwtAbstractScaleDraw::tickLabel (const QFont & font, double value) const [protected]
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.
Parameters
fontβ Fontvalueβ Value
Returns
Tick label
Definition at line 393 of file qwt_abstract_scale_draw.cpp.
double QwtAbstractScaleDraw::tickLength (QwtScaleDiv::TickType tickType) const
Returns
Length of the ticks
See also: setTickLength(), maxTickLength()
Definition at line 338 of file qwt_abstract_scale_draw.cpp.
π Author π
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Cute footer sign-off, bestie π: the source/version vibe is Qwt User's Guide, the title is QwtAbstractScaleDraw(3), and there's no date stamp in this footer β it's just giving mystery. π«Άβ¨
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms