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

The Wheel Widget 更多...

#include <qwt_wheel.h>

类 QwtWheel 继承关系图:

class  PrivateData
 

Public 槽

void setValue (double)
 Set a new value without adjusting to the step raster
 
void setTotalAngle (double)
 Set the total angle which the wheel can be turned.
 
void setViewAngle (double)
 Specify the visible portion of the wheel
 
void setMass (double)
 Set the slider's mass for flywheel effect
 

信号

void valueChanged (double value)
 Notify a change of value
 
void wheelPressed ()
 Signal emitted when the user presses the wheel with the mouse
 
void wheelReleased ()
 Signal emitted when the user releases the mouse
 
void wheelMoved (double value)
 Signal emitted when the user moves the wheel with the mouse
 

Public 成员函数

 QwtWheel (QWidget *parent=nullptr)
 Constructor
 
 ~QwtWheel () override
 Destructor
 
double value () const
 Return the current value
 
void setOrientation (Qt::Orientation)
 Set the wheel orientation
 
Qt::Orientation orientation () const
 Return the orientation
 
double totalAngle () const
 Return the total angle
 
double viewAngle () const
 Return the view angle
 
void setTickCount (int)
 Set the number of ticks
 
int tickCount () const
 Return the number of ticks
 
void setWheelWidth (int)
 Set the wheel width
 
int wheelWidth () const
 Return the wheel width
 
void setWheelBorderWidth (int)
 Set the wheel border width
 
int wheelBorderWidth () const
 Return the wheel border width
 
void setBorderWidth (int)
 Set the outer border width
 
int borderWidth () const
 Return the outer border width
 
void setFlatStyle (bool)
 Set flat style
 
bool flatStyle () const
 Return flat style
 
void setInverted (bool)
 Set inverted appearance
 
bool isInverted () const
 Return whether the wheel is inverted
 
void setWrapping (bool)
 Set wrapping mode
 
bool wrapping () const
 Return whether wrapping is enabled
 
void setSingleStep (double)
 Set single step size
 
double singleStep () const
 Return single step size
 
void setPageStepCount (int)
 Set page step count
 
int pageStepCount () const
 Return page step count
 
void setStepAlignment (bool on)
 Set step alignment
 
bool stepAlignment () const
 Return whether step alignment is enabled
 
void setRange (double min, double max)
 Set value range
 
void setMinimum (double)
 Set minimum value
 
double minimum () const
 Return minimum value
 
void setMaximum (double)
 Set maximum value
 
double maximum () const
 Return maximum value
 
void setUpdateInterval (int)
 Set update interval
 
int updateInterval () const
 Return update interval
 
void setTracking (bool)
 Set tracking mode
 
bool isTracking () const
 Return whether tracking is enabled
 
double mass () const
 Return mass for flywheel effect
 

Protected 成员函数

virtual void paintEvent (QPaintEvent *) override
 Qt Paint Event
 
virtual void mousePressEvent (QMouseEvent *) override
 Mouse press event handler
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Mouse Release Event handler
 
virtual void mouseMoveEvent (QMouseEvent *) override
 Mouse Move Event handler
 
virtual void keyPressEvent (QKeyEvent *) override
 Handle key events
 
virtual void wheelEvent (QWheelEvent *) override
 Handle wheel events
 
virtual void timerEvent (QTimerEvent *) override
 Qt timer event
 
void stopFlying ()
 Stop the flying movement of the wheel
 
QRect wheelRect () const
 
virtual QSize sizeHint () const override
 Return the size hint
 
virtual QSize minimumSizeHint () const override
 Return the minimum size hint
 
virtual void drawTicks (QPainter *, const QRectF &)
 Draw the Wheel's ticks
 
virtual void drawWheelBackground (QPainter *, const QRectF &)
 Draw the Wheel's background gradient
 
virtual double valueAt (const QPoint &) const
 Determine the value corresponding to a specified point
 

属性

Qt::Orientation orientation
 
double value
 
double minimum
 
double maximum
 
double singleStep
 
int pageStepCount
 
bool stepAlignment
 
bool tracking
 
bool wrapping
 
bool inverted
 
double mass
 
int updateInterval
 
double totalAngle
 
double viewAngle
 
int tickCount
 
int wheelWidth
 
int borderWidth
 
int wheelBorderWidth
 
bool flatStyle
 

详细描述

The Wheel Widget

The wheel widget can be used to change values over a very large range in very small steps. Using the setMass() member, it can be configured as a flying wheel. The default range of the wheel is [0.0, 100.0]

参见
The radio example.

成员函数说明

◆ borderWidth()

int QwtWheel::borderWidth ( ) const

Return the outer border width

返回
Border width
参见
setBorderWidth()

◆ drawTicks()

void QwtWheel::drawTicks ( QPainter *  painter,
const QRectF &  rect 
)
protectedvirtual

Draw the Wheel's ticks

参数
painterPainter
rectGeometry for the wheel

◆ drawWheelBackground()

void QwtWheel::drawWheelBackground ( QPainter *  painter,
const QRectF &  rect 
)
protectedvirtual

Draw the Wheel's background gradient

参数
painterPainter
rectGeometry for the wheel

◆ flatStyle()

bool QwtWheel::flatStyle ( ) const

Return flat style

Return whether flat style is enabled

参见
setFlatStyle()

◆ isInverted()

bool QwtWheel::isInverted ( ) const

Return whether the wheel is inverted

返回
True when the wheel is inverted
参见
setInverted()

◆ isTracking()

bool QwtWheel::isTracking ( ) const

Return whether tracking is enabled

返回
True, when tracking is enabled
参见
setTracking(), valueChanged(), wheelMoved()

◆ keyPressEvent()

void QwtWheel::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Handle key events

  • Qt::Key_Home
    Step to minimum()
  • Qt::Key_End
    Step to maximum()
  • Qt::Key_Up
    In case of a horizontal or not inverted vertical wheel the value will be incremented by the step size. For an inverted vertical wheel the value will be decremented by the step size.
  • Qt::Key_Down
    In case of a horizontal or not inverted vertical wheel the value will be decremented by the step size. For an inverted vertical wheel the value will be incremented by the step size.
  • Qt::Key_PageUp
    The value will be incremented by pageStepSize() * singleStepSize().
  • Qt::Key_PageDown
    The value will be decremented by pageStepSize() * singleStepSize().
参数
eventKey event

◆ mass()

double QwtWheel::mass ( ) const

Return mass for flywheel effect

Return the mass for flywheel effect

返回
Mass in kg
参见
setMass()

◆ maximum()

double QwtWheel::maximum ( ) const

Return maximum value

Return the maximum of the range

返回
Maximum value
参见
setRange(), setMaximum(), minimum()

◆ minimum()

double QwtWheel::minimum ( ) const

Return minimum value

Return the minimum of the range

返回
Minimum value
参见
setRange(), setMinimum(), maximum()

◆ minimumSizeHint()

QSize QwtWheel::minimumSizeHint ( ) const
overrideprotectedvirtual

Return the minimum size hint

返回
Minimum size hint
警告
The return value is based on the wheel width.

◆ mouseMoveEvent()

void QwtWheel::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse Move Event handler

Turn the wheel according to the mouse position

参数
eventMouse event

◆ mousePressEvent()

void QwtWheel::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse press event handler

Start movement of the wheel.

参数
eventMouse event

◆ mouseReleaseEvent()

void QwtWheel::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse Release Event handler

When the wheel has no mass the movement of the wheel stops, otherwise it starts flying.

参数
eventMouse event

◆ orientation()

Qt::Orientation QwtWheel::orientation ( ) const

Return the orientation

返回
Orientation
参见
setOrientation()

◆ pageStepCount()

int QwtWheel::pageStepCount ( ) const

Return page step count

Return the page step count

返回
Page step count
参见
setPageStepCount(), singleStep()

◆ paintEvent()

void QwtWheel::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Qt Paint Event

参数
eventPaint event

◆ setBorderWidth()

void QwtWheel::setBorderWidth ( int  width)

Set the outer border width

Set the border width

The border defaults to 2.

参数
widthBorder width
参见
borderWidth()

◆ setFlatStyle()

void QwtWheel::setFlatStyle ( bool  on)

Set flat style

When enabled (default), the wheel is drawn with flat colors instead of 3D embossed effects.

参数
ontrue for flat style, false for classic 3D style
参见
flatStyle()

◆ setInverted()

void QwtWheel::setInverted ( bool  on)

Set inverted appearance

En/Disable inverted appearance

An inverted wheel increases its values in the opposite direction. The direction of an inverted horizontal wheel will be from right to left, an inverted vertical wheel will increase from bottom to top.

参数
[in]onEn/Disable inverted appearance
参见
isInverted()

◆ setMass

void QwtWheel::setMass ( double  mass)
slot

Set the slider's mass for flywheel effect

If the slider's mass is greater than 0, it will continue to move after the mouse button has been released. Its speed decreases with time at a rate depending on the slider's mass. A large mass means that it will continue to move for a long time. Derived widgets may overload this function to make it public.

参数
[in]massNew mass in kg
警告
If the mass is smaller than 1g, it is set to zero. The maximal mass is limited to 100kg.
参见
mass()

◆ setMaximum()

void QwtWheel::setMaximum ( double  value)

Set maximum value

Set the maximum value of the range

参数
[in]valueMaximum value
参见
setRange(), setMinimum(), maximum()

◆ setMinimum()

void QwtWheel::setMinimum ( double  value)

Set minimum value

Set the minimum value of the range

参数
[in]valueMinimum value
参见
setRange(), setMaximum(), minimum()
注解
The maximum is adjusted if necessary to ensure that the range remains valid.

◆ setOrientation()

void QwtWheel::setOrientation ( Qt::Orientation  orientation)

Set the wheel orientation

Set the wheel's orientation

The default orientation is Qt::Horizontal.

参数
[in]orientationQt::Horizontal or Qt::Vertical
参见
orientation()

◆ setPageStepCount()

void QwtWheel::setPageStepCount ( int  count)

Set page step count

Set the page step count

pageStepCount is a multiplicator for the single step size that typically corresponds to the user pressing PageUp or PageDown. A value of 0 disables page stepping. The default value is 1.

参数
[in]countMultiplicator for the single step size
参见
pageStepCount(), setSingleStep()

◆ setRange()

void QwtWheel::setRange ( double  min,
double  max 
)

Set value range

Set the minimum and maximum values

The maximum is adjusted if necessary to ensure that the range remains valid. The value might be modified to be inside of the range.

参数
[in]minMinimum value
[in]maxMaximum value
参见
minimum(), maximum()

◆ setSingleStep()

void QwtWheel::setSingleStep ( double  stepSize)

Set single step size

Set the step size of the counter

A value <= 0.0 disables stepping.

参数
[in]stepSizeSingle step size
参见
singleStep(), setPageStepCount()

◆ setStepAlignment()

void QwtWheel::setStepAlignment ( bool  on)

Set step alignment

En/Disable step alignment

When step alignment is enabled, value changes initiated by user input (mouse, keyboard, wheel) are aligned to multiples of the single step.

参数
[in]onOn/Off
参见
stepAlignment(), setSingleStep()

◆ setTickCount()

void QwtWheel::setTickCount ( int  count)

Set the number of ticks

Adjust the number of grooves in the wheel's surface.

The number of grooves is limited to 6 <= count <= 50. Values outside this range will be clipped. The default value is 10.

参数
countNumber of grooves per 360 degrees
参见
tickCount()

◆ setTotalAngle

void QwtWheel::setTotalAngle ( double  angle)
slot

Set the total angle which the wheel can be turned.

One full turn of the wheel corresponds to an angle of 360 degrees. A total angle of n*360 degrees means that the wheel has to be turned n times around its axis to get from the minimum value to the maximum value.

The default setting of the total angle is 360 degrees.

参数
angletotal angle in degrees
参见
totalAngle()

◆ setTracking()

void QwtWheel::setTracking ( bool  enable)

Set tracking mode

En/Disable tracking

If tracking is enabled (the default), the wheel emits the valueChanged() signal while the wheel is moving. If tracking is disabled, the wheel emits the valueChanged() signal only when the wheel movement is terminated.

The wheelMoved() signal is emitted regardless id tracking is enabled or not.

参数
enableOn/Off
参见
isTracking()

◆ setUpdateInterval()

void QwtWheel::setUpdateInterval ( int  interval)

Set update interval

Specify the update interval when the wheel is flying

Default and minimum value is 50 ms.

参数
intervalInterval in milliseconds
参见
updateInterval(), setMass(), setTracking()

◆ setValue

void QwtWheel::setValue ( double  value)
slot

Set a new value without adjusting to the step raster

参数
[in]valueNew value
参见
value(), valueChanged()
警告
The value is clipped when it lies outside the range.

◆ setViewAngle

void QwtWheel::setViewAngle ( double  angle)
slot

Specify the visible portion of the wheel

You may use this function for fine-tuning the appearance of the wheel. The default value is 175 degrees. The value is limited from 10 to 175 degrees.

参数
[in]angleVisible angle in degrees
参见
viewAngle(), setTotalAngle()

◆ setWheelBorderWidth()

void QwtWheel::setWheelBorderWidth ( int  borderWidth)

Set the wheel border width

Set the wheel border width of the wheel.

The wheel border must not be smaller than 1 and is limited in dependence on the wheel's size. Values outside the allowed range will be clipped.

The wheel border defaults to 2.

参数
borderWidthBorder width
参见
internalBorder()

◆ setWheelWidth()

void QwtWheel::setWheelWidth ( int  width)

Set the wheel width

Set the width of the wheel

Corresponds to the wheel height for horizontal orientation, and the wheel width for vertical orientation.

参数
[in]widthThe wheel's width
参见
wheelWidth()

◆ setWrapping()

void QwtWheel::setWrapping ( bool  on)

Set wrapping mode

En/Disable wrapping

If wrapping is true, stepping up from maximum() value will take you to the minimum() value and vice versa.

参数
[in]onEn/Disable wrapping
参见
wrapping()

◆ singleStep()

double QwtWheel::singleStep ( ) const

Return single step size

Return the single step size

返回
Single step size
参见
setSingleStep()

◆ sizeHint()

QSize QwtWheel::sizeHint ( ) const
overrideprotectedvirtual

Return the size hint

返回
Size hint

◆ stepAlignment()

bool QwtWheel::stepAlignment ( ) const

Return whether step alignment is enabled

返回
True when step alignment is enabled
参见
setStepAlignment(), singleStep()

◆ tickCount()

int QwtWheel::tickCount ( ) const

Return the number of ticks

返回
Number of grooves in the wheel's surface.
参见
setTickCnt()

◆ timerEvent()

void QwtWheel::timerEvent ( QTimerEvent *  event)
overrideprotectedvirtual

Qt timer event

The flying wheel effect is implemented using a timer

参数
eventTimer event
参见
updateInterval()

◆ totalAngle()

double QwtWheel::totalAngle ( ) const

Return the total angle

返回
Total angle which the wheel can be turned.
参见
setTotalAngle()

◆ updateInterval()

int QwtWheel::updateInterval ( ) const

Return update interval

返回
Update interval when the wheel is flying
参见
setUpdateInterval(), mass(), isTracking()

◆ value()

double QwtWheel::value ( ) const

Return the current value

Return the current value of the wheel

返回
Current value
参见
setValue(), valueChanged()

◆ valueAt()

double QwtWheel::valueAt ( const QPoint &  pos) const
protectedvirtual

Determine the value corresponding to a specified point

参数
posPosition
返回
Value corresponding to pos

◆ valueChanged

void QwtWheel::valueChanged ( double  value)
signal

Notify a change of value

When tracking is enabled this signal will be emitted every time the value changes.

参数
[in]valueNew value
参见
setTracking()

◆ viewAngle()

double QwtWheel::viewAngle ( ) const

Return the view angle

Return the visible portion of the wheel

返回
Visible angle in degrees
参见
setViewAngle(), totalAngle()

◆ wheelBorderWidth()

int QwtWheel::wheelBorderWidth ( ) const

Return the wheel border width

返回
Wheel border width
参见
setWheelBorderWidth()

◆ wheelEvent()

void QwtWheel::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

Handle wheel events

In/Decrement the value

参数
eventWheel event

◆ wheelMoved

void QwtWheel::wheelMoved ( double  value)
signal

Signal emitted when the user moves the wheel with the mouse

参数
[in]valueNew value

◆ wheelRect()

QRect QwtWheel::wheelRect ( ) const
protected
返回
Rectangle of the wheel without the outer border

◆ wheelWidth()

int QwtWheel::wheelWidth ( ) const

Return the wheel width

Return the width of the wheel

返回
Wheel width
参见
setWheelWidth()

◆ wrapping()

bool QwtWheel::wrapping ( ) const

Return whether wrapping is enabled

返回
True when wrapping is set
参见
setWrapping()

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