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

QwtScale Class Reference

List of all members.

Detailed Description

A Widget which contains a scale.

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


Public Types

enum  Position {
  Left,
  Right,
  Top,
  Bottom
}

Public Member Functions

 QwtScale (Position, 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
void minBorderDist (int &start, int &end) const
void setBaselineDist (int bd)
int baseLineDist () const
void setTitleDist (int td)
int titleDist () const
void setScaleDiv (const QwtScaleDiv &sd)
void setScaleDraw (QwtScaleDraw *)
const QwtScaleDrawscaleDraw () const
void setLabelFormat (char f, int prec, int fieldWidth)
void labelFormat (char &f, int &prec, int &fieldWidth) const
void setLabelAlignment (int align)
void setLabelRotation (double rotation)
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const
int titleHeightForWidth (int width) const
int dimForLength (int length, const QFontMetrics &scaleFontMetrics) const
void drawTitle (QPainter *painter, QwtScaleDraw::Orientation o, const QRect &rect) const
void setPosition (Position o)
Position position () const

Protected Member Functions

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)


Member Enumeration Documentation

enum QwtScale::Position
 

Position of the scale

See also:
QwtScale::QwtScale


Constructor & Destructor Documentation

QwtScale::QwtScale QwtScale::Position  pos,
QWidget *  parent,
const char *  name = 0
 

Constructor.

Parameters:
pos Position. 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 &  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
scaleFontMetrics Font metrics of the scale
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
const
 

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

Parameters:
painter Painter
o Orientation
rect Bounding rectangle

int QwtScale::endBorderDist  )  const
 

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

void QwtScale::fontChange const QFont &  oldFont  )  [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 Previous 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 = TRUE  )  [protected]
 

Recalculate the scale's geometry and layout based on.

void QwtScale::minBorderDist int &  start,
int &  end
const
 

Determine the minimum Border distances.

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

QwtScale::Position QwtScale::position  )  const
 

Returns:
position
See also:
QwtScale::setPosition

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

resizeEvent

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::setLabelAlignment int  align  ) 
 

Change the alignment for the labels.

See QwtScaleDraw::setLabelAlignment().

See also:
QwtScaleDraw::setLabelAlignment(), QwtScale::setLabelRotation()

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::setLabelRotation double  rotation  ) 
 

Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().

See also:
QwtScaleDraw::setLabelRotation(), QwtScale::setLabelAlignment()

void QwtScale::setPosition Position  pos  ) 
 

Assign a position.

Parameters:
pos new position
See also:
QwtScale::position

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 &  text  ) 
 

Give title new text contents.

Parameters:
text New text
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::setTitleDist int  td  ) 
 

Specify the distance between scale and title.

Parameters:
td Title distance
See also:
QwtScale::titleDist

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

int QwtScale::titleDist  )  const
 

Returns:
distance between scale and title
See also:
QwtScale::setBaselineDist

const QFont QwtScale::titleFont  )  const
 

Returns:
title font
See also:
QwtScale::setTitleFont

int QwtScale::titleHeightForWidth int  width  )  const
 

Find the height of the title for a given width.

Parameters:
width Width
Returns:
height Height


Generated on Tue Nov 25 21:15:08 2003 for Qwt User's Guide by doxygen 1.3.4