QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | Protected 成员函数 | 属性 | 所有成员列表
QwtDial类 参考

QwtDial class provides a rounded range control 更多...

#include <qwt_dial.h>

类 QwtDial 继承关系图:
QwtAbstractSlider QwtAbstractScale QwtAnalogClock QwtCompass

class  PrivateData
 

Public 类型

enum  Shadow { Plain = QFrame::Plain , Raised = QFrame::Raised , Sunken = QFrame::Sunken }
 Frame shadow 更多...
 
enum  Mode { RotateNeedle , RotateScale }
 Mode controlling whether the needle or the scale is rotating 更多...
 

Public 成员函数

 QwtDial (QWidget *parent=nullptr)
 Constructor
 
 ~QwtDial () override
 Destructor
 
void setFrameShadow (Shadow)
 Set the frame shadow
 
Shadow frameShadow () const
 Return the frame shadow
 
void setLineWidth (int)
 Set the line width
 
int lineWidth () const
 Return the line width
 
void setMode (Mode)
 Set the mode
 
Mode mode () const
 Return the mode
 
void setScaleArc (double minArc, double maxArc)
 Set the scale arc range
 
void setMinScaleArc (double)
 Set the minimum scale arc
 
double minScaleArc () const
 Return the minimum scale arc
 
void setMaxScaleArc (double)
 Set the maximum scale arc
 
double maxScaleArc () const
 Return the maximum scale arc
 
virtual void setOrigin (double)
 Set the origin
 
double origin () const
 Return the origin
 
void setNeedle (QwtDialNeedle *)
 Set the needle
 
const QwtDialNeedleneedle () const
 Return the needle (const version)
 
QwtDialNeedleneedle ()
 Return the needle
 
QRect boundingRect () const
 Return the bounding rectangle
 
QRect innerRect () const
 Return the inner rectangle
 
virtual QRect scaleInnerRect () const
 Return the scale inner rectangle
 
virtual QSize sizeHint () const override
 Return the size hint
 
virtual QSize minimumSizeHint () const override
 Return the minimum size hint
 
void setScaleDraw (QwtRoundScaleDraw *)
 Set the scale draw
 
QwtRoundScaleDrawscaleDraw ()
 Return the scale draw
 
const QwtRoundScaleDrawscaleDraw () const
 Return the scale draw (const version)
 
- Public 成员函数 继承自 QwtAbstractSlider
 QwtAbstractSlider (QWidget *parent=nullptr)
 Constructor for QwtAbstractSlider (English only)
 
 ~QwtAbstractSlider () override
 Destructor for QwtAbstractSlider (English only)
 
void setValid (bool)
 Set whether the slider is valid (English only)
 
bool isValid () const
 Return whether the slider is valid (English only)
 
double value () const
 Return the current value (English only)
 
void setWrapping (bool)
 Set whether wrapping is enabled (English only)
 
bool wrapping () const
 Return whether wrapping is enabled (English only)
 
void setTotalSteps (uint)
 Set the total number of steps (English only)
 
uint totalSteps () const
 Return the total number of steps (English only)
 
void setSingleSteps (uint)
 Set the number of single steps (English only)
 
uint singleSteps () const
 Return the number of single steps (English only)
 
void setPageSteps (uint)
 Set the number of page steps (English only)
 
uint pageSteps () const
 Return the number of page steps (English only)
 
void setStepAlignment (bool)
 Set whether step alignment is enabled (English only)
 
bool stepAlignment () const
 Return whether step alignment is enabled (English only)
 
void setTracking (bool)
 Set whether tracking is enabled (English only)
 
bool isTracking () const
 Return whether tracking is enabled (English only)
 
void setReadOnly (bool)
 Set whether the slider is read-only (English only)
 
bool isReadOnly () const
 Return whether the slider is read-only (English only)
 
void setInvertedControls (bool)
 Set whether controls are inverted (English only)
 
bool invertedControls () const
 Return whether controls are inverted (English only)
 
- Public 成员函数 继承自 QwtAbstractScale
 QwtAbstractScale (QWidget *parent=nullptr)
 Constructor for QwtAbstractScale
 
void setScale (double lowerBound, double upperBound)
 Specify a scale by interval bounds
 
void setScale (const QwtInterval &)
 Specify a scale by interval
 
void setScale (const QwtScaleDiv &)
 Specify a scale by scale division
 
const QwtScaleDivscaleDiv () const
 Return the scale division
 
void setLowerBound (double value)
 Set the lower bound of the scale
 
double lowerBound () const
 Return the lower bound of the scale
 
void setUpperBound (double value)
 Set the upper bound of the scale
 
double upperBound () const
 Return the upper bound of the scale
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating scale division
 
double scaleStepSize () const
 Return the step size hint
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals
 
int scaleMaxMinor () const
 Return the maximum number of minor tick intervals
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals
 
int scaleMaxMajor () const
 Return the maximum number of major tick intervals
 
void setScaleEngine (QwtScaleEngine *)
 Set the scale engine
 
const QwtScaleEnginescaleEngine () const
 Return the scale engine (const version)
 
QwtScaleEnginescaleEngine ()
 Return the scale engine (non-const version)
 
int transform (double) const
 Transform a scale value to widget coordinates
 
double invTransform (int) const
 Transform a widget coordinate to scale value
 
bool isInverted () const
 Check if scale is inverted
 
double minimum () const
 Return the minimum boundary
 
double maximum () const
 Return the maximum boundary
 
const QwtScaleMapscaleMap () const
 Return the scale map
 

Protected 成员函数

virtual void wheelEvent (QWheelEvent *) override
 Wheel Event handler
 
virtual void paintEvent (QPaintEvent *) override
 Paint the dial
 
virtual void changeEvent (QEvent *) override
 Change Event handler
 
virtual void drawFrame (QPainter *)
 Draw the frame around the dial
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame
 
virtual void drawFocusIndicator (QPainter *) const
 Draw the focus indicator
 
void invalidateCache ()
 Invalidate the internal caches used to speed up repainting
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 Draw the scale
 
virtual void drawScaleContents (QPainter *painter, const QPointF &center, double radius) const
 Draw the contents inside the scale
 
virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
 Draw the needle
 
virtual double scrolledTo (const QPoint &) const override
 Determine the value for a new position of the slider handle.
 
virtual bool isScrollPosition (const QPoint &) const override
 Determine what to do when the user presses a mouse button.
 
virtual void sliderChange () override
 Handle slider changes (English only)
 
virtual void scaleChange () override
 Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
 
- Protected 成员函数 继承自 QwtAbstractSlider
virtual void mousePressEvent (QMouseEvent *) override
 Handle mouse press events (English only)
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Handle mouse release events (English only)
 
virtual void mouseMoveEvent (QMouseEvent *) override
 Handle mouse move events (English only)
 
virtual void keyPressEvent (QKeyEvent *) override
 Handle key press events (English only)
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (English only)
 
double incrementedValue (double value, int stepCount) const
 Calculate incremented value (English only)
 
- Protected 成员函数 继承自 QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate scale and update scale draw (English only)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set the scale draw object (English only)
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 Return the scale draw (const version) (English only)
 
QwtAbstractScaleDrawabstractScaleDraw ()
 Return the scale draw (non-const version) (English only)
 
void updateScaleDraw ()
 Update the scale draw (English only)
 

属性

int lineWidth
 
Shadow frameShadow
 
Mode mode
 
double origin
 
double minScaleArc
 
double maxScaleArc
 
- 属性 继承自 QwtAbstractSlider
double value
 
uint totalSteps
 
uint singleSteps
 
uint pageSteps
 
bool stepAlignment
 
bool readOnly
 
bool tracking
 
bool wrapping
 
bool invertedControls
 
- 属性 继承自 QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

额外继承的成员函数

- Public 槽 继承自 QwtAbstractSlider
void setValue (double value)
 Set the slider value (English only)
 
- 信号 继承自 QwtAbstractSlider
void valueChanged (double value)
 Notify a change of value
 
void sliderPressed ()
 Signal emitted when the user presses the movable part of the slider
 
void sliderReleased ()
 Signal emitted when the user releases the movable part of the slider
 
void sliderMoved (double value)
 Signal emitted when the user moves the slider with the mouse
 

详细描述

QwtDial class provides a rounded range control

QwtDial is intended as base class for dial widgets like speedometers, compass widgets, clocks... A dial contains a scale and a needle indicating the current value of the dial. Depending on Mode one of them is fixed and the other is rotating. If not isReadOnly() the dial can be rotated by dragging the mouse or using keyboard inputs (see QwtAbstractSlider::keyPressEvent()). A dial might be wrapping, what means a rotation below/above one limit continues on the other limit (f.e compass). The scale might cover any arc of the dial, its values are related to the origin() of the dial. Often dials have to be updated very often according to values from external devices. For these high refresh rates QwtDial caches as much as possible. For derived classes it might be necessary to clear these caches manually according to attribute changes using invalidateCache().

参见
QwtCompass, QwtAnalogClock, QwtDialNeedle
注解
The controls and dials examples shows different types of dials.
QDial is more similar to QwtKnob than to QwtDial

成员枚举类型说明

◆ Mode

Mode controlling whether the needle or the scale is rotating

枚举值
RotateNeedle 

The needle is rotating

RotateScale 

The needle is fixed, the scales are rotating

◆ Shadow

Frame shadow

Unfortunately it is not possible to use QFrame::Shadow as a property of a widget that is not derived from QFrame. The following enum is made for the designer only. It is safe to use QFrame::Shadow instead.

枚举值
Plain 

QFrame::Plain

Raised 

QFrame::Raised

Sunken 

QFrame::Sunken

构造及析构函数说明

◆ QwtDial()

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

Constructor

Create a dial widget with no needle. The scale is initialized to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ). The origin of the scale is at 90°, The value is set to 0.0. The default mode is QwtDial::RotateNeedle.

参数
parentParent widget

Destructor

成员函数说明

◆ boundingRect()

QRect QwtDial::boundingRect ( ) const

Return the bounding rectangle

Return bounding rectangle of the dial including the frame

参见
setLineWidth(), scaleInnerRect(), innerRect()

◆ changeEvent()

void QwtDial::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Change Event handler

参数
eventChange event

Invalidates internal paint caches if necessary

重载 QwtAbstractScale .

◆ drawContents()

void QwtDial::drawContents ( QPainter *  painter) const
protectedvirtual

Draw the contents inside the frame

QPalette::Window is the background color outside of the frame. QPalette::Base is the background color inside the frame. QPalette::WindowText is the background color inside the scale.

参数
painterPainter
参见
boundingRect(), innerRect(), scaleInnerRect(), QWidget::setPalette()

◆ drawFocusIndicator()

void QwtDial::drawFocusIndicator ( QPainter *  painter) const
protectedvirtual

Draw the focus indicator

参数
painterPainter

◆ drawFrame()

void QwtDial::drawFrame ( QPainter *  painter)
protectedvirtual

Draw the frame around the dial

参数
painterPainter
参见
lineWidth(), frameShadow()

◆ drawNeedle()

void QwtDial::drawNeedle ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  colorGroup 
) const
protectedvirtual

Draw the needle

参数
painterPainter
centerCenter of the dial
radiusLength for the needle
directionDirection of the needle in degrees, counter clockwise
colorGroupColorGroup

QwtAnalogClock 重载.

◆ drawScale()

void QwtDial::drawScale ( QPainter *  painter,
const QPointF &  center,
double  radius 
) const
protectedvirtual

Draw the scale

参数
painterPainter
centerCenter of the dial
radiusRadius of the scale

◆ drawScaleContents()

void QwtDial::drawScaleContents ( QPainter *  painter,
const QPointF &  center,
double  radius 
) const
protectedvirtual

Draw the contents inside the scale

Paints nothing.

参数
painterPainter
centerCenter of the contents circle
radiusRadius of the contents circle

QwtCompass 重载.

◆ frameShadow()

QwtDial::Shadow QwtDial::frameShadow ( ) const

Return the frame shadow

Return frame shadow

参见
setFrameShadow(), lineWidth(), QFrame::frameShadow()

◆ innerRect()

QRect QwtDial::innerRect ( ) const

Return the inner rectangle

Return bounding rectangle of the circle inside the frame

参见
setLineWidth(), scaleInnerRect(), boundingRect()

◆ isScrollPosition()

bool QwtDial::isScrollPosition ( const QPoint &  pos) const
overrideprotectedvirtual

Determine what to do when the user presses a mouse button.

参数
posMouse position
返回值
True,whenthe inner circle contains pos
参见
scrolledTo()

实现了 QwtAbstractSlider.

◆ lineWidth()

int QwtDial::lineWidth ( ) const

Return the line width

Return line width of the frame

参见
setLineWidth(), frameShadow(), lineWidth()

◆ maxScaleArc()

double QwtDial::maxScaleArc ( ) const

Return the maximum scale arc

Return upper limit of the scale arc

参见
setScaleArc()

◆ minimumSizeHint()

QSize QwtDial::minimumSizeHint ( ) const
overridevirtual

Return the minimum size hint

Return minimum size hint

参见
sizeHint()

◆ minScaleArc()

double QwtDial::minScaleArc ( ) const

Return the minimum scale arc

Return lower limit of the scale arc

参见
setScaleArc()

◆ mode()

QwtDial::Mode QwtDial::mode ( ) const

Return the mode

Return mode of the dial

参见
setMode(), origin(), setScaleArc(), value()

◆ needle() [1/2]

QwtDialNeedle * QwtDial::needle ( )

Return the needle

Return needle

参见
setNeedle()

◆ needle() [2/2]

const QwtDialNeedle * QwtDial::needle ( ) const

Return the needle (const version)

Return needle

参见
setNeedle()

◆ origin()

double QwtDial::origin ( ) const

Return the origin

The origin is the angle where scale and needle is relative to

返回
Origin of the dial
参见
setOrigin()

◆ paintEvent()

void QwtDial::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Paint the dial

参数
eventPaint event

◆ scaleChange()

void QwtDial::scaleChange ( )
overrideprotectedvirtual

Invalidate the internal caches and call QwtAbstractSlider::scaleChange()

重载 QwtAbstractSlider .

◆ scaleDraw()

const QwtRoundScaleDraw * QwtDial::scaleDraw ( ) const

Return the scale draw (const version)

Return the scale draw

◆ scaleInnerRect()

QRect QwtDial::scaleInnerRect ( ) const
virtual

Return the scale inner rectangle

Return rectangle inside the scale

参见
setLineWidth(), boundingRect(), innerRect()

◆ scrolledTo()

double QwtDial::scrolledTo ( const QPoint &  pos) const
overrideprotectedvirtual

Determine the value for a new position of the slider handle.

参数
posMouse position
返回
Value for the mouse position
参见
isScrollPosition()

实现了 QwtAbstractSlider.

◆ setFrameShadow()

void QwtDial::setFrameShadow ( Shadow  shadow)

Set the frame shadow

Sets the frame shadow value from the frame style

参数
shadowFrame shadow
参见
setLineWidth(), QFrame::setFrameShadow()

◆ setLineWidth()

void QwtDial::setLineWidth ( int  lineWidth)

Set the line width

Sets the line width of the frame

参数
lineWidthLine width
参见
setFrameShadow()

◆ setMaxScaleArc()

void QwtDial::setMaxScaleArc ( double  max)

Set the maximum scale arc

Set the upper limit for the scale arc

参数
maxUpper limit of the scale arc
参见
setScaleArc(), setMinScaleArc()

◆ setMinScaleArc()

void QwtDial::setMinScaleArc ( double  min)

Set the minimum scale arc

Set the lower limit for the scale arc

参数
minLower limit of the scale arc
参见
setScaleArc(), setMaxScaleArc()

◆ setMode()

void QwtDial::setMode ( Mode  mode)

Set the mode

Change the mode of the dial

In case of QwtDial::RotateNeedle the needle is rotating, in case of QwtDial::RotateScale, the needle points to origin() and the scale is rotating. The default mode is QwtDial::RotateNeedle.

参数
modeNew mode
参见
mode(), setValue(), setOrigin()

◆ setNeedle()

void QwtDial::setNeedle ( QwtDialNeedle needle)

Set the needle

Set a needle for the dial

参数
needleNeedle
警告
The needle will be deleted, when a different needle is set or in ~QwtDial()

◆ setOrigin()

void QwtDial::setOrigin ( double  origin)
virtual

Set the origin

Change the origin

The origin is the angle where scale and needle is relative to.

参数
originNew origin
参见
origin()

◆ setScaleArc()

void QwtDial::setScaleArc ( double  minArc,
double  maxArc 
)

Set the scale arc range

Change the arc of the scale

参数
minArcLower limit
maxArcUpper limit
参见
minScaleArc(), maxScaleArc()

◆ setScaleDraw()

void QwtDial::setScaleDraw ( QwtRoundScaleDraw scaleDraw)

Set the scale draw

Set an individual scale draw

The motivation for setting a scale draw is often to overload QwtRoundScaleDraw::label() to return individual tick labels.

参数
scaleDrawScale draw
警告
The previous scale draw is deleted

◆ sizeHint()

QSize QwtDial::sizeHint ( ) const
overridevirtual

Return the size hint

Return size hint

参见
minimumSizeHint()

◆ sliderChange()

void QwtDial::sliderChange ( )
overrideprotectedvirtual

Handle slider changes (English only)

Handle slider changes

Called when the slider needs to update its appearance. The default implementation calls update().

参见
setValue(), incrementValue()

重载 QwtAbstractSlider .

◆ wheelEvent()

void QwtDial::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

Wheel Event handler

参数
eventWheel event

重载 QwtAbstractSlider .


该类的文档由以下文件生成: