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

An abstract base class for slider widgets with a scale 更多...

#include <qwt_abstract_slider.h>

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

class  PrivateData
 

Public 槽

void setValue (double value)
 Set the slider value (English only)
 

信号

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
 

Public 成员函数

 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 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)
 
virtual void wheelEvent (QWheelEvent *) override
 Handle wheel events (English only)
 
virtual bool isScrollPosition (const QPoint &pos) const =0
 
virtual double scrolledTo (const QPoint &pos) const =0
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (English only)
 
virtual void scaleChange () override
 Handle scale changes (English only)
 
virtual void sliderChange ()
 Handle slider changes (English only)
 
double incrementedValue (double value, int stepCount) const
 Calculate incremented value (English only)
 
- Protected 成员函数 继承自 QwtAbstractScale
virtual void changeEvent (QEvent *) override
 Handle change events (English only)
 
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)
 

属性

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
 

详细描述

An abstract base class for slider widgets with a scale

A slider widget displays a value according to a scale. The class is designed as a common super class for widgets like QwtKnob, QwtDial and QwtSlider. When the slider is not readOnly(), its value can be modified by keyboard, mouse and wheel inputs. The range of the slider is divided into a number of steps from which the value increments according to user inputs depend. Only for linear scales the number of steps correspond with a fixed step size.

构造及析构函数说明

◆ QwtAbstractSlider()

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

Constructor for QwtAbstractSlider (English only)

Constructor for QwtAbstractSlider

The scale is initialized to [0.0, 100.0], the number of steps is set to 100 with 1 and 10 as single and page step sizes. Step alignment is enabled. The initial value is invalid.

参数
parentParent widget

Destructor for QwtAbstractSlider

成员函数说明

◆ incrementedValue()

double QwtAbstractSlider::incrementedValue ( double  value,
int  stepCount 
) const
protected

Calculate incremented value (English only)

Increment a value

参数
valueValue to increment
stepCountNumber of steps
返回
Incremented value
参见
incrementValue(), setTotalSteps()

◆ incrementValue()

void QwtAbstractSlider::incrementValue ( int  stepCount)
protected

Increment the value by a number of steps (English only)

Increment the slider

The step size depends on the number of totalSteps()

参数
stepCountNumber of steps
参见
setTotalSteps(), incrementedValue()

◆ invertedControls()

bool QwtAbstractSlider::invertedControls ( ) const

Return whether controls are inverted (English only)

Check if controls are inverted

返回
True, when the controls are inverted
参见
setInvertedControls()

◆ isReadOnly()

bool QwtAbstractSlider::isReadOnly ( ) const

Return whether the slider is read-only (English only)

Check if read-only mode is enabled

返回
True if read-only mode is enabled
参见
setReadOnly()

◆ isScrollPosition()

virtual bool QwtAbstractSlider::isScrollPosition ( const QPoint &  pos) const
protectedpure virtual

QwtDial, QwtKnob , 以及 QwtSlider 内被实现.

◆ isTracking()

bool QwtAbstractSlider::isTracking ( ) const

Return whether tracking is enabled (English only)

Check if tracking is enabled

返回
True if tracking is enabled
参见
setTracking()

◆ isValid()

bool QwtAbstractSlider::isValid ( ) const

Return whether the slider is valid (English only)

Check if the value is valid

返回
True if the value is invalid

◆ keyPressEvent()

void QwtAbstractSlider::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Handle key press events (English only)

Handle key press events

QwtAbstractSlider handles the following keys:

  • Qt::Key_Left: Add/Subtract singleSteps() in direction to lowerBound()
  • Qt::Key_Right: Add/Subtract singleSteps() in direction to upperBound()
  • Qt::Key_Down: Subtract singleSteps(), when invertedControls() is false
  • Qt::Key_Up: Add singleSteps(), when invertedControls() is false
  • Qt::Key_PageDown: Subtract pageSteps(), when invertedControls() is false
  • Qt::Key_PageUp: Add pageSteps(), when invertedControls() is false
  • Qt::Key_Home: Set the value to the minimum()
  • Qt::Key_End: Set the value to the maximum()
    参数
    eventKey event
    参见
    isReadOnly(), wheelEvent()

QwtCompass 重载.

◆ mouseMoveEvent()

void QwtAbstractSlider::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse move events (English only)

Handle mouse move events

参数
eventMouse event

Updates the slider value while scrolling.

参见
mousePressEvent(), mouseReleaseEvent()

◆ mousePressEvent()

void QwtAbstractSlider::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse press events (English only)

Handle mouse press events

参数
eventMouse event

Initiates scrolling if the position is valid.

参见
mouseMoveEvent(), mouseReleaseEvent()

QwtSlider 重载.

◆ mouseReleaseEvent()

void QwtAbstractSlider::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse release events (English only)

Handle mouse release events

参数
eventMouse event

Ends scrolling and emits valueChanged() if needed.

参见
mousePressEvent(), mouseMoveEvent()

QwtSlider 重载.

◆ pageSteps()

uint QwtAbstractSlider::pageSteps ( ) const

Return the number of page steps (English only)

Return the number of page steps

返回
Number of steps
参见
setPageSteps(), totalSteps(), singleSteps()

◆ scaleChange()

void QwtAbstractSlider::scaleChange ( )
overrideprotectedvirtual

Handle scale changes (English only)

Update the slider according to modifications of the scale

Updates the current value to stay within the new scale range and emits valueChanged() if the value was adjusted.

参见
sliderChange(), valueChanged()

重载 QwtAbstractScale .

QwtDial , 以及 QwtSlider 重载.

◆ scrolledTo()

virtual double QwtAbstractSlider::scrolledTo ( const QPoint &  pos) const
protectedpure virtual

QwtDial, QwtKnob , 以及 QwtSlider 内被实现.

◆ setInvertedControls()

void QwtAbstractSlider::setInvertedControls ( bool  on)

Set whether controls are inverted (English only)

Invert wheel and key events

Usually scrolling the mouse wheel "up" and using keys like page up will increase the slider's value towards its maximum. When invertedControls() is enabled the value is scrolled towards its minimum. Inverting the controls might be f.e. useful for a vertical slider with an inverted scale (decreasing from top to bottom).

参数
onInvert controls when true
参见
invertedControls(), keyEvent(), wheelEvent()

◆ setPageSteps()

void QwtAbstractSlider::setPageSteps ( uint  stepCount)

Set the number of page steps (English only)

Set the number of page steps

The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.

参数
[in]stepCountNumber of steps
参见
pageSteps(), setTotalSteps(), setSingleSteps()

◆ setReadOnly()

void QwtAbstractSlider::setReadOnly ( bool  on)

Set whether the slider is read-only (English only)

Enable or disable read-only mode

In read-only mode the slider can't be controlled by mouse or keyboard.

参数
onEnables read-only mode if true
参见
isReadOnly()
警告
The focus policy is set to Qt::StrongFocus or Qt::NoFocus

◆ setSingleSteps()

void QwtAbstractSlider::setSingleSteps ( uint  stepCount)

Set the number of single steps (English only)

Set the number of steps for a single increment

The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.

参数
[in]stepCountNumber of steps
参见
singleSteps(), setTotalSteps(), setPageSteps()

◆ setStepAlignment()

void QwtAbstractSlider::setStepAlignment ( bool  on)

Set whether step alignment is enabled (English only)

Enable step alignment

When step alignment is enabled values resulting from slider movements are aligned to the step size.

参数
onEnable step alignment when true
参见
stepAlignment()

◆ setTotalSteps()

void QwtAbstractSlider::setTotalSteps ( uint  stepCount)

Set the total number of steps (English only)

Set the number of steps

The range of the slider is divided into a number of steps from which the value increments according to user inputs depend. The default setting is 100.

参数
[in]stepCountNumber of steps
参见
totalSteps(), setSingleSteps(), setPageSteps()

◆ setTracking()

void QwtAbstractSlider::setTracking ( bool  on)

Set whether tracking is enabled (English only)

Enable or disable tracking

If tracking is enabled, the slider emits the valueChanged() signal while the movable part of the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal only when the user releases the slider. Tracking is enabled by default.

参数
onTrue to enable tracking, false to disable
参见
isTracking(), sliderMoved()

◆ setValid()

void QwtAbstractSlider::setValid ( bool  on)

Set whether the slider is valid (English only)

Set the value to be valid or invalid

参数
onWhen true, the value is invalidated
参见
setValue()

◆ setValue

void QwtAbstractSlider::setValue ( double  value)
slot

Set the slider value (English only)

Set the slider to the specified value

参数
valueNew value
参见
setValid(), sliderChange(), valueChanged()

◆ setWrapping()

void QwtAbstractSlider::setWrapping ( bool  on)

Set whether wrapping is enabled (English only)

Enable or disable wrapping

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

参数
onEnable wrapping when true
参见
wrapping()

◆ singleSteps()

uint QwtAbstractSlider::singleSteps ( ) const

Return the number of single steps (English only)

Return the number of single steps

返回
Number of steps
参见
setSingleSteps(), totalSteps(), pageSteps()

◆ sliderChange()

void QwtAbstractSlider::sliderChange ( )
protectedvirtual

Handle slider changes (English only)

Handle slider changes

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

参见
setValue(), incrementValue()

QwtDial 重载.

◆ sliderMoved

void QwtAbstractSlider::sliderMoved ( double  value)
signal

Signal emitted when the user moves the slider with the mouse

参数
valueNew value
参见
valueChanged()

◆ stepAlignment()

bool QwtAbstractSlider::stepAlignment ( ) const

Return whether step alignment is enabled (English only)

Check if step alignment is enabled

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

◆ totalSteps()

uint QwtAbstractSlider::totalSteps ( ) const

Return the total number of steps (English only)

Return the number of steps

返回
Number of steps
参见
setTotalSteps(), singleSteps(), pageSteps()

◆ value()

double QwtAbstractSlider::value ( ) const

Return the current value (English only)

Return the current value

返回
Current slider value
参见
setValue()

◆ valueChanged

void QwtAbstractSlider::valueChanged ( double  value)
signal

Notify a change of value

When tracking is enabled (default setting), this signal will be emitted every time the value changes.

参数
valueNew value
参见
setTracking(), sliderMoved()

◆ wheelEvent()

void QwtAbstractSlider::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

Handle wheel events (English only)

Handle wheel events

In/decreases the value by a number of steps. The direction depends on the invertedControls() property. When the control or shift modifier is pressed the wheel delta (divided by 120) is mapped to an increment according to pageSteps(). Otherwise it is mapped to singleSteps().

参数
eventWheel event
参见
keyPressEvent()

QwtDial 重载.

◆ wrapping()

bool QwtAbstractSlider::wrapping ( ) const

Return whether wrapping is enabled (English only)

Check if wrapping is enabled

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

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