- class QDial¶
The
QDial
class provides a rounded range control (like a speedometer or potentiometer). More…Synopsis¶
Properties¶
notchSizeᅟ
- The current notch sizenotchTargetᅟ
- The target number of pixels between notchesnotchesVisibleᅟ
- Whether the notches are shownwrappingᅟ
- Whether wrapping is enabled
Methods¶
def
__init__()
def
notchSize()
def
notchTarget()
def
notchesVisible()
def
setNotchTarget()
def
wrapping()
Virtual methods¶
Slots¶
def
setWrapping()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
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 fromQAbstractSlider
, the dial behaves in a similar way to aslider
. Whenwrapping()
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 thetracking
property. ThesliderMoved()
signal is emitted continuously even when tracking is disabled.The dial also emits
sliderPressed()
andsliderReleased()
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 value.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
functionsetValue()
available as a slot.The dial’s keyboard interface is fairly simple: The left/up and right/down arrow keys adjust the dial’s
value
by the definedsingleStep
, Page Up and Page Down by the definedpageStep
, and the Home and End keys set the value to the definedminimum
andmaximum
values.If you are using the mouse wheel to adjust the dial, the increment value is determined by the lesser value of
wheelScrollLines
multiplied bysingleStep
, andpageStep
.See also
QScrollBar
QSpinBox
QSlider
Sliders ExampleNote
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property notchSizeᅟ: int¶
This property holds the current notch size.
The notch size is in range control units, not pixels, and is calculated to be a multiple of
singleStep()
that results in an on-screen notch size nearnotchTarget()
.See also
- Access functions:
- property notchTargetᅟ: float¶
This property holds the target number of pixels between notches.
The notch target is the number of pixels
QDial
attempts to put between each notch.The actual size may differ from the target size.
The default notch target is 3.7 pixels.
- Access functions:
- property notchesVisibleᅟ: bool¶
This property holds whether the notches are shown.
If the property is
true
, a series of notches are drawn around the dial to indicate the range of values available; otherwise no notches are shown.By default, this property is disabled.
- Access functions:
- property wrappingᅟ: bool¶
This property holds whether wrapping is enabled.
If true, wrapping is enabled; otherwise some space is inserted at the bottom of the dial to separate the ends of the range of valid values.
If enabled, the arrow can be oriented at any angle on the dial. If disabled, the arrow will be restricted to the upper part of the dial; if it is rotated into the space at the bottom of the dial, it will be clamped to the closest end of the valid range of values.
By default this property is
false
.- Access functions:
Constructs a dial.
The
parent
argument is sent to theQAbstractSlider
constructor.- initStyleOption(option)¶
- Parameters:
option –
QStyleOptionSlider
Initialize
option
with the values from thisQDial
. This method is useful for subclasses when they need aQStyleOptionSlider
, but don’t want to fill in all the information themselves.See also
- notchSize()¶
- Return type:
int
Getter of property
notchSizeᅟ
.- notchTarget()¶
- Return type:
float
See also
Getter of property
notchTargetᅟ
.- notchesVisible()¶
- Return type:
bool
See also
Getter of property
notchesVisibleᅟ
.- setNotchTarget(target)¶
- Parameters:
target – float
See also
- setNotchesVisible(visible)¶
- Parameters:
visible – bool
See also
Setter of property
notchesVisibleᅟ
.- setWrapping(on)¶
- Parameters:
on – bool
See also
Setter of property
wrappingᅟ
.- wrapping()¶
- Return type:
bool
See also
Getter of property
wrappingᅟ
.