Classes | Public Types | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QwtScaleWidget Class Reference

A Widget which contains a scale. More...

#include <qwt_scale_widget.h>

Inheritance diagram for QwtScaleWidget:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  LayoutFlag { TitleInverted = 1 }
 Layout flags of the title. More...
 
typedef QFlags< LayoutFlagLayoutFlags
 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 QwtColorMapcolorMap () 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 *painter, const QRectF &) const
 
void drawTitle (QPainter *painter, 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
 
 QwtScaleWidget (QWidget *parent=NULL)
 Create a scale with the position QwtScaleWidget::Left. More...
 
 QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=NULL)
 Constructor. More...
 
const QwtScaleDrawscaleDraw () const
 
QwtScaleDrawscaleDraw ()
 
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)
 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 &sd)
 Assign a scale division. More...
 
void setScaleDraw (QwtScaleDraw *)
 
void setSpacing (int td)
 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
 
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 *)
 
void draw (QPainter *p) const
 draw the scale More...
 
void layoutScale (bool update=true)
 
virtual void paintEvent (QPaintEvent *)
 paintEvent More...
 
virtual void resizeEvent (QResizeEvent *)
 
void scaleChange ()
 Notify a change of the scale. More...
 

Private Member Functions

void initScale (QwtScaleDraw::Alignment)
 Initialize the scale. More...
 

Private Attributes

PrivateDatad_data
 

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.

Member Typedef Documentation

Layout flags of the title.

Definition at line 49 of file qwt_scale_widget.h.

Member Enumeration Documentation

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 39 of file qwt_scale_widget.h.

Constructor & Destructor Documentation

QwtScaleWidget::QwtScaleWidget ( QWidget *  parent = NULL)
explicit

Create a scale with the position QwtScaleWidget::Left.

Parameters
parentParent widget

Definition at line 65 of file qwt_scale_widget.cpp.

QwtScaleWidget::QwtScaleWidget ( QwtScaleDraw::Alignment  align,
QWidget *  parent = NULL 
)
explicit

Constructor.

Parameters
alignAlignment.
parentParent widget

Definition at line 76 of file qwt_scale_widget.cpp.

QwtScaleWidget::~QwtScaleWidget ( )
virtual

Destructor.

Definition at line 84 of file qwt_scale_widget.cpp.

Member Function Documentation

QwtScaleDraw::Alignment QwtScaleWidget::alignment ( ) const
Returns
position
See also
setPosition()

Definition at line 231 of file qwt_scale_widget.cpp.

void QwtScaleWidget::changeEvent ( QEvent *  event)
protectedvirtual

Change Event handler

Parameters
eventChange event

Invalidates internal caches if necessary

Definition at line 516 of file qwt_scale_widget.cpp.

QwtInterval QwtScaleWidget::colorBarInterval ( ) const
Returns
Value interval for the color bar
See also
setColorMap(), colorMap()

Definition at line 922 of file qwt_scale_widget.cpp.

QRectF QwtScaleWidget::colorBarRect ( const QRectF &  rect) const

Calculate the the rectangle for the color bar

Parameters
rectBounding rectangle for all components of the scale
Returns
Rectangle for the color bar

Definition at line 459 of file qwt_scale_widget.cpp.

int QwtScaleWidget::colorBarWidth ( ) const
Returns
Width of the color bar
See also
setColorBarEnabled(), setColorBarEnabled()

Definition at line 913 of file qwt_scale_widget.cpp.

const QwtColorMap * QwtScaleWidget::colorMap ( ) const
Returns
Color map
See also
setColorMap(), colorBarInterval()

Definition at line 955 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.

Parameters
lengthwidth for horizontal, height for vertical scales
scaleFontFont of the scale
Returns
height for horizontal, width for vertical scales

Definition at line 762 of file qwt_scale_widget.cpp.

void QwtScaleWidget::draw ( QPainter *  p) const
protected

draw the scale

Definition at line 427 of file qwt_scale_widget.cpp.

void QwtScaleWidget::drawColorBar ( QPainter *  painter,
const QRectF &  rect 
) const

Draw the color bar of the scale widget

Parameters
painterPainter
rectBounding rectangle for the color bar
See also
setColorBarEnabled()

Definition at line 604 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.

Parameters
painterPainter
alignAlignment
rectBounding rectangle

Definition at line 624 of file qwt_scale_widget.cpp.

int QwtScaleWidget::endBorderDist ( ) const
Returns
end border distance
See also
setBorderDist()

Definition at line 386 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.

Parameters
startReturn parameter for the border width at the beginning of the scale
endReturn parameter for the border width at the end of the scale
Warning
  • The minimum border distance depends on the font.
See also
setMinBorderDist(), getMinBorderDist(), setBorderDist()

Definition at line 795 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.

Parameters
startReturn parameter for the border width at the beginning of the scale
endReturn parameter for the border width at the end of the scale
See also
setMinBorderDist(), getBorderDistHint()

Definition at line 833 of file qwt_scale_widget.cpp.

void QwtScaleWidget::initScale ( QwtScaleDraw::Alignment  align)
private

Initialize the scale.

Definition at line 90 of file qwt_scale_widget.cpp.

bool QwtScaleWidget::isColorBarEnabled ( ) const
Returns
true, when the color bar is enabled
See also
setColorBarEnabled(), setColorBarWidth()

Definition at line 888 of file qwt_scale_widget.cpp.

void QwtScaleWidget::layoutScale ( bool  update_geometry = true)
protected

Recalculate the scale's geometry and layout based on the current geometry and fonts.

Parameters
update_geometryNotify the layout system and call update to redraw the scale

Definition at line 544 of file qwt_scale_widget.cpp.

int QwtScaleWidget::margin ( ) const
Returns
margin
See also
setMargin()

Definition at line 395 of file qwt_scale_widget.cpp.

QSize QwtScaleWidget::minimumSizeHint ( ) const
virtual
Returns
a minimum size hint

Definition at line 712 of file qwt_scale_widget.cpp.

void QwtScaleWidget::paintEvent ( QPaintEvent *  event)
protectedvirtual

paintEvent

Definition at line 412 of file qwt_scale_widget.cpp.

void QwtScaleWidget::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Event handler for resize events

Parameters
eventResize event

Definition at line 530 of file qwt_scale_widget.cpp.

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

void QwtScaleWidget::scaleDivChanged ( )
signal

Signal emitted, whenever the scale division changes.

const QwtScaleDraw * QwtScaleWidget::scaleDraw ( ) const
Returns
scaleDraw of this scale
See also
setScaleDraw(), QwtScaleDraw::setScaleDraw()

Definition at line 350 of file qwt_scale_widget.cpp.

QwtScaleDraw * QwtScaleWidget::scaleDraw ( )
Returns
scaleDraw of this scale
See also
QwtScaleDraw::setScaleDraw()

Definition at line 359 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setAlignment ( QwtScaleDraw::Alignment  alignment)

Change the alignment

Parameters
alignmentNew alignment
See also
alignment()

Definition at line 206 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.

Parameters
dist1Left or top Distance
dist2Right or bottom distance
See also
borderDist()

Definition at line 247 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setColorBarEnabled ( bool  on)

En/disable a color bar associated to the scale

See also
isColorBarEnabled(), setColorBarWidth()

Definition at line 875 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setColorBarWidth ( int  width)

Set the width of the color bar

Parameters
widthWidth
See also
colorBarWidth(), setColorBarEnabled()

Definition at line 899 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.

Parameters
intervalValue interval
colorMapColor map
See also
colorMap(), colorBarInterval()

Definition at line 936 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setLabelAlignment ( Qt::Alignment  alignment)

Change the alignment for the labels.

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

Definition at line 292 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setLabelRotation ( double  rotation)

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

Parameters
rotationRotation
See also
QwtScaleDraw::setLabelRotation(), setLabelFlags()

Definition at line 305 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setLayoutFlag ( LayoutFlag  flag,
bool  on 
)

Toggle an layout flag

Parameters
flagLayout flag
ontrue/false
See also
testLayoutFlag(), LayoutFlag

Definition at line 140 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setMargin ( int  margin)

Specify the margin to the colorBar/base line.

Parameters
marginMargin
See also
margin()

Definition at line 262 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.

Parameters
startMinimum for the start border
endMinimum for the end border
See also
getMinBorderDist(), getBorderDistHint()

Definition at line 816 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.

Parameters
scaleDivScale Division
See also
For more information about scale divisions, see QwtScaleDiv.

Definition at line 847 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.

Parameters
scaleDrawScaleDraw object
See also
scaleDraw()

Definition at line 322 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setSpacing ( int  spacing)

Specify the distance between color bar, scale and title.

Parameters
spacingSpacing
See also
spacing()

Definition at line 277 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setTitle ( const QString &  title)

Give title new text contents

Parameters
titleNew title
See also
title(), setTitle(const QwtText &);

Definition at line 169 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setTitle ( const QwtText title)

Give title new text contents

Parameters
titleNew title
See also
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 187 of file qwt_scale_widget.cpp.

void QwtScaleWidget::setTransformation ( QwtTransform transformation)

Set the transformation

Parameters
transformationTransformation
See also
QwtAbstractScaleDraw::scaleDraw(), QwtScaleMap

Definition at line 865 of file qwt_scale_widget.cpp.

QSize QwtScaleWidget::sizeHint ( ) const
virtual
Returns
a size hint

Definition at line 704 of file qwt_scale_widget.cpp.

int QwtScaleWidget::spacing ( ) const
Returns
distance between scale and title
See also
setMargin()

Definition at line 404 of file qwt_scale_widget.cpp.

int QwtScaleWidget::startBorderDist ( ) const
Returns
start border distance
See also
setBorderDist()

Definition at line 377 of file qwt_scale_widget.cpp.

bool QwtScaleWidget::testLayoutFlag ( LayoutFlag  flag) const

Test a layout flag

Parameters
flagLayout flag
Returns
true/false
See also
setLayoutFlag(), LayoutFlag

Definition at line 158 of file qwt_scale_widget.cpp.

QwtText QwtScaleWidget::title ( ) const
Returns
title
See also
setTitle()

Definition at line 368 of file qwt_scale_widget.cpp.

int QwtScaleWidget::titleHeightForWidth ( int  width) const

Find the height of the title for a given width.

Parameters
widthWidth
Returns
height Height

Definition at line 748 of file qwt_scale_widget.cpp.

Member Data Documentation

PrivateData* QwtScaleWidget::d_data
private

Definition at line 131 of file qwt_scale_widget.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:19