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

The Slider Widget 更多...

#include <qwt_slider.h>

类 QwtSlider 继承关系图:
QwtAbstractSlider QwtAbstractScale

class  PrivateData
 

Public 类型

enum  ScalePosition { NoScale , LeadingScale , TrailingScale }
 Position of the scale 更多...
 

Public 成员函数

 QwtSlider (QWidget *parent=nullptr)
 Constructor
 
 QwtSlider (Qt::Orientation, QWidget *parent=nullptr)
 Constructor with orientation
 
 ~QwtSlider () override
 Destructor
 
void setOrientation (Qt::Orientation)
 Set orientation
 
Qt::Orientation orientation () const
 Return orientation
 
void setScalePosition (ScalePosition)
 Set scale position
 
ScalePosition scalePosition () const
 Return scale position
 
void setTrough (bool)
 Enable/disable trough
 
bool hasTrough () const
 Check if has trough
 
void setGroove (bool)
 Enable/disable groove
 
bool hasGroove () const
 Check if has groove
 
void setHandleSize (const QSize &)
 Set handle size
 
QSize handleSize () const
 Return handle size
 
void setBorderWidth (int)
 Set border width
 
int borderWidth () const
 Return border width
 
void setSpacing (int)
 Set spacing
 
int spacing () const
 Return spacing
 
void setFlatStyle (bool)
 Set flat style
 
bool flatStyle () const
 Return flat style
 
virtual QSize sizeHint () const override
 Return size hint
 
virtual QSize minimumSizeHint () const override
 Return minimum size hint
 
void setScaleDraw (QwtScaleDraw *)
 Set scale draw
 
const QwtScaleDrawscaleDraw () const
 Return scale draw (const version)
 
void setUpdateInterval (int)
 Set update interval
 
int updateInterval () const
 Return update interval
 
- 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 double scrolledTo (const QPoint &) const override
 Calculate scrolled position
 
virtual bool isScrollPosition (const QPoint &) const override
 Check if position is scroll position
 
virtual void drawSlider (QPainter *, const QRect &) const
 Draw slider
 
virtual void drawHandle (QPainter *, const QRect &, int pos) const
 Draw handle
 
virtual void mousePressEvent (QMouseEvent *) override
 Mouse press event
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Mouse release event
 
virtual void resizeEvent (QResizeEvent *) override
 Resize event
 
virtual void paintEvent (QPaintEvent *) override
 Paint event
 
virtual void changeEvent (QEvent *) override
 Change event
 
virtual void timerEvent (QTimerEvent *) override
 Timer event
 
virtual bool event (QEvent *) override
 Event handler
 
virtual void scaleChange () override
 Scale change notification
 
QRect sliderRect () const
 Return slider rectangle
 
QRect handleRect () const
 Return handle rectangle
 
- Protected 成员函数 继承自 QwtAbstractSlider
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)
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (English only)
 
virtual void sliderChange ()
 Handle slider changes (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)
 

属性

Qt::Orientation orientation
 
ScalePosition scalePosition
 
bool trough
 
bool groove
 
QSize handleSize
 
int borderWidth
 
int spacing
 
bool flatStyle
 
- 属性 继承自 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
 

详细描述

The Slider Widget

QwtSlider is a slider widget which operates on an interval of type double. Its position is related to a scale showing the current value. The slider can be customized by having a through, a groove - or both.

成员枚举类型说明

◆ ScalePosition

Position of the scale

参见
QwtSlider(), setScalePosition(), setOrientation()
枚举值
NoScale 

The slider has no scale

LeadingScale 

The scale is right of a vertical or below a horizontal slider

TrailingScale 

The scale is left of a vertical or above a horizontal slider

构造及析构函数说明

◆ QwtSlider() [1/2]

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

Constructor

Construct vertical slider in QwtSlider::Trough style

Construct vertical slider in QwtSlider::Trough style with a scale to the left. The scale is initialized to [0.0, 100.0] and the value set to 0.0.

参数
parentParent widget
参见
setOrientation(), setScalePosition()

◆ QwtSlider() [2/2]

QwtSlider::QwtSlider ( Qt::Orientation  orientation,
QWidget *  parent = nullptr 
)
explicit

Constructor with orientation

Construct a slider in QwtSlider::Trough style

Construct a slider in QwtSlider::Trough style. When orientation is Qt::Vertical the scale will be aligned to the left, otherwise at the top of the slider. The scale is initialized to [0.0, 100.0] and the value set to 0.0.

参数
parentParent widget
orientationOrientation of the slider
参见
setOrientation(), setScalePosition()

◆ ~QwtSlider()

QwtSlider::~QwtSlider ( )
override

Destructor

参见
QwtSlider()

成员函数说明

◆ borderWidth()

int QwtSlider::borderWidth ( ) const

Return border width

Return the border width

参见
setBorderWidth()

◆ changeEvent()

void QwtSlider::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Change event

重载 QwtAbstractScale .

◆ flatStyle()

bool QwtSlider::flatStyle ( ) const

Return flat style

Return whether flat style is enabled

参见
setFlatStyle()

◆ handleSize()

QSize QwtSlider::handleSize ( ) const

Return handle size

Return size of the handle

参见
setHandleSize()

◆ hasGroove()

bool QwtSlider::hasGroove ( ) const

Check if has groove

Return true when the groove is visible

参见
setGroove(), hasTrough()

◆ hasTrough()

bool QwtSlider::hasTrough ( ) const

Check if has trough

Return true when the trough is visible

参见
setTrough(), hasGroove()

◆ isScrollPosition()

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

Check if position is scroll position

实现了 QwtAbstractSlider.

◆ minimumSizeHint()

QSize QwtSlider::minimumSizeHint ( ) const
overridevirtual

Return minimum size hint

参见
sizeHint()

◆ mousePressEvent()

void QwtSlider::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse press event

重载 QwtAbstractSlider .

◆ mouseReleaseEvent()

void QwtSlider::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse release event

重载 QwtAbstractSlider .

◆ orientation()

Qt::Orientation QwtSlider::orientation ( ) const

Return orientation

参见
setOrientation()

◆ scaleChange()

void QwtSlider::scaleChange ( )
overrideprotectedvirtual

Scale change notification

重载 QwtAbstractSlider .

◆ scaleDraw()

const QwtScaleDraw * QwtSlider::scaleDraw ( ) const

Return scale draw (const version)

Return the scale draw of the slider (const version)

参见
setScaleDraw()

◆ scalePosition()

QwtSlider::ScalePosition QwtSlider::scalePosition ( ) const

Return scale position

Return position of the scale

参见
setScalePosition()

◆ scrolledTo()

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

Calculate scrolled position

实现了 QwtAbstractSlider.

◆ setBorderWidth()

void QwtSlider::setBorderWidth ( int  width)

Set border width

Change the slider's border width

The border width is used for drawing the slider handle and the trough.

参数
widthBorder width
参见
borderWidth()

◆ setFlatStyle()

void QwtSlider::setFlatStyle ( bool  on)

Set flat style

When enabled (default), the slider is drawn with flat colors instead of 3D embossed effects (qDrawShadePanel/qDrawShadeLine).

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

◆ setGroove()

void QwtSlider::setGroove ( bool  on)

Enable/disable groove

En/Disable the groove

The slider can be customized by showing a groove for the handle.

参数
onWhen true, the groove is visible
参见
hasGroove(), setTrough()

◆ setHandleSize()

void QwtSlider::setHandleSize ( const QSize &  size)

Set handle size

Set the slider's handle size

When the size is empty the slider handle will be painted with a default size depending on its orientation().

参数
sizeNew size
参见
handleSize()

◆ setOrientation()

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

Set orientation

Set the orientation

参数
orientationAllowed values are Qt::Horizontal and Qt::Vertical
参见
orientation(), scalePosition()

◆ setScaleDraw()

void QwtSlider::setScaleDraw ( QwtScaleDraw scaleDraw)

Set scale draw

Set a scale draw

For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label().

参数
scaleDrawScaleDraw object that has to be created with new and will be deleted in ~QwtSlider() or the next call of setScaleDraw()
参见
scaleDraw()

◆ setScalePosition()

void QwtSlider::setScalePosition ( ScalePosition  scalePosition)

Set scale position

Change the position of the scale

参数
scalePositionPosition of the scale
参见
ScalePosition, scalePosition()

◆ setSpacing()

void QwtSlider::setSpacing ( int  spacing)

Set spacing

Change the spacing between trough and scale

A spacing of 0 means that the backbone of the scale is covered by the trough. The default setting is 4 pixels.

参数
spacingNumber of pixels
参见
spacing()

◆ setTrough()

void QwtSlider::setTrough ( bool  on)

Enable/disable trough

En/Disable the trough

The slider can be customized by showing a trough for the handle.

参数
onWhen true, the trough is visible
参见
hasTrough(), setGroove()

◆ setUpdateInterval()

void QwtSlider::setUpdateInterval ( int  interval)

Set update interval

Specify the update interval for automatic scrolling

The minimal accepted value is 50 ms.

参数
intervalUpdate interval in milliseconds
参见
updateInterval()

◆ sizeHint()

QSize QwtSlider::sizeHint ( ) const
overridevirtual

Return size hint

返回
minimumSizeHint()
参见
minimumSizeHint()

◆ spacing()

int QwtSlider::spacing ( ) const

Return spacing

Return number of pixels between slider and scale

参见
setSpacing()

◆ updateInterval()

int QwtSlider::updateInterval ( ) const

Return update interval

Return update interval in milliseconds for automatic scrolling

参见
setUpdateInterval()

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