QDial Class Reference

[ QtGui module]

The QDial class provides a rounded range control (like a speedometer or potentiometer). 更多...

继承 QAbstractSlider .

方法


详细描述

The QDial class provides a rounded range control (like a speedometer or potentiometer).

QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the dialog layout needs a square widget.

Since QDial inherits from QAbstractSlider , the dial behaves in a similar way to a slider 。当 wrapping () is false (the default setting) there is no real difference between a slider and a dial. They both share the same signals, slots and member functions. Which one you use depends on the expectations of your users and on the type of application.

The dial initially emits valueChanged () signals continuously while the slider is being moved; you can make it emit the signal less often by disabling the tracking property. The sliderMoved () signal is emitted continuously even when tracking is disabled.

The dial also emits sliderPressed () 和 sliderReleased () signals when the mouse button is pressed and released. Note that the dial's value can change without these signals being emitted since the keyboard and wheel can also be used to change the 值。

Unlike the slider, QDial attempts to draw a "nice" number of notches rather than one per line step. If possible, the number of notches drawn is one per line step, but if there aren't enough pixels to draw every one, QDial will skip notches to try and draw a uniform set (e.g. by drawing every second or third notch).

Like the slider, the dial makes the QAbstractSlider 函数 setValue (), addLine (), subtractLine (), addPage () 和 subtractPage () available as slots.

The dial's keyboard interface is fairly simple: The left / up and right / down arrow keys adjust the dial's value by the defined singleStep , Page 向上 and Page Down by the defined pageStep ,和 首页 and End keys set the value to the defined minimum and maximum 值。

If you are using the mouse wheel to adjust the dial, the increment value is determined by the lesser value of wheelScrollLines multipled by singleStep ,和 pageStep .

Screenshot of a dial in the Plastique widget style Screenshot of a dial in the Windows XP widget style Screenshot of a dial in the Macintosh widget style
Dials shown in various widget styles (from left to right): Plastique , Windows XP , Macintosh .

方法文档编制

QDial.__init__ ( self , QWidget   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a dial.

parent 自变量被发送给 QAbstractSlider 构造函数。

bool QDial.event ( self , QEvent   e )

重实现自 QObject.event ().

QDial.initStyleOption ( self , QStyleOptionSlider   option )

初始化 option 采用值来自此 QDial . This method is useful for subclasses when they need a QStyleOptionSlider , but don't want to fill in all the information themselves.

另请参阅 QStyleOption.initFrom ().

QSize QDial.minimumSizeHint ( self )

重实现自 QWidget.minimumSizeHint ().

QDial.mouseMoveEvent ( self , QMouseEvent   me )

重实现自 QWidget.mouseMoveEvent ().

QDial.mousePressEvent ( self , QMouseEvent   me )

重实现自 QWidget.mousePressEvent ().

QDial.mouseReleaseEvent ( self , QMouseEvent   me )

重实现自 QWidget.mouseReleaseEvent ().

bool QDial.notchesVisible ( self )

int QDial.notchSize ( self )

float QDial.notchTarget ( self )

QDial.paintEvent ( self , QPaintEvent   pe )

重实现自 QWidget.paintEvent ().

QDial.resizeEvent ( self , QResizeEvent   re )

重实现自 QWidget.resizeEvent ().

QDial.setNotchesVisible ( self , bool  visible )

This method is also a Qt slot with the C++ signature void setNotchesVisible(bool) .

QDial.setNotchTarget ( self , float  target )

QDial.setWrapping ( self , bool  on )

This method is also a Qt slot with the C++ signature void setWrapping(bool) .

QSize QDial.sizeHint ( self )

重实现自 QWidget.sizeHint ().

QDial.sliderChange ( self , QAbstractSlider.SliderChange   change )

重实现自 QAbstractSlider.sliderChange ().

bool QDial.wrapping ( self )