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

QwtScaleWidget 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.

Definition at line 33 of file qwt_scale_widget.h.

Public Types

enum  Position {
  Left,
  Right,
  Top,
  Bottom
}

Public Member Functions

 QwtScaleWidget (QWidget *parent=NULL)
 QwtScaleWidget (Position, QWidget *parent=NULL)
virtual ~QwtScaleWidget ()
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 setTitleFlags (int flags)
int titleFlags () 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 QwtScaleTransformation &, 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 setLabelFlags (int flags)
void setLabelRotation (double rotation)
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
int titleHeightForWidth (int width) const
int dimForLength (int length, const QFont &scaleFont) 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 QwtScaleWidget::Position
 

Position of the scale

See also:
QwtScaleWidget::QwtScaleWidget

Definition at line 48 of file qwt_scale_widget.h.


Constructor & Destructor Documentation

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

Create a scale with the position QwtScaleWidget::Left.

Parameters:
parent 
name passed to QWidget's CTOR
Warning:
Workaround of a designer problem

Definition at line 54 of file qwt_scale_widget.cpp.

QwtScaleWidget::QwtScaleWidget QwtScaleWidget::Position  pos,
QWidget *  parent = NULL
[explicit]
 

Constructor.

Parameters:
pos Position. Must be one of QwtScaleWidget::Left, QwtScaleWidget::Right, QwtScaleWidget::Bottom, or QwtScaleWidget::Top
parent 
name passed to QWidget's CTOR

Definition at line 68 of file qwt_scale_widget.cpp.

QwtScaleWidget::~QwtScaleWidget  )  [virtual]
 

Destructor.

Definition at line 75 of file qwt_scale_widget.cpp.


Member Function Documentation

int QwtScaleWidget::baseLineDist  )  const
 

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

Definition at line 472 of file qwt_scale_widget.cpp.

Referenced by QwtPlotLayout::minimumSizeHint(), and QwtPlot::print().

int QwtScaleWidget::dimForLength int  length,
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

Definition at line 748 of file qwt_scale_widget.cpp.

References QwtScaleDraw::minHeight(), QwtScaleDraw::minWidth(), and titleHeightForWidth().

Referenced by minimumSizeHint().

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

draw the scale

Definition at line 507 of file qwt_scale_widget.cpp.

References QwtScaleDraw::draw(), and drawTitle().

Referenced by paintEvent().

void QwtScaleWidget::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

Definition at line 613 of file qwt_scale_widget.cpp.

References QwtScaleDraw::draw().

Referenced by draw(), and QwtPlot::printScale().

int QwtScaleWidget::endBorderDist  )  const
 

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

Definition at line 463 of file qwt_scale_widget.cpp.

Referenced by QwtPlot::canvasMap(), and QwtPlot::print().

void QwtScaleWidget::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

Definition at line 792 of file qwt_scale_widget.cpp.

References layoutScale().

void QwtScaleWidget::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:
QwtScaleWidget::setLabelFormat, QString::sprintf in the Qt manual

Definition at line 400 of file qwt_scale_widget.cpp.

References QwtScaleDraw::labelFormat().

Referenced by QwtPlot::axisLabelFormat().

void QwtScaleWidget::layoutScale bool  update = true  )  [protected]
 

Recalculate the scale's geometry and layout based on.

Definition at line 553 of file qwt_scale_widget.cpp.

References QwtScaleDraw::maxHeight(), QwtScaleDraw::maxWidth(), minBorderDist(), and QwtScaleDraw::setGeometry().

Referenced by fontChange(), resizeEvent(), scaleChange(), setBaselineDist(), setBorderDist(), setLabelFlags(), setLabelFormat(), setLabelRotation(), setPosition(), setScaleDiv(), setScaleDraw(), setTitle(), setTitleDist(), setTitleFlags(), and setTitleFont().

void QwtScaleWidget::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:
QwtScaleWidget::setBorderDist()

Definition at line 779 of file qwt_scale_widget.cpp.

References QwtScaleDraw::minBorderDist().

Referenced by QwtPlotPrintFilter::apply(), layoutScale(), minimumSizeHint(), QwtPlotLayout::minimumSizeHint(), QwtPlot::print(), QwtPlotPrintFilter::reset(), and QwtPlot::updateAxes().

QSize QwtScaleWidget::minimumSizeHint  )  const [virtual]
 

Returns:
a minimum size hint

Definition at line 691 of file qwt_scale_widget.cpp.

References dimForLength(), minBorderDist(), QwtScaleDraw::minHeight(), and QwtScaleDraw::minWidth().

Referenced by QwtPlotLayout::minimumSizeHint(), QwtPlot::minimumSizeHint(), sizeHint(), and QwtPlot::sizeHint().

void QwtScaleWidget::paintEvent QPaintEvent *  e  )  [protected]
 

paintEvent

Definition at line 489 of file qwt_scale_widget.cpp.

References draw(), and QwtPaintBuffer::painter().

QwtScaleWidget::Position QwtScaleWidget::position  )  const
 

Returns:
position
See also:
QwtScaleWidget::setPosition

Definition at line 220 of file qwt_scale_widget.cpp.

References QwtScaleDraw::orientation(), and scaleDraw().

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

resizeEvent

Definition at line 543 of file qwt_scale_widget.cpp.

References layoutScale().

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.

Definition at line 675 of file qwt_scale_widget.cpp.

References layoutScale().

const QwtScaleDraw * QwtScaleWidget::scaleDraw  )  const
 

scaleDraw of this scale

See also:
QwtScaleDraw::setScaleDraw

Definition at line 409 of file qwt_scale_widget.cpp.

Referenced by QwtPlot::axisScaleDraw(), QwtPlotLayout::minimumSizeHint(), position(), QwtPlot::printScale(), and QwtPlot::sizeHint().

void QwtScaleWidget::setBaselineDist int  bd  ) 
 

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

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

Definition at line 264 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::print().

void QwtScaleWidget::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:
QwtScaleWidget::borderDist

Definition at line 249 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::updateAxes().

void QwtScaleWidget::setLabelFlags int  flags  ) 
 

Change the flags for the labels.

See QwtScaleDraw::setLabelFlags().

See also:
QwtScaleDraw::setLabelFlags(), QwtScaleWidget::setLabelRotation()

Definition at line 354 of file qwt_scale_widget.cpp.

References layoutScale(), and QwtScaleDraw::setLabelFlags().

Referenced by QwtPlot::setAxisLabelFlags().

void QwtScaleWidget::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:
QwtScaleWidget::labelFormat, QString::sprintf in the Qt manual

Definition at line 341 of file qwt_scale_widget.cpp.

References layoutScale(), and QwtScaleDraw::setLabelFormat().

Referenced by QwtPlot::setAxisLabelFormat().

void QwtScaleWidget::setLabelRotation double  rotation  ) 
 

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

See also:
QwtScaleDraw::setLabelRotation(), QwtScaleWidget::setLabelFlags()

Definition at line 365 of file qwt_scale_widget.cpp.

References layoutScale(), and QwtScaleDraw::setLabelRotation().

Referenced by QwtPlot::setAxisLabelRotation().

void QwtScaleWidget::setPosition Position  pos  ) 
 

Assign a position.

Parameters:
pos new position
See also:
QwtScaleWidget::position

Definition at line 167 of file qwt_scale_widget.cpp.

References layoutScale().

void QwtScaleWidget::setScaleDiv const QwtScaleTransformation transformation,
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.

Definition at line 806 of file qwt_scale_widget.cpp.

References layoutScale(), QwtScaleDraw::setScaleDiv(), and QwtScaleDraw::setTransformation().

Referenced by QwtPlot::updateAxes().

void QwtScaleWidget::setScaleDraw QwtScaleDraw sd  ) 
 

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

Definition at line 376 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::setAxisScaleDraw().

void QwtScaleWidget::setTitle const QString &  text  ) 
 

Give title new text contents.

Parameters:
text New text
See also:
QwtScaleWidget::title

Definition at line 148 of file qwt_scale_widget.cpp.

References layoutScale(), QwtText::makeText(), and title().

Referenced by QwtPlot::setAxisTitle().

void QwtScaleWidget::setTitleColor const QColor &  c  ) 
 

Change the title color.

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

Definition at line 309 of file qwt_scale_widget.cpp.

Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset().

void QwtScaleWidget::setTitleDist int  td  ) 
 

Specify the distance between scale and title.

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

Definition at line 279 of file qwt_scale_widget.cpp.

References layoutScale().

void QwtScaleWidget::setTitleFlags int  flags  ) 
 

Change the title flags.

Parameters:
flags see Qt::AlignmentFlags, Qt::TextFlags. 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:
QwtScaleWidget::titleFlags, Qt::AlignmentFlags, Qt::TextFlags

Definition at line 323 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::setAxisTitleFlags().

void QwtScaleWidget::setTitleFont const QFont &  f  ) 
 

Change the title font.

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

Definition at line 295 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setAxisTitleFont().

QSize QwtScaleWidget::sizeHint  )  const [virtual]
 

Returns:
a size hint

Definition at line 683 of file qwt_scale_widget.cpp.

References minimumSizeHint().

int QwtScaleWidget::startBorderDist  )  const
 

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

Definition at line 454 of file qwt_scale_widget.cpp.

Referenced by QwtPlot::canvasMap(), and QwtPlot::print().

const QString QwtScaleWidget::title  )  const
 

Returns:
title
See also:
QwtScaleWidget::setTitle

Definition at line 445 of file qwt_scale_widget.cpp.

Referenced by QwtPlot::axisTitle(), and setTitle().

const QColor QwtScaleWidget::titleColor  )  const
 

Returns:
title color
See also:
QwtScaleWidget::setTitleColor

Definition at line 436 of file qwt_scale_widget.cpp.

Referenced by QwtPlotPrintFilter::apply().

int QwtScaleWidget::titleDist  )  const
 

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

Definition at line 481 of file qwt_scale_widget.cpp.

int QwtScaleWidget::titleFlags  )  const
 

Returns:
alignment
See also:
QwtScaleWidget::setTitleFlags, Qt::AlignmentFlags, Qt::TextFlags

Definition at line 418 of file qwt_scale_widget.cpp.

Referenced by QwtPlot::axisTitleFlags().

const QFont QwtScaleWidget::titleFont  )  const
 

Returns:
title font
See also:
QwtScaleWidget::setTitleFont

Definition at line 427 of file qwt_scale_widget.cpp.

Referenced by QwtPlotPrintFilter::apply(), and QwtPlot::axisTitleFont().

int QwtScaleWidget::titleHeightForWidth int  width  )  const
 

Find the height of the title for a given width.

Parameters:
width Width
Returns:
height Height

Definition at line 734 of file qwt_scale_widget.cpp.

Referenced by dimForLength().


Generated on Wed Aug 31 23:03:51 2005 for Qwt User's Guide by  doxygen 1.4.1