This Widget can be used to decorate composite widgets with a scale.
Definition at line 34 of file qwt_scale_widget.h.
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 | 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 | setPenWidth (int) |
int | penWidth () 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 QwtDoubleInterval &, const QwtColorMap &) |
QwtDoubleInterval | 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 QRect &rect) const |
void | drawTitle (QPainter *painter, QwtScaleDraw::Alignment, const QRect &rect) const |
void | setAlignment (QwtScaleDraw::Alignment) |
QwtScaleDraw::Alignment | alignment () const |
QRect | colorBarRect (const QRect &) const |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
void | draw (QPainter *p) const |
void | scaleChange () |
void | layoutScale (bool update=true) |
QwtScaleWidget::QwtScaleWidget | ( | QWidget * | parent = NULL |
) | [explicit] |
Create a scale with the position QwtScaleWidget::Left.
parent | Parent widget |
Definition at line 63 of file qwt_scale_widget.cpp.
QwtScaleWidget::QwtScaleWidget | ( | QwtScaleDraw::Alignment | align, | |
QWidget * | parent = NULL | |||
) | [explicit] |
Constructor.
align | Alignment. | |
parent | Parent widget |
Definition at line 87 of file qwt_scale_widget.cpp.
QwtScaleWidget::~QwtScaleWidget | ( | ) | [virtual] |
void QwtScaleWidget::scaleDivChanged | ( | ) | [signal] |
void QwtScaleWidget::setTitle | ( | const QwtText & | title | ) |
Give title new text contents.
title | New title |
Definition at line 167 of file qwt_scale_widget.cpp.
References layoutScale(), QwtText::renderFlags(), and QwtText::setRenderFlags().
QwtText QwtScaleWidget::title | ( | ) | const |
Definition at line 357 of file qwt_scale_widget.cpp.
Referenced by QwtPlotPrintFilter::apply(), and QwtPlot::axisTitle().
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.
dist1 | Left or top Distance | |
dist2 | Right or bottom distance |
Definition at line 233 of file qwt_scale_widget.cpp.
References layoutScale().
Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::updateAxes().
int QwtScaleWidget::startBorderDist | ( | ) | const |
Definition at line 366 of file qwt_scale_widget.cpp.
Referenced by QwtPlot::canvasMap(), and QwtPlot::print().
int QwtScaleWidget::endBorderDist | ( | ) | const |
Definition at line 375 of file qwt_scale_widget.cpp.
Referenced by QwtPlot::canvasMap(), and QwtPlot::print().
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.
Definition at line 774 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.
Definition at line 805 of file qwt_scale_widget.cpp.
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.
Definition at line 793 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setMargin | ( | int | margin | ) |
Specify the margin to the colorBar/base line.
margin | Margin |
Definition at line 248 of file qwt_scale_widget.cpp.
References layoutScale().
Referenced by QwtPlot::print().
int QwtScaleWidget::margin | ( | ) | const |
Definition at line 384 of file qwt_scale_widget.cpp.
Referenced by QwtPlotLayout::minimumSizeHint(), and QwtPlot::print().
void QwtScaleWidget::setSpacing | ( | int | spacing | ) |
Specify the distance between color bar, scale and title.
spacing | Spacing |
Definition at line 263 of file qwt_scale_widget.cpp.
References layoutScale().
int QwtScaleWidget::spacing | ( | ) | const |
Definition at line 393 of file qwt_scale_widget.cpp.
Referenced by QwtPlot::printScale().
void QwtScaleWidget::setPenWidth | ( | int | width | ) |
Specify the width of the scale pen.
width | Pen width |
Definition at line 278 of file qwt_scale_widget.cpp.
References layoutScale().
int QwtScaleWidget::penWidth | ( | ) | const |
Definition at line 402 of file qwt_scale_widget.cpp.
Referenced by QwtPlot::printScale().
void QwtScaleWidget::setScaleDiv | ( | QwtScaleTransformation * | transformation, | |
const QwtScaleDiv & | scaleDiv | |||
) |
Assign a scale division.
The scale division determines where to set the tick marks.
transformation | Transformation, needed to translate between scale and pixal values | |
scaleDiv | Scale Division |
Definition at line 839 of file qwt_scale_widget.cpp.
References layoutScale(), QwtAbstractScaleDraw::map(), QwtAbstractScaleDraw::scaleDiv(), scaleDivChanged(), QwtAbstractScaleDraw::setScaleDiv(), QwtAbstractScaleDraw::setTransformation(), QwtScaleMap::transformation(), and QwtScaleTransformation::type().
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 321 of file qwt_scale_widget.cpp.
References layoutScale(), and QwtScaleDraw::setAlignment().
Referenced by QwtPlot::setAxisScaleDraw().
const QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) | const |
scaleDraw of this scale
Definition at line 339 of file qwt_scale_widget.cpp.
Referenced by alignment(), QwtPlot::axisScaleDraw(), QwtPlotLayout::minimumSizeHint(), QwtPlot::printScale(), and QwtPlot::sizeHint().
QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) |
scaleDraw of this scale
Definition at line 348 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setLabelAlignment | ( | Qt::Alignment | alignment | ) |
Change the alignment for the labels.
Definition at line 298 of file qwt_scale_widget.cpp.
References layoutScale().
Referenced by QwtPlot::setAxisLabelAlignment().
void QwtScaleWidget::setLabelRotation | ( | double | rotation | ) |
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().
Definition at line 310 of file qwt_scale_widget.cpp.
References layoutScale().
Referenced by QwtPlot::setAxisLabelRotation().
QSize QwtScaleWidget::sizeHint | ( | ) | const [virtual] |
Definition at line 689 of file qwt_scale_widget.cpp.
References minimumSizeHint().
QSize QwtScaleWidget::minimumSizeHint | ( | ) | const [virtual] |
Definition at line 697 of file qwt_scale_widget.cpp.
References dimForLength(), and getBorderDistHint().
Referenced by QwtPlotLayout::minimumSizeHint(), sizeHint(), and QwtPlot::sizeHint().
int QwtScaleWidget::titleHeightForWidth | ( | int | width | ) | const |
Find the height of the title for a given width.
width | Width |
Definition at line 732 of file qwt_scale_widget.cpp.
Referenced by dimForLength().
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.
length | width for horizontal, height for vertical scales | |
scaleFont | Font of the scale |
Definition at line 746 of file qwt_scale_widget.cpp.
References titleHeightForWidth().
Referenced by minimumSizeHint().
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.
painter | Painter | |
align | Alignment | |
rect | Bounding rectangle |
Definition at line 621 of file qwt_scale_widget.cpp.
References QwtText::draw(), and QwtText::setRenderFlags().
Referenced by draw(), and QwtPlot::printScale().
void QwtScaleWidget::setAlignment | ( | QwtScaleDraw::Alignment | alignment | ) |
Change the alignment
alignment | New alignment |
Definition at line 186 of file qwt_scale_widget.cpp.
References layoutScale().
QwtScaleDraw::Alignment QwtScaleWidget::alignment | ( | ) | const |
Definition at line 217 of file qwt_scale_widget.cpp.
References QwtScaleDraw::alignment(), and scaleDraw().
void QwtScaleWidget::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
void QwtScaleWidget::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
void QwtScaleWidget::draw | ( | QPainter * | p | ) | const [protected] |
draw the scale
Definition at line 427 of file qwt_scale_widget.cpp.
References drawTitle().
Referenced by paintEvent().
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 681 of file qwt_scale_widget.cpp.
References layoutScale().
void QwtScaleWidget::layoutScale | ( | bool | update = true |
) | [protected] |
Recalculate the scale's geometry and layout based on.
Definition at line 551 of file qwt_scale_widget.cpp.
References getBorderDistHint().
Referenced by resizeEvent(), scaleChange(), setAlignment(), setBorderDist(), setLabelAlignment(), setLabelRotation(), setMargin(), setPenWidth(), setScaleDiv(), setScaleDraw(), setSpacing(), and setTitle().