A Widget which contains a scale. More...
#include <qwt_scale_widget.h>
Classes | |
class | PrivateData |
Public Types | |
enum | LayoutFlag { TitleInverted = 1 } |
Layout flags of the title. More... | |
Signals | |
void | scaleDivChanged () |
Signal emitted, whenever the scale division changes. More... | |
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 |
Find the minimum dimension for a given length. dim is the height, length the width seen in direction of the title. More... | |
void | drawColorBar (QPainter *, const QRectF &) const |
void | drawTitle (QPainter *, QwtScaleDraw::Alignment, const QRectF &rect) const |
int | endBorderDist () const |
void | getBorderDistHint (int &start, int &end) const |
Calculate a hint for the border distances. More... | |
void | getMinBorderDist (int &start, int &end) const |
bool | isColorBarEnabled () const |
int | margin () const |
virtual QSize | minimumSizeHint () const QWT_OVERRIDE |
QwtScaleWidget (QWidget *parent=NULL) | |
Create a scale with the position QwtScaleWidget::Left. More... | |
QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=NULL) | |
Constructor. More... | |
QwtScaleDraw * | scaleDraw () |
const QwtScaleDraw * | scaleDraw () const |
void | setAlignment (QwtScaleDraw::Alignment) |
void | setBorderDist (int dist1, int dist2) |
void | setColorBarEnabled (bool) |
void | setColorBarWidth (int) |
void | setColorMap (const QwtInterval &, QwtColorMap *) |
void | setLabelAlignment (Qt::Alignment) |
Change the alignment for the labels. More... | |
void | setLabelRotation (double rotation) |
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation(). More... | |
void | setLayoutFlag (LayoutFlag, bool on) |
void | setMargin (int) |
Specify the margin to the colorBar/base line. More... | |
void | setMinBorderDist (int start, int end) |
void | setScaleDiv (const QwtScaleDiv &) |
Assign a scale division. More... | |
void | setScaleDraw (QwtScaleDraw *) |
void | setSpacing (int) |
Specify the distance between color bar, scale and title. More... | |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
void | setTransformation (QwtTransform *) |
virtual QSize | sizeHint () const QWT_OVERRIDE |
int | spacing () const |
int | startBorderDist () const |
bool | testLayoutFlag (LayoutFlag) const |
QwtText | title () const |
int | titleHeightForWidth (int width) const |
Find the height of the title for a given width. More... | |
virtual | ~QwtScaleWidget () |
Destructor. More... | |
Protected Member Functions | |
virtual void | changeEvent (QEvent *) QWT_OVERRIDE |
void | draw (QPainter *) const |
draw the scale More... | |
void | layoutScale (bool update_geometry=true) |
virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
paintEvent More... | |
virtual void | resizeEvent (QResizeEvent *) QWT_OVERRIDE |
void | scaleChange () |
Notify a change of the scale. More... | |
Private Member Functions | |
void | initScale (QwtScaleDraw::Alignment) |
Initialize the scale. More... | |
Private Attributes | |
PrivateData * | m_data |
A Widget which contains a scale.
This Widget can be used to decorate composite widgets with a scale.
Definition at line 34 of file qwt_scale_widget.h.
Layout flags of the title.
Enumerator | |
---|---|
TitleInverted | The title of vertical scales is painted from top to bottom. Otherwise it is painted from bottom to top. |
Definition at line 40 of file qwt_scale_widget.h.
|
explicit |
Create a scale with the position QwtScaleWidget::Left.
parent | Parent widget |
Definition at line 68 of file qwt_scale_widget.cpp.
|
explicit |
Constructor.
align | Alignment. |
parent | Parent widget |
Definition at line 79 of file qwt_scale_widget.cpp.
|
virtual |
Destructor.
Definition at line 86 of file qwt_scale_widget.cpp.
QwtScaleDraw::Alignment QwtScaleWidget::alignment | ( | ) | const |
|
protectedvirtual |
Change Event handler
event | Change event |
Invalidates internal caches if necessary
Definition at line 520 of file qwt_scale_widget.cpp.
QwtInterval QwtScaleWidget::colorBarInterval | ( | ) | const |
Definition at line 942 of file qwt_scale_widget.cpp.
QRectF QwtScaleWidget::colorBarRect | ( | const QRectF & | rect | ) | const |
Calculate the the rectangle for the color bar
rect | Bounding rectangle for all components of the scale |
Definition at line 463 of file qwt_scale_widget.cpp.
int QwtScaleWidget::colorBarWidth | ( | ) | const |
Definition at line 933 of file qwt_scale_widget.cpp.
const QwtColorMap * QwtScaleWidget::colorMap | ( | ) | const |
Definition at line 975 of file qwt_scale_widget.cpp.
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 782 of file qwt_scale_widget.cpp.
|
protected |
draw the scale
Definition at line 431 of file qwt_scale_widget.cpp.
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 |
Definition at line 625 of file qwt_scale_widget.cpp.
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 |
Definition at line 645 of file qwt_scale_widget.cpp.
int QwtScaleWidget::endBorderDist | ( | ) | const |
Definition at line 390 of file qwt_scale_widget.cpp.
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.
start | Return parameter for the border width at the beginning of the scale |
end | Return parameter for the border width at the end of the scale |
Definition at line 815 of file qwt_scale_widget.cpp.
void QwtScaleWidget::getMinBorderDist | ( | int & | start, |
int & | end | ||
) | const |
Get the minimum value for the distances of the scale's endpoints from the widget borders.
start | Return parameter for the border width at the beginning of the scale |
end | Return parameter for the border width at the end of the scale |
Definition at line 853 of file qwt_scale_widget.cpp.
|
private |
Initialize the scale.
Definition at line 92 of file qwt_scale_widget.cpp.
bool QwtScaleWidget::isColorBarEnabled | ( | ) | const |
Definition at line 908 of file qwt_scale_widget.cpp.
|
protected |
Recalculate the scale's geometry and layout based on the current geometry and fonts.
update_geometry | Notify the layout system and call update to redraw the scale |
Definition at line 548 of file qwt_scale_widget.cpp.
int QwtScaleWidget::margin | ( | ) | const |
|
virtual |
Definition at line 733 of file qwt_scale_widget.cpp.
|
protectedvirtual |
paintEvent
Definition at line 416 of file qwt_scale_widget.cpp.
|
protectedvirtual |
Event handler for resize events
event | Resize event |
Definition at line 534 of file qwt_scale_widget.cpp.
|
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 717 of file qwt_scale_widget.cpp.
|
signal |
Signal emitted, whenever the scale division changes.
QwtScaleDraw* QwtScaleWidget::scaleDraw | ( | ) |
QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) | const |
Definition at line 354 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setAlignment | ( | QwtScaleDraw::Alignment | alignment | ) |
Change the alignment
alignment | New alignment |
Definition at line 209 of file qwt_scale_widget.cpp.
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 251 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setColorBarEnabled | ( | bool | on | ) |
En/disable a color bar associated to the scale
Definition at line 895 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setColorBarWidth | ( | int | width | ) |
Set the width of the color bar
width | Width |
Definition at line 919 of file qwt_scale_widget.cpp.
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 |
Definition at line 956 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setLabelAlignment | ( | Qt::Alignment | alignment | ) |
Change the alignment for the labels.
Definition at line 296 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setLabelRotation | ( | double | rotation | ) |
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().
rotation | Rotation |
Definition at line 309 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setLayoutFlag | ( | LayoutFlag | flag, |
bool | on | ||
) |
Toggle an layout flag
flag | Layout flag |
on | true/false |
Definition at line 141 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setMargin | ( | int | margin | ) |
Specify the margin to the colorBar/base line.
margin | Margin |
Definition at line 266 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.
start | Minimum for the start border |
end | Minimum for the end border |
Definition at line 836 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setScaleDiv | ( | const QwtScaleDiv & | scaleDiv | ) |
Assign a scale division.
The scale division determines where to set the tick marks.
scaleDiv | Scale Division |
Definition at line 867 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setScaleDraw | ( | QwtScaleDraw * | scaleDraw | ) |
Set a scale draw
scaleDraw has to be created with new and will be deleted in ~QwtScaleWidget() or the next call of setScaleDraw(). scaleDraw will be initialized with the attributes of the previous scaleDraw object.
scaleDraw | ScaleDraw object |
Definition at line 326 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setSpacing | ( | int | spacing | ) |
Specify the distance between color bar, scale and title.
spacing | Spacing |
Definition at line 281 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setTitle | ( | const QString & | title | ) |
Give title new text contents
title | New title |
Definition at line 172 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setTitle | ( | const QwtText & | title | ) |
Give title new text contents
title | New title |
Definition at line 190 of file qwt_scale_widget.cpp.
void QwtScaleWidget::setTransformation | ( | QwtTransform * | transformation | ) |
Set the transformation
transformation | Transformation |
Definition at line 885 of file qwt_scale_widget.cpp.
|
virtual |
Definition at line 725 of file qwt_scale_widget.cpp.
int QwtScaleWidget::spacing | ( | ) | const |
Definition at line 408 of file qwt_scale_widget.cpp.
int QwtScaleWidget::startBorderDist | ( | ) | const |
Definition at line 381 of file qwt_scale_widget.cpp.
bool QwtScaleWidget::testLayoutFlag | ( | LayoutFlag | flag | ) | const |
Test a layout flag
flag | Layout flag |
Definition at line 161 of file qwt_scale_widget.cpp.
QwtText QwtScaleWidget::title | ( | ) | const |
int QwtScaleWidget::titleHeightForWidth | ( | int | width | ) | const |
Find the height of the title for a given width.
width | Width |
Definition at line 768 of file qwt_scale_widget.cpp.
|
private |
Definition at line 131 of file qwt_scale_widget.h.