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 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 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 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
QwtScaleDrawscaleDraw ()
void setLabelAlignment (int)
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::Alignment, const QRect &rect) const
void setAlignment (QwtScaleDraw::Alignment)
QwtScaleDraw::Alignment alignment () const

Protected Member Functions

virtual void paintEvent (QPaintEvent *e)
virtual void resizeEvent (QResizeEvent *e)
virtual void fontChange (const QFont &oldfont)
void draw (QPainter *p) const
void scaleChange ()
void layoutScale (bool update=true)


Constructor & Destructor Documentation

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

Create a scale with the position QwtScaleWidget::Left.

Parameters:
parent Parent widget
Warning:
Workaround of a designer problem

Definition at line 52 of file qwt_scale_widget.cpp.

QwtScaleWidget::QwtScaleWidget QwtScaleDraw::Alignment  align,
QWidget *  parent = NULL
[explicit]
 

Constructor.

Parameters:
align Alignment.
parent Parent widget

Definition at line 63 of file qwt_scale_widget.cpp.

QwtScaleWidget::~QwtScaleWidget  )  [virtual]
 

Destructor.

Definition at line 71 of file qwt_scale_widget.cpp.


Member Function Documentation

QwtScaleDraw::Alignment QwtScaleWidget::alignment  )  const
 

Returns:
position
See also:
QwtScaleWidget::setPosition

Definition at line 188 of file qwt_scale_widget.cpp.

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

int QwtScaleWidget::baseLineDist  )  const
 

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

Definition at line 338 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 607 of file qwt_scale_widget.cpp.

References titleHeightForWidth().

Referenced by minimumSizeHint().

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

draw the scale

Definition at line 373 of file qwt_scale_widget.cpp.

References drawTitle().

Referenced by paintEvent().

void QwtScaleWidget::drawTitle QPainter *  painter,
QwtScaleDraw::Alignment  align,
const QRect &  rect
const
 

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

Parameters:
painter Painter
align Alignment
rect Bounding rectangle

Definition at line 482 of file qwt_scale_widget.cpp.

References QwtText::draw(), QwtText::setFlags(), and title().

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

int QwtScaleWidget::endBorderDist  )  const
 

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

Definition at line 329 of file qwt_scale_widget.cpp.

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

void QwtScaleWidget::fontChange const QFont &  oldFont  )  [protected, virtual]
 

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 679 of file qwt_scale_widget.cpp.

References layoutScale().

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()

Definition at line 632 of file qwt_scale_widget.cpp.

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

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()

Definition at line 663 of file qwt_scale_widget.cpp.

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

Recalculate the scale's geometry and layout based on.

Definition at line 429 of file qwt_scale_widget.cpp.

References getBorderDistHint().

Referenced by fontChange(), resizeEvent(), scaleChange(), setAlignment(), setBaselineDist(), setBorderDist(), setLabelRotation(), setScaleDiv(), setScaleDraw(), setTitle(), and setTitleDist().

QSize QwtScaleWidget::minimumSizeHint  )  const [virtual]
 

Returns:
a minimum size hint

Definition at line 559 of file qwt_scale_widget.cpp.

References dimForLength(), getBorderDistHint(), and qwtMax.

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

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

paintEvent

Definition at line 355 of file qwt_scale_widget.cpp.

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

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

resizeEvent

Definition at line 419 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 543 of file qwt_scale_widget.cpp.

References layoutScale().

QwtScaleDraw * QwtScaleWidget::scaleDraw  ) 
 

scaleDraw of this scale

See also:
QwtScaleDraw::setScaleDraw

Definition at line 302 of file qwt_scale_widget.cpp.

const QwtScaleDraw * QwtScaleWidget::scaleDraw  )  const
 

scaleDraw of this scale

See also:
QwtScaleDraw::setScaleDraw

Definition at line 293 of file qwt_scale_widget.cpp.

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

void QwtScaleWidget::setAlignment QwtScaleDraw::Alignment  alignment  ) 
 

Change the alignment

Parameters:
alignment New alignment
See also:
QwtScaleWidget::alignment

Definition at line 157 of file qwt_scale_widget.cpp.

References layoutScale().

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 219 of file qwt_scale_widget.cpp.

References layoutScale(), and qwtMax.

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 204 of file qwt_scale_widget.cpp.

References layoutScale().

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

void QwtScaleWidget::setLabelAlignment int  alignment  ) 
 

Change the alignment for the labels.

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

Definition at line 250 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setLabelRotation double  rotation  ) 
 

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

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

Definition at line 264 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::setAxisLabelRotation().

void QwtScaleWidget::setMinBorderDist int  start,
int  end
 

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.

See also:
getMinBorderDist(), getBorderDistHint()

Definition at line 651 of file qwt_scale_widget.cpp.

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

Definition at line 697 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::updateAxes().

void QwtScaleWidget::setScaleDraw QwtScaleDraw  ) 
 

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 275 of file qwt_scale_widget.cpp.

References layoutScale().

Referenced by QwtPlot::setAxisScaleDraw().

void QwtScaleWidget::setTitle const QwtText title  ) 
 

Give title new text contents.

Parameters:
title New title
See also:
QwtScaleWidget::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.

Definition at line 138 of file qwt_scale_widget.cpp.

References QwtText::flags(), layoutScale(), and QwtText::setFlags().

void QwtScaleWidget::setTitleDist int  td  ) 
 

Specify the distance between scale and title.

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

Definition at line 234 of file qwt_scale_widget.cpp.

References layoutScale(), and qwtMax.

QSize QwtScaleWidget::sizeHint  )  const [virtual]
 

Returns:
a size hint

Definition at line 551 of file qwt_scale_widget.cpp.

References minimumSizeHint().

int QwtScaleWidget::startBorderDist  )  const
 

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

Definition at line 320 of file qwt_scale_widget.cpp.

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

QwtText QwtScaleWidget::title  )  const
 

Returns:
title
See also:
QwtScaleWidget::setTitle

Definition at line 311 of file qwt_scale_widget.cpp.

Referenced by QwtPlotPrintFilter::apply(), QwtPlot::axisTitle(), and drawTitle().

int QwtScaleWidget::titleDist  )  const
 

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

Definition at line 347 of file qwt_scale_widget.cpp.

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 593 of file qwt_scale_widget.cpp.

Referenced by dimForLength().


Generated on Mon Jan 30 22:17:42 2006 for Qwt User's Guide by  doxygen 1.4.4