Scroll to navigation

QwtScaleWidget(3) Qwt User's Guide QwtScaleWidget(3)

NAME

QwtScaleWidget -
A Widget which contains a scale.
 

SYNOPSIS

#include <qwt_scale_widget.h>

Public Types


enum LayoutFlag { TitleInverted = 1 }
 
typedef QFlags< LayoutFlag > LayoutFlags
 

Signals


void scaleDivChanged ()
 

Public Member Functions


QwtScaleWidget (QWidget *parent=NULL)
 
QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=NULL)
 
virtual ~QwtScaleWidget ()
 
void setTitle (const QString &title)
 
void setTitle (const QwtText &title)
 
QwtText title () const
 
void setLayoutFlag (LayoutFlag, bool on)
 
bool testLayoutFlag (LayoutFlag) const
 
void setBorderDist (int start, int end)
 
int startBorderDist () const
 
int endBorderDist () const
 
void getBorderDistHint (int &start, int &end) const
 
void getMinBorderDist (int &start, int &end) const
 
void setMinBorderDist (int start, int end)
 
void setMargin (int)
 
int margin () const
 
void setSpacing (int td)
 
int spacing () const
 
void setScaleDiv (QwtScaleTransformation *, const QwtScaleDiv &sd)
 
void setScaleDraw (QwtScaleDraw *)
 
const QwtScaleDraw * scaleDraw () const
 
QwtScaleDraw * scaleDraw ()
 
void setLabelAlignment (Qt::Alignment)
 
void setLabelRotation (double rotation)
 
void setColorBarEnabled (bool)
 
bool isColorBarEnabled () const
 
void setColorBarWidth (int)
 
int colorBarWidth () const
 
void setColorMap (const QwtInterval &, QwtColorMap *)
 
QwtInterval colorBarInterval () const
 
const QwtColorMap * colorMap () const
 
virtual QSize sizeHint () const
 
virtual QSize minimumSizeHint () const
 
int titleHeightForWidth (int width) const
 
int dimForLength (int length, const QFont &scaleFont) const
 
void drawColorBar (QPainter *painter, const QRectF &) const
 
void drawTitle (QPainter *painter, QwtScaleDraw::Alignment, const QRectF &rect) const
 
void setAlignment (QwtScaleDraw::Alignment)
 
QwtScaleDraw::Alignment alignment () const
 
QRectF colorBarRect (const QRectF &) const
 

Protected Member Functions


virtual void paintEvent (QPaintEvent *)
 
virtual void resizeEvent (QResizeEvent *)
 
void draw (QPainter *p) const
 
void scaleChange ()
 
void layoutScale (bool update=true)
 

Detailed Description

A Widget which contains a scale.
 
This Widget can be used to decorate composite widgets with a scale.

Member Typedef Documentation

typedef QFlags<LayoutFlag> QwtScaleWidget::LayoutFlags

Layout flags of the title.

Member Enumeration Documentation

enum QwtScaleWidget::LayoutFlag

Layout flags of the title.
Enumerator:
TitleInverted
The title of vertical scales is painted from top to bottom. Otherwise it is painted from bottom to top.

Constructor & Destructor Documentation

QwtScaleWidget::QwtScaleWidget (QWidget *parent = NULL) [explicit]

Create a scale with the position QwtScaleWidget::Left. Parameters:
parent Parent widget
 

QwtScaleWidget::QwtScaleWidget (QwtScaleDraw::Alignmentalign, QWidget *parent = NULL) [explicit]

Constructor. Parameters:
align Alignment.
 
parent Parent widget
 

QwtScaleWidget::~QwtScaleWidget () [virtual]

Destructor.

Member Function Documentation

QwtScaleDraw::Alignment QwtScaleWidget::alignment () const Returns:

position
See also:
setPosition()
 

QwtInterval QwtScaleWidget::colorBarInterval () const Returns:

Value interval for the color bar
See also:
setColorMap(), colorMap()
 

QRectF QwtScaleWidget::colorBarRect (const QRectF &rect) const Calculate the the rectangle for the color bar

Parameters:
rect Bounding rectangle for all components of the scale
Returns:
Rectabgle for the color bar
 

int QwtScaleWidget::colorBarWidth () const Returns:

Width of the color bar
See also:
setColorBarEnabled(), setColorBarEnabled()
 

const QwtColorMap * QwtScaleWidget::colorMap () const Returns:

Color map
See also:
setColorMap(), colorBarInterval()
 

int QwtScaleWidget::dimForLength (intlength, const QFont &scaleFont) const

Find the minimum dimension for a given length. dim is the height, length the width seen in direction of the title. Parameters:
length width for horizontal, height for vertical scales
 
scaleFont Font of the scale
Returns:
height for horizontal, width for vertical scales
 

void QwtScaleWidget::draw (QPainter *p) const [protected]

draw the scale

void QwtScaleWidget::drawColorBar (QPainter *painter, const QRectF &rect) const Draw the color bar of the scale widget

Parameters:
painter Painter
 
rect Bounding rectangle for the color bar
See also:
setColorBarEnabled()
 

void QwtScaleWidget::drawTitle (QPainter *painter, QwtScaleDraw::Alignmentalign, const QRectF &rect) const Rotate and paint a title according to its position into a given rectangle.

Parameters:
painter Painter
 
align Alignment
 
rect Bounding rectangle
 

int QwtScaleWidget::endBorderDist () const Returns:

end border distance
See also:
setBorderDist()
 

void QwtScaleWidget::getBorderDistHint (int &start, int &end) const

Calculate a hint for the border distances. This member function calculates the distance of the scale's endpoints from the widget borders which is required for the mark labels to fit into the widget. The maximum of this distance an the minimum border distance is returned.
Warning:
The minimum border distance depends on the font.
See also:
setMinBorderDist(), getMinBorderDist(), setBorderDist()
 

void QwtScaleWidget::getMinBorderDist (int &start, int &end) const Get the minimum value for the distances of the scale's endpoints from the widget borders.

See also:
setMinBorderDist(), getBorderDistHint()
 

bool QwtScaleWidget::isColorBarEnabled () const Returns:

true, when the color bar is enabled
See also:
setColorBarEnabled(), setColorBarWidth()
 

void QwtScaleWidget::layoutScale (boolupdate_geometry = true) [protected] Recalculate the scale's geometry and layout based on the current rect and fonts.

Parameters:
update_geometry Notify the layout system and call update to redraw the scale
 

int QwtScaleWidget::margin () const Returns:

margin
See also:
setMargin()
 

QSize QwtScaleWidget::minimumSizeHint () const [virtual] Returns:

a minimum size hint
 

void QwtScaleWidget::paintEvent (QPaintEvent *event) [protected, virtual]

paintEvent

void QwtScaleWidget::resizeEvent (QResizeEvent *event) [protected, virtual] Event handler for resize event

Parameters:
event Resize event
 

void QwtScaleWidget::scaleChange () [protected]

Notify a change of the scale. This virtual function can be overloaded by derived classes. The default implementation updates the geometry and repaints the widget.

void QwtScaleWidget::scaleDivChanged () [signal]

Signal emitted, whenever the scale divison changes.

const QwtScaleDraw * QwtScaleWidget::scaleDraw () const scaleDraw of this scale

See also:
setScaleDraw(), QwtScaleDraw::setScaleDraw()
 

QwtScaleDraw * QwtScaleWidget::scaleDraw () scaleDraw of this scale

See also:
QwtScaleDraw::setScaleDraw()
 

void QwtScaleWidget::setAlignment (QwtScaleDraw::Alignmentalignment) Change the alignment

Parameters:
alignment New alignment
See also:
alignment()
 

void QwtScaleWidget::setBorderDist (intdist1, intdist2) Specify distances of the scale's endpoints from the widget's borders. The actual borders will never be less than minimum border distance.

Parameters:
dist1 Left or top Distance
 
dist2 Right or bottom distance
See also:
borderDist()
 

void QwtScaleWidget::setColorBarEnabled (boolon) En/disable a color bar associated to the scale

See also:
isColorBarEnabled(), setColorBarWidth()
 

void QwtScaleWidget::setColorBarWidth (intwidth) Set the width of the color bar

Parameters:
width Width
See also:
colorBarWidth(), setColorBarEnabled()
 

void QwtScaleWidget::setColorMap (const QwtInterval &interval, QwtColorMap *colorMap) Set the color map and value interval, that are used for displaying the color bar.

Parameters:
interval Value interval
 
colorMap Color map
See also:
colorMap(), colorBarInterval()
 

void QwtScaleWidget::setLabelAlignment (Qt::Alignmentalignment)

Change the alignment for the labels. See also:
QwtScaleDraw::setLabelAlignment(), setLabelRotation()
 

void QwtScaleWidget::setLabelRotation (doublerotation)

Change the rotation for the labels. See QwtScaleDraw::setLabelRotation(). Parameters:
rotation Rotation
See also:
QwtScaleDraw::setLabelRotation(), setLabelFlags()
 

void QwtScaleWidget::setLayoutFlag (LayoutFlagflag, boolon) Toggle an layout flag

Parameters:
flag Layout flag
 
on true/false
See also:
testLayoutFlag(), LayoutFlag
 

void QwtScaleWidget::setMargin (intmargin)

Specify the margin to the colorBar/base line. Parameters:
margin Margin
See also:
margin()
 

void QwtScaleWidget::setMinBorderDist (intstart, intend) Set a minimum value for the distances of the scale's endpoints from the widget borders. This is useful to avoid that the scales are 'jumping', when the tick labels or their positions change often.

Parameters:
start Minimum for the start border
 
end Minimum for the end border
See also:
getMinBorderDist(), getBorderDistHint()
 

void QwtScaleWidget::setScaleDiv (QwtScaleTransformation *transformation, const QwtScaleDiv &scaleDiv)

Assign a scale division. The scale division determines where to set the tick marks.
Parameters:
transformation Transformation, needed to translate between scale and pixal values
 
scaleDiv Scale Division
See also:
For more information about scale divisions, see QwtScaleDiv.
 

void QwtScaleWidget::setScaleDraw (QwtScaleDraw *sd) Set a scale draw sd has to be created with new and will be deleted in ~QwtScaleWidget() or the next call of setScaleDraw().

Parameters:
sd ScaleDraw object
See also:
scaleDraw()
 

void QwtScaleWidget::setSpacing (intspacing)

Specify the distance between color bar, scale and title. Parameters:
spacing Spacing
See also:
spacing()
 

void QwtScaleWidget::setTitle (const QString &title) Give title new text contents

Parameters:
title New title
See also:
title(), setTitle(const QwtText &);
 

void QwtScaleWidget::setTitle (const QwtText &title) Give title new text contents

Parameters:
title New title
See also:
title()
Warning:
The title flags are interpreted in direction of the label, AlignTop, AlignBottom can't be set as the title will always be aligned to the scale.
 

QSize QwtScaleWidget::sizeHint () const [virtual] Returns:

a size hint
 

int QwtScaleWidget::spacing () const Returns:

distance between scale and title
See also:
setMargin()
 

int QwtScaleWidget::startBorderDist () const Returns:

start border distance
See also:
setBorderDist()
 

bool QwtScaleWidget::testLayoutFlag (LayoutFlagflag) const Test a layout flag

Parameters:
flag Layout flag
Returns:
true/false
See also:
setLayoutFlag(), LayoutFlag
 

QwtText QwtScaleWidget::title () const Returns:

title
See also:
setTitle()
 

int QwtScaleWidget::titleHeightForWidth (intwidth) const

Find the height of the title for a given width. Parameters:
width Width
Returns:
height Height
 
 

Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.
Fri Apr 15 2011 Version 6.0.0