QwtAbstractScaleDraw(3) | Qwt User's Guide | QwtAbstractScaleDraw(3) |
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
Scale components.
Public Member Functions¶
QwtAbstractScaleDraw ()
Constructor. virtual ~QwtAbstractScaleDraw ()
Destructor. void setScaleDiv (const QwtScaleDiv &s)
const QwtScaleDiv & scaleDiv () const
void setTransformation (QwtTransform *)
const QwtScaleMap & scaleMap () const
QwtScaleMap & scaleMap ()
void enableComponent (ScaleComponent, bool enable=true)
bool hasComponent (ScaleComponent) const
void setTickLength (QwtScaleDiv::TickType, double length)
double tickLength (QwtScaleDiv::TickType) const
double maxTickLength () const
void setSpacing (double margin)
Set the spacing between tick and labels. double spacing () const
Get the spacing. void setPenWidth (int width)
Specify the width of the scale pen. int penWidth () const
virtual 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 =0
void setMinimumExtent (double)
Set a minimum for the extent. double minimumExtent () const
Protected Member Functions¶
virtual void drawTick (QPainter *painter, double value, double len) const =0
virtual void drawBackbone (QPainter *painter) const =0
virtual void drawLabel (QPainter *painter, double value) const =0
void invalidateCache ()
const 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.
Member Enumeration Documentation¶
enum QwtAbstractScaleDraw::ScaleComponent¶
Components of a scaleSee Also:
Enumerator
- Backbone
- Backbone = the line where the ticks are located.
- Ticks
- Ticks.
- Labels
- Labels.
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 pixelsMember 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 scaleParameters:
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 tickParameters:
value Value
See Also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
virtual void QwtAbstractScaleDraw::drawTick (QPainter *painter, doublevalue, doublelen) const [protected], [pure virtual]¶
Draw a tickParameters:
value Value of the tick
len Length of the tick
See Also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
void QwtAbstractScaleDraw::enableComponent (ScaleComponentcomponent, boolenable = true)¶
En/Disable a component of the scaleParameters:
enable On/Off
See Also:
virtual double QwtAbstractScaleDraw::extent (const QFont &font) const [pure virtual]¶
Calculate the extentThe 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:
Returns:
See Also:
Implemented in QwtScaleDraw, and QwtRoundScaleDraw.
bool QwtAbstractScaleDraw::hasComponent (ScaleComponentcomponent) const¶
Check if a component is enabledParameters:
Returns:
See Also:
void QwtAbstractScaleDraw::invalidateCache () [protected]¶
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.
QwtText QwtAbstractScaleDraw::label (doublevalue) 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:
Returns:
Reimplemented in QwtDateScaleDraw, and QwtCompassScaleDraw.
double QwtAbstractScaleDraw::maxTickLength () const¶
Returns:Useful for layout calculations
See Also:
double QwtAbstractScaleDraw::minimumExtent () const¶
Get the minimum extentReturns:
See Also:
int QwtAbstractScaleDraw::penWidth () const¶
Returns:See Also:
const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv () const¶
Returns:const QwtScaleMap & QwtAbstractScaleDraw::scaleMap () const¶
Returns:QwtScaleMap & QwtAbstractScaleDraw::scaleMap ()¶
Returns:void QwtAbstractScaleDraw::setMinimumExtent (doubleminExtent)¶
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:
See Also:
void QwtAbstractScaleDraw::setPenWidth (intwidth)¶
Specify the width of the scale pen.Parameters:
See Also:
void QwtAbstractScaleDraw::setScaleDiv (const QwtScaleDiv &scaleDiv)¶
Change the scale divisionParameters:
void QwtAbstractScaleDraw::setSpacing (doublespacing)¶
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, doublelength)¶
Set the length of the ticksParameters:
length New length
Warning:
void QwtAbstractScaleDraw::setTransformation (QwtTransform *transformation)¶
Change the transformation of the scaleParameters:
double QwtAbstractScaleDraw::spacing () const¶
Get the spacing. The spacing is the distance between ticks and labels. The default spacing is 4 pixels.Returns:
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:
double QwtAbstractScaleDraw::tickLength (QwtScaleDiv::TickTypetickType) const¶
Returns:See Also:
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.Thu Dec 11 2014 | Version 6.1.2 |