QwtAbstractScaleDraw(3) | Qwt User's Guide | QwtAbstractScaleDraw(3) |
NAME¶
QwtAbstractScaleDraw -
SYNOPSIS¶
#include <qwt_abstract_scale_draw.h>
Inherited by QwtRoundScaleDraw, and QwtScaleDraw.
Public Types¶
enum ScaleComponent { Backbone = 1, Ticks =
2, Labels = 4 }
Public Member Functions¶
QwtAbstractScaleDraw ()
QwtAbstractScaleDraw (const QwtAbstractScaleDraw &)
virtual ~QwtAbstractScaleDraw ()
virtual void draw (QPainter *, const QPalette &) const
void enableComponent (ScaleComponent, bool enable=true)
virtual int extent (const QPen &, const QFont &) const =0
bool hasComponent (ScaleComponent) const
virtual QwtText label (double) const
int majTickLength () const
const QwtScaleMap & map () const
int minimumExtent () const
QwtAbstractScaleDraw & operator= (const
QwtAbstractScaleDraw &)
const QwtScaleDiv & scaleDiv () const
QwtScaleMap & scaleMap ()
void setMinimumExtent (int)
void setScaleDiv (const QwtScaleDiv &s)
void setSpacing (int margin)
void setTickLength (QwtScaleDiv::TickType, int length)
void setTransformation (QwtScaleTransformation *)
int spacing () const
int tickLength (QwtScaleDiv::TickType) const
Protected Member Functions¶
virtual void drawBackbone (QPainter *painter) const =0
virtual void drawLabel (QPainter *painter, double value) const =0
virtual void drawTick (QPainter *painter, double value, int len) const
=0
void invalidateCache ()
const QwtText & tickLabel (const QFont &, double value)
const
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 QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
Member Enumeration Documentation¶
enum QwtAbstractScaleDraw::ScaleComponent¶
Components of a scale
- Backbone
- Ticks
- Labels
See also:
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
Member Function Documentation¶
void QwtAbstractScaleDraw::draw (QPainter *painter, const QPalette &palette) const [virtual]¶
Draw the scale. Parameters:
palette Palette, text color is used for the labels, foreground color for ticks and backbone
virtual void QwtAbstractScaleDraw::drawBackbone (QPainter *painter) const [protected], [pure virtual]¶
Draws the baseline of the scale
Parameters:
See also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
virtual void QwtAbstractScaleDraw::drawLabel (QPainter *painter, doublevalue) const [protected], [pure virtual]¶
Draws the label for a major scale tick
Parameters:
value Value
See also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
virtual void QwtAbstractScaleDraw::drawTick (QPainter *painter, doublevalue, intlen) const [protected], [pure virtual]¶
Draw a tick
Parameters:
value Value of the tick
len Lenght of the tick
See also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
void QwtAbstractScaleDraw::enableComponent (ScaleComponentcomponent, boolenable = true)¶
En/Disable a component of the scale
Parameters:
enable On/Off
See also:
virtual int QwtAbstractScaleDraw::extent (const QPen &, const QFont &) const [pure virtual]¶
Calculate the extent
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 minimumExtent() pixels.
See also:
Implemented in QwtRoundScaleDraw, and QwtScaleDraw.
bool QwtAbstractScaleDraw::hasComponent (ScaleComponentcomponent) const¶
Check if a component is enabled
See also:
void QwtAbstractScaleDraw::invalidateCache () [protected]¶
Invalidate the cache used by QwtAbstractScaleDraw::tickLabel
The cache is invalidated, when a new QwtScaleDiv is set. If the labels need to be changed. while the same QwtScaleDiv is set, QwtAbstractScaleDraw::invalidateCache needs to be called manually.
QwtText QwtAbstractScaleDraw::label (doublevalue) const [virtual]¶
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.
Parameters:
Returns:
Reimplemented in QwtDialScaleDraw.
int QwtAbstractScaleDraw::majTickLength () const¶
The same as QwtAbstractScaleDraw::tickLength(QwtScaleDiv::MajorTick).
const QwtScaleMap & QwtAbstractScaleDraw::map () const¶
Returns:
int QwtAbstractScaleDraw::minimumExtent () const¶
Get the minimum extent
See also:
const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv () const¶
Returns:
QwtScaleMap & QwtAbstractScaleDraw::scaleMap ()¶
Returns:
void QwtAbstractScaleDraw::setMinimumExtent (intminExtent)¶
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.
Parameters:
See also:
void QwtAbstractScaleDraw::setScaleDiv (const QwtScaleDiv &sd)¶
Change the scale division
Parameters:
void QwtAbstractScaleDraw::setSpacing (intspacing)¶
Set the spacing between tick and labels. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
Parameters:
See also:
void QwtAbstractScaleDraw::setTickLength (QwtScaleDiv::TickTypetickType, intlength)¶
Set the length of the ticks
Parameters:
length New length
Warning:
void QwtAbstractScaleDraw::setTransformation (QwtScaleTransformation *transformation)¶
Change the transformation of the scale
Parameters:
int QwtAbstractScaleDraw::spacing () const¶
Get the spacing. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
See also:
const QwtText & QwtAbstractScaleDraw::tickLabel (const QFont &font, doublevalue) 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:
value Value
Returns:
int QwtAbstractScaleDraw::tickLength (QwtScaleDiv::TickTypetickType) const¶
Return the length of the ticks
See also:
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Tue Nov 20 2012 | Version 5.2.3 |