📄 qdial.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qdial.cpp:86 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QDial Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDial Class Reference</h1><p>The QDial class provides a rounded range control (like a speedometer or potentiometer).<a href="#details">More...</a><p><tt>#include <<a href="qdial-h.html">qdial.h</a>></tt><p>Inherits <a href="qwidget.html">QWidget</a> and <a href="qrangecontrol.html">QRangeControl</a>.<p><a href="qdial-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QDial"><b>QDial</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</div></li><li><div class=fn><a href="#QDial-2"><b>QDial</b></a> ( int minValue, int maxValue, int pageStep, int value, QWidget * parent = 0, const char * name = 0 )</div></li><li><div class=fn><a href="#~QDial"><b>~QDial</b></a> ()</div></li><li><div class=fn>bool <a href="#tracking"><b>tracking</b></a> () const</div></li><li><div class=fn>bool <a href="#wrapping"><b>wrapping</b></a> () const</div></li><li><div class=fn>int <a href="#notchSize"><b>notchSize</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setNotchTarget"><b>setNotchTarget</b></a> ( double )</div></li><li><div class=fn>double <a href="#notchTarget"><b>notchTarget</b></a> () const</div></li><li><div class=fn>bool <a href="#notchesVisible"><b>notchesVisible</b></a> () const</div></li><li><div class=fn>int <a href="#minValue"><b>minValue</b></a> () const</div></li><li><div class=fn>int <a href="#maxValue"><b>maxValue</b></a> () const</div></li><li><div class=fn>void <a href="#setMinValue"><b>setMinValue</b></a> ( int )</div></li><li><div class=fn>void <a href="#setMaxValue"><b>setMaxValue</b></a> ( int )</div></li><li><div class=fn>int <a href="#lineStep"><b>lineStep</b></a> () const</div></li><li><div class=fn>int <a href="#pageStep"><b>pageStep</b></a> () const</div></li><li><div class=fn>void <a href="#setLineStep"><b>setLineStep</b></a> ( int )</div></li><li><div class=fn>void <a href="#setPageStep"><b>setPageStep</b></a> ( int )</div></li><li><div class=fn>int <a href="#value"><b>value</b></a> () const</div></li></ul><h2>Public Slots</h2><ul><li><div class=fn>virtual void <a href="#setValue"><b>setValue</b></a> ( int )</div></li><li><div class=fn>void <a href="#addLine"><b>addLine</b></a> ()</div></li><li><div class=fn>void <a href="#subtractLine"><b>subtractLine</b></a> ()</div></li><li><div class=fn>void <a href="#addPage"><b>addPage</b></a> ()</div></li><li><div class=fn>void <a href="#subtractPage"><b>subtractPage</b></a> ()</div></li><li><div class=fn>virtual void <a href="#setNotchesVisible"><b>setNotchesVisible</b></a> ( bool b )</div></li><li><div class=fn>virtual void <a href="#setWrapping"><b>setWrapping</b></a> ( bool on )</div></li><li><div class=fn>virtual void <a href="#setTracking"><b>setTracking</b></a> ( bool enable )</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( int value )</div></li><li><div class=fn>void <a href="#dialPressed"><b>dialPressed</b></a> ()</div></li><li><div class=fn>void <a href="#dialMoved"><b>dialMoved</b></a> ( int value )</div></li><li><div class=fn>void <a href="#dialReleased"><b>dialReleased</b></a> ()</div></li></ul><h2>Properties</h2><ul><li><div class=fn>int <a href="#lineStep-prop"><b>lineStep</b></a> - the current line step</div></li><li><div class=fn>int <a href="#maxValue-prop"><b>maxValue</b></a> - the current maximum value</div></li><li><div class=fn>int <a href="#minValue-prop"><b>minValue</b></a> - the current minimum value</div></li><li><div class=fn>int <a href="#notchSize-prop"><b>notchSize</b></a> - the current notch size <em>(read only)</em></div></li><li><div class=fn>double <a href="#notchTarget-prop"><b>notchTarget</b></a> - the target number of pixels between notches</div></li><li><div class=fn>bool <a href="#notchesVisible-prop"><b>notchesVisible</b></a> - whether the notches are shown</div></li><li><div class=fn>int <a href="#pageStep-prop"><b>pageStep</b></a> - the current page step</div></li><li><div class=fn>bool <a href="#tracking-prop"><b>tracking</b></a> - whether tracking is enabled</div></li><li><div class=fn>int <a href="#value-prop"><b>value</b></a> - the current dial value</div></li><li><div class=fn>bool <a href="#wrapping-prop"><b>wrapping</b></a> - whether wrapping is enabled</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#valueChange"><b>valueChange</b></a> ()</div></li><li><div class=fn>virtual void <a href="#rangeChange"><b>rangeChange</b></a> ()</div></li><li><div class=fn>virtual void <a href="#repaintScreen"><b>repaintScreen</b></a> ( const QRect * cr = 0 )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2> <p> The QDial class provides a rounded range control (like a speedometer or potentiometer).<p> <p> QDial is used when the user needs to control a value within aprogram-definable range, and the range either wraps around(typically, 0..359 degrees) or the dialog layout needs a square widget.<p> Both API- and UI-wise, the dial is very similar to a <a href="qslider.html">slider.</a> Indeed, when <a href="#wrapping">wrapping</a>() is FALSE (the default)there is no real difference between a slider and a dial. They havethe same signals, slots and member functions, all of which do thesame things. Which one you use depends only on your taste andon the application.<p> The dial initially emits <a href="#valueChanged">valueChanged</a>() signals continuously whilethe slider is being moved; you can make it emit the signal lessoften by calling <a href="#setTracking">setTracking</a>(FALSE). <a href="#dialMoved">dialMoved</a>() is emittedcontinuously even when <a href="#tracking">tracking</a>() is FALSE.<p> The slider also emits <a href="#dialPressed">dialPressed</a>() and <a href="#dialReleased">dialReleased</a>() signals whenthe mouse button is pressed and released. But note that the dial'svalue can change without these signals being emitted; the keyboardand wheel can be used to change the value.<p> Unlike the slider, QDial attempts to draw a "nice" number of notchesrather than one per <a href="#lineStep">lineStep</a>(). If possible, the number of notchesdrawn is one per lineStep(), but if there aren't enough pixels to drawevery one, QDial will draw every second, third etc., notch.<a href="#notchSize">notchSize</a>() returns the number of units per notch, hopefully amultiple of lineStep(); <a href="#setNotchTarget">setNotchTarget</a>() sets the target distancebetween neighbouring notches in pixels. The default is 3.75 pixels.<p> Like the slider, the dial makes the <a href="qrangecontrol.html">QRangeControl</a> functions<a href="#setValue">setValue</a>(), <a href="#addLine">addLine</a>(), <a href="#subtractLine">subtractLine</a>(), <a href="#addPage">addPage</a>() and <a href="#subtractPage">subtractPage</a>()available as slots.<p> The dial's keyboard interface is fairly simple: The left/up and right/downarrow keys move by lineStep(), page up and page down by <a href="#pageStep">pageStep</a>()and Home and End to <a href="#minValue">minValue</a>() and <a href="#maxValue">maxValue</a>().<p> <img src=qdial-m.png> <img src=qdial-w.png><p> <p>See also <a href="qscrollbar.html">QScrollBar</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Slider</a> and <a href="basic.html">Basic Widgets</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QDial"></a>QDial::QDial ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )</h3> Constructs a dial called <em>name</em> with parent <em>parent</em>.<em>f</em> is propagated to the <a href="qwidget.html">QWidget</a> constructor.It has the default range of a <a href="qrangecontrol.html">QRangeControl</a>.<h3 class=fn><a name="QDial-2"></a>QDial::QDial ( int minValue, int maxValue, int pageStep, int value, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )</h3>Constructs a dial called <em>name</em> with parent <em>parent</em>. The dial'svalue can never be smaller than <em>minValue</em> or greater than <em>maxValue</em>. Its page step size is <em>pageStep</em>, and its initial valueis <em>value</em>.<p> <em>value</em> is forced to be within the legal range.<h3 class=fn><a name="~QDial"></a>QDial::~QDial ()</h3>Destroys the dial.<h3 class=fn>void <a name="addLine"></a>QDial::addLine ()<tt> [slot]</tt></h3> Increments the dial's <a href="#value">value</a>() by one <a href="#lineStep">lineStep</a>(). <h3 class=fn>void <a name="addPage"></a>QDial::addPage ()<tt> [slot]</tt></h3> Increments the dial's <a href="#value">value</a>() by one <a href="#pageStep">pageStep</a>() of steps. <h3 class=fn>void <a name="dialMoved"></a>QDial::dialMoved ( int value )<tt> [signal]</tt></h3><p> This signal is emitted whenever the dial <em>value</em> changes. The frequencyof this signal is <em>not</em> influenced by <a href="#setTracking">setTracking</a>().<p> <p>See also <a href="#valueChanged">valueChanged</a>().<h3 class=fn>void <a name="dialPressed"></a>QDial::dialPressed ()<tt> [signal]</tt></h3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -