Qwt User's Guide
svn
|
#include <qwt_scale_widget.h>
Public Types | |
enum | LayoutFlag { TitleInverted = 1 } |
typedef QFlags< LayoutFlag > | LayoutFlags |
Signals | |
void | scaleDivChanged () |
Public Member Functions | |
QwtScaleDraw::Alignment | alignment () const |
QwtInterval | colorBarInterval () const |
QRectF | colorBarRect (const QRectF &) const |
int | colorBarWidth () const |
const QwtColorMap * | colorMap () const |
int | dimForLength (int length, const QFont &scaleFont) const |
void | drawColorBar (QPainter *painter, const QRectF &) const |
void | drawTitle (QPainter *painter, QwtScaleDraw::Alignment, const QRectF &rect) const |
int | endBorderDist () const |
void | getBorderDistHint (int &start, int &end) const |
void | getMinBorderDist (int &start, int &end) const |
bool | isColorBarEnabled () const |
int | margin () const |
virtual QSize | minimumSizeHint () const |
QwtScaleWidget (QWidget *parent=NULL) | |
QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=NULL) | |
const QwtScaleDraw * | scaleDraw () const |
QwtScaleDraw * | scaleDraw () |
void | setAlignment (QwtScaleDraw::Alignment) |
void | setBorderDist (int start, int end) |
void | setColorBarEnabled (bool) |
void | setColorBarWidth (int) |
void | setColorMap (const QwtInterval &, QwtColorMap *) |
void | setLabelAlignment (Qt::Alignment) |
void | setLabelRotation (double rotation) |
void | setLayoutFlag (LayoutFlag, bool on) |
void | setMargin (int) |
void | setMinBorderDist (int start, int end) |
void | setScaleDiv (QwtScaleTransformation *, const QwtScaleDiv &sd) |
void | setScaleDraw (QwtScaleDraw *) |
void | setSpacing (int td) |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
virtual QSize | sizeHint () const |
int | spacing () const |
int | startBorderDist () const |
bool | testLayoutFlag (LayoutFlag) const |
QwtText | title () const |
int | titleHeightForWidth (int width) const |
virtual | ~QwtScaleWidget () |
Protected Member Functions | |
void | draw (QPainter *p) const |
void | layoutScale (bool update=true) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | resizeEvent (QResizeEvent *) |
void | scaleChange () |
A Widget which contains a scale.
This Widget can be used to decorate composite widgets with a scale.
typedef QFlags<LayoutFlag> QwtScaleWidget::LayoutFlags |
Layout flags of the title.
QwtScaleWidget::QwtScaleWidget | ( | QWidget * | parent = NULL | ) | [explicit] |
Create a scale with the position QwtScaleWidget::Left.
parent | Parent widget |
QwtScaleWidget::QwtScaleWidget | ( | QwtScaleDraw::Alignment | align, |
QWidget * | parent = NULL |
||
) | [explicit] |
Constructor.
align | Alignment. |
parent | Parent widget |
QwtScaleWidget::~QwtScaleWidget | ( | ) | [virtual] |
Destructor.
QwtScaleDraw::Alignment QwtScaleWidget::alignment | ( | ) | const |
QwtInterval QwtScaleWidget::colorBarInterval | ( | ) | const |
QRectF QwtScaleWidget::colorBarRect | ( | const QRectF & | rect | ) | const |
Calculate the the rectangle for the color bar
rect | Bounding rectangle for all components of the scale |
int QwtScaleWidget::colorBarWidth | ( | ) | const |
const QwtColorMap * QwtScaleWidget::colorMap | ( | ) | const |
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 |
void QwtScaleWidget::draw | ( | QPainter * | p | ) | const [protected] |
draw the scale
void QwtScaleWidget::drawColorBar | ( | QPainter * | painter, |
const QRectF & | rect | ||
) | const |
Draw the color bar of the scale widget
painter | Painter |
rect | Bounding rectangle for the color bar |
void QwtScaleWidget::drawTitle | ( | QPainter * | painter, |
QwtScaleDraw::Alignment | align, | ||
const QRectF & | rect | ||
) | const |
Rotate and paint a title according to its position into a given rectangle.
painter | Painter |
align | Alignment |
rect | Bounding rectangle |
int QwtScaleWidget::endBorderDist | ( | ) | const |
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.
void QwtScaleWidget::getMinBorderDist | ( | int & | start, |
int & | end | ||
) | const |
Get the minimum value for the distances of the scale's endpoints from the widget borders.
bool QwtScaleWidget::isColorBarEnabled | ( | ) | const |
void QwtScaleWidget::layoutScale | ( | bool | update_geometry = true | ) | [protected] |
Recalculate the scale's geometry and layout based on the current rect and fonts.
update_geometry | Notify the layout system and call update to redraw the scale |
int QwtScaleWidget::margin | ( | ) | const |
QSize QwtScaleWidget::minimumSizeHint | ( | ) | const [virtual] |
void QwtScaleWidget::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
paintEvent
void QwtScaleWidget::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Event handler for resize event
event | Resize event |
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.
void QwtScaleWidget::scaleDivChanged | ( | ) | [signal] |
Signal emitted, whenever the scale divison changes.
const QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) | const |
scaleDraw of this scale
QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) |
scaleDraw of this scale
void QwtScaleWidget::setAlignment | ( | QwtScaleDraw::Alignment | alignment | ) |
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 |
void QwtScaleWidget::setColorBarEnabled | ( | bool | on | ) |
En/disable a color bar associated to the scale
void QwtScaleWidget::setColorBarWidth | ( | int | width | ) |
Set the width of the color bar
width | Width |
void QwtScaleWidget::setColorMap | ( | const QwtInterval & | interval, |
QwtColorMap * | colorMap | ||
) |
Set the color map and value interval, that are used for displaying the color bar.
interval | Value interval |
colorMap | Color map |
void QwtScaleWidget::setLabelAlignment | ( | Qt::Alignment | alignment | ) |
Change the alignment for the labels.
void QwtScaleWidget::setLabelRotation | ( | double | rotation | ) |
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().
rotation | Rotation |
void QwtScaleWidget::setLayoutFlag | ( | LayoutFlag | flag, |
bool | on | ||
) |
Toggle an layout flag
flag | Layout flag |
on | true/false |
void QwtScaleWidget::setMargin | ( | int | margin | ) |
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.
start | Minimum for the start border |
end | Minimum for the end border |
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 |
void QwtScaleWidget::setScaleDraw | ( | QwtScaleDraw * | sd | ) |
Set a scale draw sd has to be created with new and will be deleted in ~QwtScaleWidget() or the next call of setScaleDraw().
sd | ScaleDraw object |
void QwtScaleWidget::setSpacing | ( | int | spacing | ) |
Specify the distance between color bar, scale and title.
spacing | Spacing |
void QwtScaleWidget::setTitle | ( | const QString & | title | ) |
Give title new text contents
title | New title |
void QwtScaleWidget::setTitle | ( | const QwtText & | title | ) |
Give title new text contents
title | New title |
QSize QwtScaleWidget::sizeHint | ( | ) | const [virtual] |
int QwtScaleWidget::spacing | ( | ) | const |
int QwtScaleWidget::startBorderDist | ( | ) | const |
bool QwtScaleWidget::testLayoutFlag | ( | LayoutFlag | flag | ) | const |
Test a layout flag
flag | Layout flag |
QwtText QwtScaleWidget::title | ( | ) | const |
int QwtScaleWidget::titleHeightForWidth | ( | int | width | ) | const |
Find the height of the title for a given width.
width | Width |