<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QSlider Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" 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="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSlider Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSlider widget provides a vertical or horizontal slider. <a href="#details">More...</a></p> <p>Inherits <a href="qabstractslider.html">QAbstractSlider</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qslider.html#TickPosition-enum">TickPosition</a></b> { NoTicks, TicksAbove, TicksLeft, TicksBelow, TicksRight, TicksBothSides }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qslider.html#QSlider">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qslider.html#QSlider-2">__init__</a></b> (<i>self</i>, Qt.Orientation <i>orientation</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />bool <b><a href="qslider.html#event">event</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qslider.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionSlider <i>option</i>)</li><li><div class="fn" />QSize <b><a href="qslider.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qslider.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent <i>ev</i>)</li><li><div class="fn" /><b><a href="qslider.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent <i>ev</i>)</li><li><div class="fn" /><b><a href="qslider.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent <i>ev</i>)</li><li><div class="fn" /><b><a href="qslider.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>ev</i>)</li><li><div class="fn" /><b><a href="qslider.html#setTickInterval">setTickInterval</a></b> (<i>self</i>, int <i>ti</i>)</li><li><div class="fn" /><b><a href="qslider.html#setTickPosition">setTickPosition</a></b> (<i>self</i>, TickPosition <i>position</i>)</li><li><div class="fn" />QSize <b><a href="qslider.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qslider.html#tickInterval">tickInterval</a></b> (<i>self</i>)</li><li><div class="fn" />TickPosition <b><a href="qslider.html#tickPosition">tickPosition</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSlider widget provides a vertical or horizontal slider.</p> <p>The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical groove and translates the handle's position into an integer value within the legal range.</p> <p>QSlider has very few of its own functions; most of the functionality is in <a href="qabstractslider.html">QAbstractSlider</a>. The most useful functions are <a href="qabstractslider.html#value-prop">setValue</a>() to set the slider directly to some value; <a href="qabstractslider.html#triggerAction">triggerAction</a>() to simulate the effects of clicking (useful for shortcut keys); <a href="qabstractslider.html#singleStep-prop">setSingleStep</a>(), <a href="qabstractslider.html#pageStep-prop">setPageStep</a>() to set the steps; and <a href="qabstractslider.html#minimum-prop">setMinimum</a>() and <a href="qabstractslider.html#maximum-prop">setMaximum</a>() to define the range of the scroll bar.</p> <p>QSlider provides methods for controlling tickmarks. You can use <a href="qslider.html#tickPosition-prop">setTickPosition</a>() to indicate where you want the tickmarks to be, <a href="qslider.html#tickInterval-prop">setTickInterval</a>() to indicate how many of them you want. the currently set tick position and interval can be queried using the <a href="qslider.html#tickPosition-prop">tickPosition</a>() and <a href="qslider.html#tickInterval-prop">tickInterval</a>() functions, respectively.</p> <p>QSlider inherits a comprehensive set of signals:</p> <table class="generic"> <thead> <tr class="qt-style"> <th>Signal</th> <th>Description</th> </tr> </thead> <tr class="odd" valign="top"> <td><a href="qabstractslider.html#valueChanged">valueChanged</a>()</td> <td>Emitted when the slider's value has changed. The tracking() determines whether this signal is emitted during user interaction.</td> </tr> <tr class="even" valign="top"> <td><a href="qabstractslider.html#sliderPressed">sliderPressed</a>()</td> <td>Emitted when the user starts to drag the slider.</td> </tr> <tr class="odd" valign="top"> <td><a href="qabstractslider.html#sliderMoved">sliderMoved</a>()</td> <td>Emitted when the user drags the slider.</td> </tr> <tr class="even" valign="top"> <td><a href="qabstractslider.html#sliderReleased">sliderReleased</a>()</td> <td>Emitted when the user releases the slider.</td> </tr> </table> <p>QSlider only provides integer ranges. Note that although QSlider handles very large numbers, it becomes difficult for users to use a slider accurately for very large ranges.</p> <p>A slider accepts focus on Tab and provides both a mouse wheel and a keyboard interface. The keyboard interface is the following:</p> <ul> <li>Left/Right move a horizontal slider by one single step.</li> <li>Up/Down move a vertical slider by one single step.</li> <li>PageUp moves up one page.</li> <li>PageDown moves down one page.</li> <li>Home moves to the start (mininum).</li> <li>End moves to the end (maximum).</li> </ul> <table class="generic" width="100%"> <tr class="odd" valign="top"> <td><img alt="Screenshot of a Macintosh slider" src="images/macintosh-slider.png" /></td> <td>A slider shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</td> </tr> <tr class="even" valign="top"> <td><img alt="Screenshot of a Windows XP slider" src="images/windows-slider.png" /></td> <td>A slider shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td> </tr> <tr class="odd" valign="top"> <td><img alt="Screenshot of a Plastique slider" src="images/plastique-slider.png" /></td> <td>A slider shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td> </tr> </table> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="TickPosition-enum" />QSlider.TickPosition</h3><p>This enum specifies where the tick marks are to be drawn relative to the slider's groove and the handle the user moves.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QSlider.NoTicks</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">Do not draw any tick marks.</td> </tr> <tr> <td class="topAlign"><tt>QSlider.TicksBothSides</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">Draw tick marks on both sides of the groove.</td> </tr> <tr> <td class="topAlign"><tt>QSlider.TicksAbove</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">Draw tick marks above the (horizontal) slider</td> </tr> <tr> <td class="topAlign"><tt>QSlider.TicksBelow</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">Draw tick marks below the (horizontal) slider</td> </tr> <tr> <td class="topAlign"><tt>QSlider.TicksLeft</tt></td> <td class="topAlign"><tt>TicksAbove</tt></td> <td class="topAlign">Draw tick marks to the left of the (vertical) slider</td> </tr> <tr> <td class="topAlign"><tt>QSlider.TicksRight</tt></td> <td class="topAlign"><tt>TicksBelow</tt></td> <td class="topAlign">Draw tick marks to the right of the (vertical) slider</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSlider" />QSlider.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a vertical slider with the given <i>parent</i>.</p> <h3 class="fn"><a name="QSlider-2" />QSlider.__init__ (<i>self</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a slider with the given <i>parent</i>. The <i>orientation</i> parameter determines whether the slider is horizontal or vertical; the valid values are <a href="qt.html#Orientation-enum">Qt.Vertical</a> and <a href="qt.html#Orientation-enum">Qt.Horizontal</a>.</p> <h3 class="fn"><a name="event" />bool QSlider.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="initStyleOption" />QSlider.initStyleOption (<i>self</i>, <a href="qstyleoptionslider.html">QStyleOptionSlider</a> <i>option</i>)</h3><p>Initialize <i>option</i> with the values from this <a href="qslider.html">QSlider</a>. This method is useful for subclasses when they need a <a href="qstyleoptionslider.html">QStyleOptionSlider</a>, but don't want to fill in all the information themselves.</p> <p><b>See also</b> <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>().</p> <h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QSlider.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p> <h3 class="fn"><a name="mouseMoveEvent" />QSlider.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p> <h3 class="fn"><a name="mousePressEvent" />QSlider.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p> <h3 class="fn"><a name="mouseReleaseEvent" />QSlider.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p> <h3 class="fn"><a name="paintEvent" />QSlider.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p> <h3 class="fn"><a name="setTickInterval" />QSlider.setTickInterval (<i>self</i>, int <i>ti</i>)</h3><h3 class="fn"><a name="setTickPosition" />QSlider.setTickPosition (<i>self</i>, <a href="qslider.html#TickPosition-enum">TickPosition</a> <i>position</i>)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QSlider.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p> <h3 class="fn"><a name="tickInterval" />int QSlider.tickInterval (<i>self</i>)</h3><h3 class="fn"><a name="tickPosition" /><a href="qslider.html#TickPosition-enum">TickPosition</a> QSlider.tickPosition (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>