Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDial Class

TheQDial class provides a rounded range control (like a speedometer or potentiometer).More...

Header:#include <QDial>
Inherits:QAbstractSlider

Properties

Public Functions

QDial(QWidget * parent = 0)
~QDial()
intnotchSize() const
qrealnotchTarget() const
boolnotchesVisible() const
voidsetNotchTarget(double target)
boolwrapping() const

Reimplemented Public Functions

virtual QSizeminimumSizeHint() const
virtual QSizesizeHint() const

Public Slots

voidsetNotchesVisible(bool visible)
voidsetWrapping(bool on)

Protected Functions

voidinitStyleOption(QStyleOptionSlider * option) const

Reimplemented Protected Functions

virtual boolevent(QEvent * e)
virtual voidmouseMoveEvent(QMouseEvent * e)
virtual voidmousePressEvent(QMouseEvent * e)
virtual voidmouseReleaseEvent(QMouseEvent * e)
virtual voidpaintEvent(QPaintEvent * pe)
virtual voidresizeEvent(QResizeEvent * e)
virtual voidsliderChange(SliderChange change)

Additional Inherited Members

Detailed Description

TheQDial 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.

SinceQDial 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 emitsvalueChanged() 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 emitssliderPressed() 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 theQAbstractSlider functionssetValue(),addLine(),subtractLine(),addPage() andsubtractPage() available as slots.

The dial's keyboard interface is fairly simple: Theleft/up andright/down arrow keys adjust the dial'svalue by the definedsingleStep,Page Up andPage Down by the definedpageStep, and theHome andEnd 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 ofwheelScrollLines multipled bysingleStep, andpageStep.

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

See alsoQScrollBar,QSpinBox,QSlider,GUI Design Handbook: Slider, andSliders Example.

Property Documentation

notchSize : constint

This property holds the current notch size.

The notch size is in range control units, not pixels, and if possible it is a multiple ofsingleStep() that results in an on-screen notch size nearnotchTarget().

By default, this property has a value of 1.

Access functions:

intnotchSize() const

See alsonotchTarget() andsingleStep().

notchTarget :qreal

This property holds the target number of pixels between notches.

The notch target is the number of pixelsQDial 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:

qrealnotchTarget() const
voidsetNotchTarget(double target)

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:

boolnotchesVisible() const
voidsetNotchesVisible(bool visible)

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:

boolwrapping() const
voidsetWrapping(bool on)

Member Function Documentation

QDial::QDial(QWidget * parent = 0)

Constructs a dial.

Theparent argument is sent to theQAbstractSlider constructor.

QDial::~QDial()

Destroys the dial.

[virtual protected]bool QDial::event(QEvent * e)

Reimplemented fromQObject::event().

[protected]void QDial::initStyleOption(QStyleOptionSlider * option) const

Initializeoption 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 alsoQStyleOption::initFrom().

[virtual]QSize QDial::minimumSizeHint() const

Reimplemented fromQWidget::minimumSizeHint().

[virtual protected]void QDial::mouseMoveEvent(QMouseEvent * e)

Reimplemented fromQWidget::mouseMoveEvent().

[virtual protected]void QDial::mousePressEvent(QMouseEvent * e)

Reimplemented fromQWidget::mousePressEvent().

[virtual protected]void QDial::mouseReleaseEvent(QMouseEvent * e)

Reimplemented fromQWidget::mouseReleaseEvent().

[virtual protected]void QDial::paintEvent(QPaintEvent * pe)

Reimplemented fromQWidget::paintEvent().

[virtual protected]void QDial::resizeEvent(QResizeEvent * e)

Reimplemented fromQWidget::resizeEvent().

[virtual]QSize QDial::sizeHint() const

Reimplemented fromQWidget::sizeHint().

[virtual protected]void QDial::sliderChange(SliderChange change)

Reimplemented fromQAbstractSlider::sliderChange().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp