QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
QwtScaleWidget Class Reference

A Widget which contains a scale. More...

#include <qwt_scale_widget.h>

Inheritance diagram for QwtScaleWidget:

Classes

class  PrivateData
 

Public Types

enum  LayoutFlag { TitleInverted = 1 }
 Layout flags of the title. More...
 
enum  BuiltinActions { ActionNone = 0x00 , ActionWheelZoom = 0x01 , ActionClickPan = 0x02 , ActionAll = 0xFF }
 Built-in actions . More...
 

Signals

void scaleDivChanged ()
 Signal emitted whenever the scale division changes .
 
void requestScaleRangeUpdate (double min, double max)
 Request to change the axis scale division.
 
void selectionChanged (bool selected)
 Signal emitted when the axis selection state changes.
 

Public Member Functions

 QwtScaleWidget (QWidget *parent=nullptr)
 Constructor.
 
 QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=nullptr)
 Constructor with alignment.
 
virtual ~QwtScaleWidget ()
 Destructor.
 
void setTitle (const QString &title)
 Set the title.
 
void setTitle (const QwtText &title)
 Set the title.
 
QwtText title () const
 Get the title.
 
void setLayoutFlag (LayoutFlag, bool on)
 Set a layout flag.
 
bool testLayoutFlag (LayoutFlag) const
 Test a layout flag.
 
void setBorderDist (int dist1, int dist2)
 Set the border distances.
 
int startBorderDist () const
 Get the start border distance.
 
int endBorderDist () const
 Get the end border distance.
 
void getBorderDistHint (int &start, int &end) const
 Get the border distance hint.
 
void getMinBorderDist (int &start, int &end) const
 Get the minimum border distances.
 
void setMinBorderDist (int start, int end)
 Set the minimum border distances.
 
int startMinBorderDist () const
 Get the minimum value for the distances of the scale's endpoints from the widget borders (left or top)
 
int endMinBorderDist () const
 Get the minimum value for the distances of the scale's endpoints from the widget borders (right or bottom)
 
void setMargin (int)
 Set the margin.
 
int margin () const
 Get the margin.
 
void setSpacing (int)
 Set the spacing.
 
int spacing () const
 Get the distance between scale and title.
 
void setEdgeMargin (int offset)
 Set the edge margin (offset between axis and plot canvas)
 
int edgeMargin () const
 Get the edge margin.
 
void setScaleDiv (const QwtScaleDiv &)
 Set the scale division.
 
void setTransformation (QwtTransform *)
 Set the transformation.
 
void setScaleDraw (QwtScaleDraw *)
 Set the scale draw.
 
const QwtScaleDrawscaleDraw () const
 Get the scale draw (const version)
 
QwtScaleDrawscaleDraw ()
 Get the scale draw.
 
void setLabelAlignment (Qt::Alignment)
 Set the label alignment.
 
void setLabelRotation (double rotation)
 Set the label rotation.
 
void setColorBarEnabled (bool)
 Enable/disable the color bar.
 
bool isColorBarEnabled () const
 Check if color bar is enabled.
 
void setColorBarWidth (int)
 Set the color bar width.
 
int colorBarWidth () const
 Get the width of the color bar.
 
void setColorMap (const QwtInterval &, QwtColorMap *)
 Set the color map.
 
QwtInterval colorBarInterval () const
 Get the value interval for the color bar.
 
const QwtColorMapcolorMap () const
 Get the color map.
 
virtual QSize sizeHint () const override
 Get a size hint.
 
virtual QSize minimumSizeHint () const override
 Get a minimum size hint.
 
int titleHeightForWidth (int width) const
 Find the height of the title for a given width.
 
int dimForLength (int length, const QFont &scaleFont) const
 Find the minimum dimension for a given length.
 
void drawColorBar (QPainter *, const QRectF &) const
 Draw the color bar.
 
void drawTitle (QPainter *, QwtScaleDraw::Alignment, const QRectF &rect) const
 Draw the title.
 
void setAlignment (QwtScaleDraw::Alignment)
 Set the alignment.
 
QwtScaleDraw::Alignment alignment () const
 Get the alignment.
 
QRectF colorBarRect (const QRectF &) const
 Calculate the rectangle for the color bar.
 
QRect scaleRect () const
 Get the rectangle for drawing the scale (excluding colorBar, margin, edgeMargin, borderDist)
 
void setTextColor (const QColor &c)
 Set the text color (font color of the coordinate axis)
 
QColor textColor () const
 Get the font color of the coordinate axis.
 
void setScaleColor (const QColor &c)
 Set the scale color (color of the coordinate axis)
 
QColor scaleColor () const
 Get the color of the coordinate axis.
 
void layoutScale (bool update_geometry=true)
 Layout the scale.
 
QwtAxisId axisID () const
 Get the axis ID for this scale widget.
 
bool isXAxis () const
 Check if this is an X axis.
 
bool isYAxis () const
 Check if this is a Y axis.
 
void setBuildinActions (BuiltinActionsFlags acts)
 Enable/disable built-in actions.
 
BuiltinActionsFlags buildinActions () const
 Get the built-in actions flags.
 
bool testBuildinActions (BuiltinActions ba) const
 Test if a built-in action is active.
 
void setSelected (bool selected)
 Set the selected state.
 
bool isSelected () const
 Check if the current axis is selected.
 
void setSelectionColor (const QColor &color)
 Set the selection color.
 
QColor selectionColor () const
 Get the selection color.
 
void setZoomFactor (double factor)
 Set the zoom factor (default 1.2)
 
double zoomFactor () const
 Get the zoom factor.
 
void setSelectedPenWidthOffset (qreal offset=1)
 Set the selected pen width offset.
 
qreal selectedPenWidthOffset () const
 Get the current pen width offset for the axis when it is in selected state.
 
bool isOnScale (const QPoint &pos) const
 Check if a point is on the scale area.
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *) override
 paintEvent
 
virtual void resizeEvent (QResizeEvent *) override
 Event handler for resize events.
 
virtual void changeEvent (QEvent *) override
 Change Event handler.
 
void draw (QPainter *) const
 draw the scale
 
void scaleChange ()
 Notify a change of the scale.
 

Detailed Description

A Widget which contains a scale.

Member Enumeration Documentation

◆ BuiltinActions

Built-in actions .

Enumerator
ActionNone 

No action.

ActionWheelZoom 

Mouse wheel zoom (after clicking to activate the axis, scrolling the wheel zooms the current axis)

ActionClickPan 

Mouse click and drag (after clicking to activate the axis, dragging moves the axis left/right)

ActionAll 

All actions.

◆ LayoutFlag

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.

Constructor & Destructor Documentation

◆ QwtScaleWidget()

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

Constructor.

Create a scale with the position QwtScaleWidget::Left.

Member Function Documentation

◆ alignment()

QwtScaleDraw::Alignment QwtScaleWidget::alignment ( ) const

Get the alignment.

Returns
the alignment

◆ axisID()

QwtAxisId QwtScaleWidget::axisID ( ) const

Get the axis ID for this scale widget.

Returns
the axis ID for this scale widget

◆ buildinActions()

QwtScaleWidget::BuiltinActionsFlags QwtScaleWidget::buildinActions ( ) const

Get the built-in actions flags.

Returns
the built-in actions flags

◆ changeEvent()

void QwtScaleWidget::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Change Event handler.

Parameters
eventChange event

Invalidates internal caches if necessary

◆ colorBarInterval()

QwtInterval QwtScaleWidget::colorBarInterval ( ) const

Get the value interval for the color bar.

Returns
the color bar interval

◆ colorBarRect()

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

Calculate the rectangle for the color bar.

Returns
the rectangle for the color bar

◆ colorBarWidth()

int QwtScaleWidget::colorBarWidth ( ) const

Get the width of the color bar.

Returns
the color bar width

◆ colorMap()

const QwtColorMap * QwtScaleWidget::colorMap ( ) const

Get the color map.

Returns
the color map

◆ dimForLength()

int QwtScaleWidget::dimForLength ( int  length,
const QFont &  scaleFont 
) const

Find the minimum dimension for a given length.

Returns
the dimension required for a given length

◆ drawColorBar()

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

Draw the color bar.

Draw the color bar of the scale widget.

◆ drawTitle()

void QwtScaleWidget::drawTitle ( QPainter *  painter,
QwtScaleDraw::Alignment  align,
const QRectF &  rect 
) const

Draw the title.

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

◆ edgeMargin()

int QwtScaleWidget::edgeMargin ( ) const

Get the edge margin.

Returns
the edge margin

◆ endBorderDist()

int QwtScaleWidget::endBorderDist ( ) const

Get the end border distance.

Returns
the end border distance

◆ endMinBorderDist()

int QwtScaleWidget::endMinBorderDist ( ) const

Get the minimum value for the distances of the scale's endpoints from the widget borders (right or bottom)

Returns
the end minimum border distance

◆ getBorderDistHint()

void QwtScaleWidget::getBorderDistHint ( int &  start,
int &  end 
) const

Get the border distance hint.

Calculate a hint for the border distances.

◆ getMinBorderDist()

void QwtScaleWidget::getMinBorderDist ( int &  start,
int &  end 
) const

Get the minimum border distances.

Get the minimum value for the distances of the scale's endpoints from the widget borders.

◆ isColorBarEnabled()

bool QwtScaleWidget::isColorBarEnabled ( ) const

Check if color bar is enabled.

Returns
true if color bar is enabled

◆ isOnScale()

bool QwtScaleWidget::isOnScale ( const QPoint &  pos) const

Check if a point is on the scale area.

Check if a mouse position falls on the "pure scale area".

◆ isSelected()

bool QwtScaleWidget::isSelected ( ) const

Check if the current axis is selected.

Returns
true if selected

◆ isXAxis()

bool QwtScaleWidget::isXAxis ( ) const

Check if this is an X axis.

Returns
true if this is an X axis

◆ isYAxis()

bool QwtScaleWidget::isYAxis ( ) const

Check if this is a Y axis.

Returns
true if this is a Y axis

◆ layoutScale()

void QwtScaleWidget::layoutScale ( bool  update_geometry = true)

Layout the scale.

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

◆ margin()

int QwtScaleWidget::margin ( ) const

Get the margin.

Returns
the margin

◆ minimumSizeHint()

QSize QwtScaleWidget::minimumSizeHint ( ) const
overridevirtual

Get a minimum size hint.

◆ requestScaleRangeUpdate

void QwtScaleWidget::requestScaleRangeUpdate ( double  min,
double  max 
)
signal

Request to change the axis scale division.

◆ resizeEvent()

void QwtScaleWidget::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Event handler for resize events.

Parameters
eventResize event

◆ scaleChange()

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.

◆ scaleColor()

QColor QwtScaleWidget::scaleColor ( ) const

Get the color of the coordinate axis.

Returns
the scale color

◆ scaleDivChanged

void QwtScaleWidget::scaleDivChanged ( )
signal

Signal emitted whenever the scale division changes .

◆ scaleDraw() [1/2]

QwtScaleDraw * QwtScaleWidget::scaleDraw ( )

Get the scale draw.

Returns
the scale draw

◆ scaleDraw() [2/2]

const QwtScaleDraw * QwtScaleWidget::scaleDraw ( ) const

Get the scale draw (const version)

Returns
the scale draw (const version)

◆ scaleRect()

QRect QwtScaleWidget::scaleRect ( ) const

Get the rectangle for drawing the scale (excluding colorBar, margin, edgeMargin, borderDist)

Returns
the scale rectangle (excluding color bar, margin, edge margin, border distances)

◆ selectedPenWidthOffset()

qreal QwtScaleWidget::selectedPenWidthOffset ( ) const

Get the current pen width offset for the axis when it is in selected state.

Returns
the selected pen width offset

◆ selectionChanged

void QwtScaleWidget::selectionChanged ( bool  selected)
signal

Signal emitted when the axis selection state changes.

◆ selectionColor()

QColor QwtScaleWidget::selectionColor ( ) const

Get the selection color.

Returns
the selection color

◆ setAlignment()

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

Set the alignment.

Change the alignment.

◆ setBorderDist()

void QwtScaleWidget::setBorderDist ( int  dist1,
int  dist2 
)

Set the border distances.

Specify distances of the scale's endpoints from the widget's borders.

◆ setBuildinActions()

void QwtScaleWidget::setBuildinActions ( BuiltinActionsFlags  acts)

Enable/disable built-in actions.

Set the built-in actions.

◆ setColorBarEnabled()

void QwtScaleWidget::setColorBarEnabled ( bool  on)

Enable/disable the color bar.

Enable/disable a color bar associated to the scale.

◆ setColorBarWidth()

void QwtScaleWidget::setColorBarWidth ( int  width)

Set the color bar width.

Set the width of the color bar.

◆ setColorMap()

void QwtScaleWidget::setColorMap ( const QwtInterval interval,
QwtColorMap colorMap 
)

Set the color map.

Set the color map and value interval used for displaying the color bar.

◆ setEdgeMargin()

void QwtScaleWidget::setEdgeMargin ( int  offset)

Set the edge margin (offset between axis and plot canvas)

Set the edge margin (offset between axis and plot canvas edge)

◆ setLabelAlignment()

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

Set the label alignment.

Change the alignment for the labels.

◆ setLabelRotation()

void QwtScaleWidget::setLabelRotation ( double  rotation)

Set the label rotation.

Change the rotation for the labels.

◆ setLayoutFlag()

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

Set a layout flag.

Toggle a layout flag.

◆ setMargin()

void QwtScaleWidget::setMargin ( int  margin)

Set the margin.

Specify the margin to the colorBar/base line.

◆ setMinBorderDist()

void QwtScaleWidget::setMinBorderDist ( int  start,
int  end 
)

Set the minimum border distances.

Set a minimum value for the distances of the scale's endpoints from the widget borders.

◆ setScaleColor()

void QwtScaleWidget::setScaleColor ( const QColor &  c)

Set the scale color (color of the coordinate axis)

Set the color of the coordinate axis.

◆ setScaleDiv()

void QwtScaleWidget::setScaleDiv ( const QwtScaleDiv scaleDiv)

Set the scale division.

Assign a scale division.

◆ setScaleDraw()

void QwtScaleWidget::setScaleDraw ( QwtScaleDraw scaleDraw)

Set the scale draw.

Set a scale draw.

◆ setSelected()

void QwtScaleWidget::setSelected ( bool  selected)

Set the selected state.

◆ setSelectedPenWidthOffset()

void QwtScaleWidget::setSelectedPenWidthOffset ( qreal  offset = 1)

Set the selected pen width offset.

Set the pen width offset for the axis when it is in selected state.

◆ setSelectionColor()

void QwtScaleWidget::setSelectionColor ( const QColor &  color)

Set the selection color.

◆ setSpacing()

void QwtScaleWidget::setSpacing ( int  spacing)

Set the spacing.

Specify the distance between color bar, scale and title.

◆ setTextColor()

void QwtScaleWidget::setTextColor ( const QColor &  c)

Set the text color (font color of the coordinate axis)

Set the font color of the coordinate axis.

◆ setTitle() [1/2]

void QwtScaleWidget::setTitle ( const QString &  title)

Set the title.

Give title new text contents.

◆ setTitle() [2/2]

void QwtScaleWidget::setTitle ( const QwtText title)

Set the title.

Give title new text contents.

◆ setTransformation()

void QwtScaleWidget::setTransformation ( QwtTransform transformation)

Set the transformation.

◆ setZoomFactor()

void QwtScaleWidget::setZoomFactor ( double  factor)

Set the zoom factor (default 1.2)

◆ sizeHint()

QSize QwtScaleWidget::sizeHint ( ) const
overridevirtual

Get a size hint.

◆ spacing()

int QwtScaleWidget::spacing ( ) const

Get the distance between scale and title.

Returns
the spacing

◆ startBorderDist()

int QwtScaleWidget::startBorderDist ( ) const

Get the start border distance.

Returns
the start border distance

◆ startMinBorderDist()

int QwtScaleWidget::startMinBorderDist ( ) const

Get the minimum value for the distances of the scale's endpoints from the widget borders (left or top)

Returns
the start minimum border distance

◆ testBuildinActions()

bool QwtScaleWidget::testBuildinActions ( QwtScaleWidget::BuiltinActions  ba) const

Test if a built-in action is active.

Returns
true if a built-in action is active

◆ testLayoutFlag()

bool QwtScaleWidget::testLayoutFlag ( LayoutFlag  flag) const

Test a layout flag.

Returns
true if a layout flag is set

◆ textColor()

QColor QwtScaleWidget::textColor ( ) const

Get the font color of the coordinate axis.

Returns
the text color

◆ title()

QwtText QwtScaleWidget::title ( ) const

Get the title.

Returns
the title

◆ titleHeightForWidth()

int QwtScaleWidget::titleHeightForWidth ( int  width) const

Find the height of the title for a given width.

Returns
the height required for the title for a given width

◆ zoomFactor()

double QwtScaleWidget::zoomFactor ( ) const

Get the zoom factor.

Returns
the zoom factor

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