Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

QwtScale Class Reference

A Widget which contains a scale. More...

#include <qwt_scale.h>

List of all members.

Public Types

enum  Orientation { Left, Right, Top, Bottom }

Public Methods

 QwtScale (Orientation, QWidget *parent, const char *name=0)
virtual ~QwtScale ()
void setTitle (const QString &title)
const QString & title () const
void setTitleColor (const QColor &c)
const QColor & titleColor () const
void setTitleFont (const QFont &f)
const QFont & titleFont () const
void setTitleAlignment (int flags)
int titleAlignment () const
void setBorderDist (int start, int end)
int startBorderDist () const
int endBorderDist () const
int minBorderDist () const
void setBaselineDist (int bd)
int baseLineDist () const
void setScaleDiv (const QwtScaleDiv &sd)
void setScaleDraw (QwtScaleDraw *)
const QwtScaleDraw * scaleDraw () const
void setLabelFormat (char f, int prec, int fieldWidth)
void labelFormat (char &f, int &prec, int &fieldWidth) const
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const
int dimForLength (int length, const QFontMetrics &titleFontMetrics, const QFontMetrics &scaleFontMetrics) const

Static Public Methods

void drawTitle (QPainter *, QwtScaleDraw::Orientation o, const QRect &, int align, const QString &)

Protected Methods

void draw (QPainter *p) const
void paintEvent (QPaintEvent *e)
void resizeEvent (QResizeEvent *e)
void scaleChange ()
void fontChange (const QFont &oldfont)
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 Enumeration Documentation

enum QwtScale::Orientation
 

Orientation/Position of the scale

See also:
QwtScale::QwtScale


Constructor & Destructor Documentation

QwtScale::QwtScale (  Orientation    ori,
QWidget *    parent,
const char *    name = 0
) 
 

Constructor.

Parameters:
ori  Orientation. Must be one of QwtScale::Left, QwtScale::Right, QwtScale::Bottom, or QwtScale::Top
parent 
name  passed to QWidget's CTOR

QwtScale::~QwtScale (    )  [virtual]
 

Destructor.


Member Function Documentation

int QwtScale::baseLineDist (    )  const
 

Returns:
base line distance
See also:
QwtScale::setBaselineDist

int QwtScale::dimForLength (  int    length,
const QFontMetrics &    titleFontMetrics,
const QFontMetrics &    scaleFontMetrics
)  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
Returns:
height for horizontal, width for vertical scales

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

draw the scale.

void QwtScale::drawTitle (  QPainter *    painter,
QwtScaleDraw::Orientation    o,
const QRect &    rect,
int    align,
const QString &    text
)  [static]
 

Rotate and paint a title according to its orientation into a given rectangle.

Parameters:
painter  Painter
rect  Bounding rectangle
o  Orientation
text  Text

int QwtScale::endBorderDist (    )  const
 

Returns:
end border distance
See also:
QwtScale::setBorderDist

void QwtScale::fontChange (  const QFont &    f )  [protected]
 

Notify a change of the font.

This virtual function may be overloaded by derived widgets. The default implementation resizes the scale and repaints the widget.

Parameters:
oldfont  old font

void QwtScale::labelFormat (  char &    f,
int &    prec,
int &    fieldwidth
)  const
 

Format character and precision have the same meaning as for the QString class.

Return values:
f  format character
prec  precision
fieldwidth  minimum fieldwidth
Returns:
the number format for the major scale labels
See also:
QwtScale::setLabelFormat, QString::sprintf in the Qt manual

void QwtScale::layoutScale (  bool    update_geometry = TRUE )  [protected]
 

Recalculate the scale's geometry and layout based on.

int QwtScale::minBorderDist (    )  const
 

Determine the minimum Border distance.

This member function returns the minimum distance of the scale's endpoints from the widget borders which is required for the mark labels to fit into the widget.

Warning:
  • The minimum border distance depends on the font.
See also:
QwtScale::setBorderDist()

QSize QwtScale::minimumSizeHint (    )  const [virtual]
 

Returns:
a minimum size hint

void QwtScale::paintEvent (  QPaintEvent *    e )  [protected]
 

paintEvent.

void QwtScale::resizeEvent (  QResizeEvent *    e )  [protected]
 

paintEvent.

void QwtScale::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.

const QwtScaleDraw * QwtScale::scaleDraw (    )  const
 

scaleDraw of this scale

See also:
QwtScaleDraw::setScaleDraw

void QwtScale::setBaselineDist (  int    bd ) 
 

Specify the border distance of the scale's base line.

Parameters:
bd  border distance of the baseline
See also:
QwtScale::baseLineDist

void QwtScale::setBorderDist (  int    dist1,
int    dist2
) 
 

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:
QwtScale::borderDist

void QwtScale::setLabelFormat (  char    f,
int    prec,
int    fieldwidth
) 
 

Set the number format for the major scale labels.

Format character and precision have the same meaning as for the QString class.

Parameters:
f  format character
prec  precision
fieldwidth  minimum fieldwidth
See also:
QwtScale::labelFormat, QString::sprintf in the Qt manual

void QwtScale::setScaleDiv (  const QwtScaleDiv &    sd ) 
 

Assign a scale division.

The scale division determines where to set the tick marks.

Parameters:
sd  Scale Division
See also:
For more information about scale divisions, see QwtScaleDiv.

void QwtScale::setScaleDraw (  QwtScaleDraw *    sd ) 
 

Set a scale draw sd has to be created with new and will be deleted in QwtScale::~QwtScale or the next call of QwtScale::setScaleDraw.

void QwtScale::setTitle (  const QString &    title ) 
 

Assign a title.

Parameters:
title  new title
See also:
QwtScale::title

void QwtScale::setTitleAlignment (  int    flags ) 
 

Change the title alignment.

Parameters:
flags  see Qt::AlignmentFlags. flags are interpreted in direction of the label, AlignTop, AlignBottom can't be set as the title will always be aligned to the scale.
See also:
QwtScale::titleAlignment, Qt::AlignmentFlags

void QwtScale::setTitleColor (  const QColor &    c ) 
 

Change the title color.

Parameters:
c  new title color
See also:
QwtScale::titleColor

void QwtScale::setTitleFont (  const QFont &    f ) 
 

Change the title font.

Parameters:
f  new font
See also:
QwtScale::title

QSize QwtScale::sizeHint (    )  const [virtual]
 

Returns:
a size hint

QSizePolicy QwtScale::sizePolicy (    )  const [virtual]
 

Returns:
Fixed/MinimumExpanding for vertical, MinimumExpanding/Fixed for horizontal scales.

int QwtScale::startBorderDist (    )  const
 

Returns:
start border distance
See also:
QwtScale::setBorderDist

const QString & QwtScale::title (    )  const
 

Returns:
title
See also:
QwtScale::setTitle

int QwtScale::titleAlignment (    )  const
 

Returns:
alignment
See also:
QwtScale::setTitleAlignment, Qt::AlignmentFlags

const QColor & QwtScale::titleColor (    )  const
 

Returns:
title color
See also:
QwtScale::setTitleColor

const QFont & QwtScale::titleFont (    )  const
 

Returns:
title font
See also:
QwtScale::setTitleFont


Generated on Tue May 28 15:31:00 2002 for Qwt User's Guide by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001