You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
562 lines
36 KiB
562 lines
36 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qspinbox.cpp:129 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQSpinBox Class</title>
|
|
<style type="text/css"><!--
|
|
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>TQSpinBox Class Reference</h1>
|
|
|
|
<p>The TQSpinBox class provides a spin box widget (spin button).
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qspinbox-h.html">ntqspinbox.h</a>></tt>
|
|
<p>Inherits <a href="tqwidget.html">TQWidget</a> and <a href="ntqrangecontrol.html">TQRangeControl</a>.
|
|
<p><a href="qspinbox-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQSpinBox"><b>TQSpinBox</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li>
|
|
<li class=fn><a href="#TQSpinBox-2"><b>TQSpinBox</b></a> ( int minValue, int maxValue, int step = 1, TQWidget * parent = 0, const char * name = 0 )</li>
|
|
<li class=fn><a href="#~TQSpinBox"><b>~TQSpinBox</b></a> ()</li>
|
|
<li class=fn>TQString <a href="#text"><b>text</b></a> () const</li>
|
|
<li class=fn>virtual TQString <a href="#prefix"><b>prefix</b></a> () const</li>
|
|
<li class=fn>virtual TQString <a href="#suffix"><b>suffix</b></a> () const</li>
|
|
<li class=fn>virtual TQString <a href="#cleanText"><b>cleanText</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setSpecialValueText"><b>setSpecialValueText</b></a> ( const TQString & text )</li>
|
|
<li class=fn>TQString <a href="#specialValueText"><b>specialValueText</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setWrapping"><b>setWrapping</b></a> ( bool on )</li>
|
|
<li class=fn>bool <a href="#wrapping"><b>wrapping</b></a> () const</li>
|
|
<li class=fn>enum <a href="#ButtonSymbols-enum"><b>ButtonSymbols</b></a> { UpDownArrows, PlusMinus }</li>
|
|
<li class=fn>virtual void <a href="#setButtonSymbols"><b>setButtonSymbols</b></a> ( ButtonSymbols )</li>
|
|
<li class=fn>ButtonSymbols <a href="#buttonSymbols"><b>buttonSymbols</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setValidator"><b>setValidator</b></a> ( const TQValidator * v )</li>
|
|
<li class=fn>const TQValidator * <a href="#validator"><b>validator</b></a> () const</li>
|
|
<li class=fn>int <a href="#minValue"><b>minValue</b></a> () const</li>
|
|
<li class=fn>int <a href="#maxValue"><b>maxValue</b></a> () const</li>
|
|
<li class=fn>void <a href="#setMinValue"><b>setMinValue</b></a> ( int )</li>
|
|
<li class=fn>void <a href="#setMaxValue"><b>setMaxValue</b></a> ( int )</li>
|
|
<li class=fn>int <a href="#lineStep"><b>lineStep</b></a> () const</li>
|
|
<li class=fn>void <a href="#setLineStep"><b>setLineStep</b></a> ( int )</li>
|
|
<li class=fn>int <a href="#value"><b>value</b></a> () const</li>
|
|
<li class=fn>TQRect <a href="#upRect"><b>upRect</b></a> () const</li>
|
|
<li class=fn>TQRect <a href="#downRect"><b>downRect</b></a> () const</li>
|
|
</ul>
|
|
<h2>Public Slots</h2>
|
|
<ul>
|
|
<li class=fn>virtual void <a href="#setValue"><b>setValue</b></a> ( int value )</li>
|
|
<li class=fn>virtual void <a href="#setPrefix"><b>setPrefix</b></a> ( const TQString & text )</li>
|
|
<li class=fn>virtual void <a href="#setSuffix"><b>setSuffix</b></a> ( const TQString & text )</li>
|
|
<li class=fn>virtual void <a href="#stepUp"><b>stepUp</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#stepDown"><b>stepDown</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ()</li>
|
|
</ul>
|
|
<h2>Signals</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( int value )</li>
|
|
<li class=fn>void <a href="#valueChanged-2"><b>valueChanged</b></a> ( const TQString & valueText )</li>
|
|
</ul>
|
|
<h2>Properties</h2>
|
|
<ul>
|
|
<li class=fn>ButtonSymbols <a href="#buttonSymbols-prop"><b>buttonSymbols</b></a> - the current button symbol mode</li>
|
|
<li class=fn>TQString <a href="#cleanText-prop"><b>cleanText</b></a> - the spin box's text with no prefix(), suffix() or leading or trailing whitespace <em>(read only)</em></li>
|
|
<li class=fn>int <a href="#lineStep-prop"><b>lineStep</b></a> - the line step</li>
|
|
<li class=fn>int <a href="#maxValue-prop"><b>maxValue</b></a> - the maximum value of the spin box</li>
|
|
<li class=fn>int <a href="#minValue-prop"><b>minValue</b></a> - the minimum value of the spin box</li>
|
|
<li class=fn>TQString <a href="#prefix-prop"><b>prefix</b></a> - the spin box's prefix</li>
|
|
<li class=fn>TQString <a href="#specialValueText-prop"><b>specialValueText</b></a> - the special-value text</li>
|
|
<li class=fn>TQString <a href="#suffix-prop"><b>suffix</b></a> - the suffix of the spin box</li>
|
|
<li class=fn>TQString <a href="#text-prop"><b>text</b></a> - the spin box's text, including any prefix() and suffix() <em>(read only)</em></li>
|
|
<li class=fn>int <a href="#value-prop"><b>value</b></a> - the value of the spin box</li>
|
|
<li class=fn>bool <a href="#wrapping-prop"><b>wrapping</b></a> - whether it is possible to step the value from the highest value to the lowest value and vice versa</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>virtual TQString <a href="#mapValueToText"><b>mapValueToText</b></a> ( int v )</li>
|
|
<li class=fn>virtual int <a href="#mapTextToValue"><b>mapTextToValue</b></a> ( bool * ok )</li>
|
|
<li class=fn>TQString <a href="#currentValueText"><b>currentValueText</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#updateDisplay"><b>updateDisplay</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#interpretText"><b>interpretText</b></a> ()</li>
|
|
<li class=fn>TQLineEdit * <a href="#editor"><b>editor</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#valueChange"><b>valueChange</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#rangeChange"><b>rangeChange</b></a> ()</li>
|
|
<li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( TQObject * o, TQEvent * ev )</li>
|
|
</ul>
|
|
<h2>Protected Slots</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ()</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQSpinBox class provides a spin box widget (spin button).
|
|
<p>
|
|
|
|
<p> TQSpinBox allows the user to choose a value either by clicking the
|
|
up/down buttons to increase/decrease the value currently displayed
|
|
or by typing the value directly into the spin box. If the value is
|
|
entered directly into the spin box, Enter (or Return) must be
|
|
pressed to apply the new value. The value is usually an integer.
|
|
<p> Every time the value changes TQSpinBox emits the <a href="#valueChanged">valueChanged</a>()
|
|
signal. The current value can be fetched with <a href="#value">value</a>() and set
|
|
with <a href="#setValue">setValue</a>().
|
|
<p> The spin box keeps the value within a numeric range, and to
|
|
multiples of the <a href="#lineStep">lineStep</a>() size (see <a href="ntqrangecontrol.html">TQRangeControl</a> for details).
|
|
Clicking the up/down buttons or using the keyboard accelerator's
|
|
up and down arrows will increase or decrease the current value in
|
|
steps of size lineStep(). The minimum and maximum value and the
|
|
step size can be set using one of the constructors, and can be
|
|
changed later with <a href="#setMinValue">setMinValue</a>(), <a href="#setMaxValue">setMaxValue</a>() and <a href="#setLineStep">setLineStep</a>().
|
|
<p> Most spin boxes are directional, but TQSpinBox can also operate as
|
|
a circular spin box, i.e. if the range is 0-99 and the current
|
|
value is 99, clicking "up" will give 0. Use <a href="#setWrapping">setWrapping</a>() if you
|
|
want circular behavior.
|
|
<p> The displayed value can be prepended and appended with arbitrary
|
|
strings indicating, for example, currency or the unit of
|
|
measurement. See <a href="#setPrefix">setPrefix</a>() and <a href="#setSuffix">setSuffix</a>(). The text in the spin
|
|
box is retrieved with <a href="#text">text</a>() (which includes any <a href="#prefix">prefix</a>() and
|
|
<a href="#suffix">suffix</a>()), or with <a href="#cleanText">cleanText</a>() (which has no prefix(), no suffix()
|
|
and no leading or trailing whitespace). <a href="#currentValueText">currentValueText</a>() returns
|
|
the spin box's current value as text.
|
|
<p> Normally the spin box displays up and down arrows in the buttons.
|
|
You can use <a href="#setButtonSymbols">setButtonSymbols</a>() to change the display to show
|
|
<b>+</b> and <b>-</b> symbols if you prefer. In either case the up
|
|
and down arrow keys work as expected.
|
|
<p> It is often desirable to give the user a special (often default)
|
|
choice in addition to the range of numeric values. See
|
|
<a href="#setSpecialValueText">setSpecialValueText</a>() for how to do this with TQSpinBox.
|
|
<p> The default <a href="tqwidget.html#focusPolicy">TQWidget::focusPolicy</a>() is StrongFocus.
|
|
<p> If using prefix(), suffix() and <a href="#specialValueText">specialValueText</a>() don't provide
|
|
enough control, you can ignore them and subclass TQSpinBox instead.
|
|
<p> TQSpinBox can easily be subclassed to allow the user to input
|
|
things other than an integer value as long as the allowed input
|
|
can be mapped to a range of integers. This can be done by
|
|
overriding the virtual functions <a href="#mapValueToText">mapValueToText</a>() and
|
|
<a href="#mapTextToValue">mapTextToValue</a>(), and setting another suitable validator using
|
|
<a href="#setValidator">setValidator</a>().
|
|
<p> For example, these functions could be changed so that the user
|
|
provided values from 0.0 to 10.0, or -1 to signify 'Auto', while
|
|
the range of integers used inside the program would be -1 to 100:
|
|
<p> <pre>
|
|
class MySpinBox : public TQSpinBox
|
|
{
|
|
TQ_OBJECT
|
|
public:
|
|
...
|
|
|
|
<a href="ntqstring.html">TQString</a> mapValueToText( int value )
|
|
{
|
|
if ( <a href="#value-prop">value</a> == -1 ) // special case
|
|
return TQString( "Auto" );
|
|
|
|
return TQString( "%1.%2" ) // 0.0 to 10.0
|
|
.arg( value / 10 ).arg( value % 10 );
|
|
}
|
|
|
|
int mapTextToValue( bool *ok )
|
|
{
|
|
if ( <a href="#text">text</a>() == "Auto" ) // special case
|
|
return -1;
|
|
|
|
return (int) ( 10 * text().toFloat() ); // 0 to 100
|
|
}
|
|
};
|
|
</pre>
|
|
|
|
<p> <img src=qspinbox-m.png> <img src=qspinbox-w.png>
|
|
<p> <p>See also <a href="ntqscrollbar.html">TQScrollBar</a>, <a href="ntqslider.html">TQSlider</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Spin Box</a>, and <a href="basic.html">Basic Widgets</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="ButtonSymbols-enum"></a>TQSpinBox::ButtonSymbols</h3>
|
|
|
|
<p> This enum type determines what the buttons in a spin box show.
|
|
<ul>
|
|
<li><tt>TQSpinBox::UpDownArrows</tt> - the buttons show little arrows in the classic
|
|
style.
|
|
<li><tt>TQSpinBox::PlusMinus</tt> - the buttons show <b>+</b> and <b>-</b> symbols.
|
|
</ul><p> <p>See also <a href="#buttonSymbols-prop">TQSpinBox::buttonSymbols</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQSpinBox"></a>TQSpinBox::TQSpinBox ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
|
|
</h3>
|
|
Constructs a spin box with the default <a href="ntqrangecontrol.html">TQRangeControl</a> range and
|
|
step values. It is called <em>name</em> and has parent <em>parent</em>.
|
|
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, <a href="ntqrangecontrol.html#setRange">setRange</a>(), <a href="#lineStep-prop">lineStep</a>, and <a href="ntqrangecontrol.html#setSteps">setSteps</a>().
|
|
|
|
<h3 class=fn><a name="TQSpinBox-2"></a>TQSpinBox::TQSpinBox ( int minValue, int maxValue, int step = 1, <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
|
|
</h3>
|
|
Constructs a spin box that allows values from <em>minValue</em> to <em>maxValue</em> inclusive, with step amount <em>step</em>. The value is
|
|
initially set to <em>minValue</em>.
|
|
<p> The spin box is called <em>name</em> and has parent <em>parent</em>.
|
|
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, <a href="ntqrangecontrol.html#setRange">setRange</a>(), <a href="#lineStep-prop">lineStep</a>, and <a href="ntqrangecontrol.html#setSteps">setSteps</a>().
|
|
|
|
<h3 class=fn><a name="~TQSpinBox"></a>TQSpinBox::~TQSpinBox ()
|
|
</h3>
|
|
Destroys the spin box, freeing all memory and other resources.
|
|
|
|
<h3 class=fn><a href="ntqspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> <a name="buttonSymbols"></a>TQSpinBox::buttonSymbols () const
|
|
</h3><p>Returns the current button symbol mode.
|
|
See the <a href="ntqspinbox.html#buttonSymbols-prop">"buttonSymbols"</a> property for details.
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="cleanText"></a>TQSpinBox::cleanText () const<tt> [virtual]</tt>
|
|
</h3><p>Returns the spin box's text with no <a href="#prefix">prefix</a>(), <a href="#suffix">suffix</a>() or leading or trailing whitespace.
|
|
See the <a href="ntqspinbox.html#cleanText-prop">"cleanText"</a> property for details.
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="currentValueText"></a>TQSpinBox::currentValueText ()<tt> [protected]</tt>
|
|
</h3>
|
|
Returns the full text calculated from the current value, including
|
|
any prefix and suffix. If there is special value text and the
|
|
value is <a href="#minValue">minValue</a>() the <a href="#specialValueText">specialValueText</a>() is returned.
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="downRect"></a>TQSpinBox::downRect () const
|
|
</h3>
|
|
Returns the geometry of the "down" button.
|
|
|
|
<h3 class=fn><a href="ntqlineedit.html">TQLineEdit</a> * <a name="editor"></a>TQSpinBox::editor () const<tt> [protected]</tt>
|
|
</h3>
|
|
Returns a pointer to the embedded <a href="ntqlineedit.html">TQLineEdit</a>.
|
|
|
|
<h3 class=fn>bool <a name="eventFilter"></a>TQSpinBox::eventFilter ( <a href="tqobject.html">TQObject</a> * o, <a href="ntqevent.html">TQEvent</a> * ev )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
Intercepts and handles the events coming to the embedded <a href="ntqlineedit.html">TQLineEdit</a>
|
|
that have special meaning for the TQSpinBox. The object is passed
|
|
as <em>o</em> and the event is passed as <em>ev</em>.
|
|
|
|
<p>Reimplemented from <a href="tqobject.html#eventFilter">TQObject</a>.
|
|
<h3 class=fn>void <a name="interpretText"></a>TQSpinBox::interpretText ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
TQSpinBox calls this after the user has manually edited the
|
|
contents of the spin box (i.e. by typing in the embedded
|
|
<a href="ntqlineedit.html">TQLineEdit</a>, rather than using the up/down buttons/keys).
|
|
<p> The default implementation of this function interprets the new
|
|
text using <a href="#mapTextToValue">mapTextToValue</a>(). If mapTextToValue() is successful, it
|
|
changes the spin box's value; if not, the value is left unchanged.
|
|
<p> <p>See also <a href="#editor">editor</a>().
|
|
|
|
<h3 class=fn>int <a name="lineStep"></a>TQSpinBox::lineStep () const
|
|
</h3><p>Returns the line step.
|
|
See the <a href="ntqspinbox.html#lineStep-prop">"lineStep"</a> property for details.
|
|
<h3 class=fn>int <a name="mapTextToValue"></a>TQSpinBox::mapTextToValue ( bool * ok )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This virtual function is used by the spin box whenever it needs to
|
|
interpret text entered by the user as a value. The text is
|
|
available as <a href="#text">text</a>() and as <a href="#cleanText">cleanText</a>(), and this function must
|
|
parse it if possible. If <em>ok</em> is not 0: if it parses the text
|
|
successfully, <em>*ok</em> is set to TRUE; otherwise <em>*ok</em> is set to
|
|
FALSE.
|
|
<p> Subclasses that need to display spin box values in a non-numeric
|
|
way need to reimplement this function.
|
|
<p> Note that TQt handles <a href="#specialValueText">specialValueText</a>() separately; this function
|
|
is only concerned with the other values.
|
|
<p> The default implementation tries to interpret the text() as an
|
|
integer in the standard way and returns the integer value.
|
|
<p> <p>See also <a href="#interpretText">interpretText</a>() and <a href="#mapValueToText">mapValueToText</a>().
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="mapValueToText"></a>TQSpinBox::mapValueToText ( int v )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This virtual function is used by the spin box whenever it needs to
|
|
display value <em>v</em>. The default implementation returns a string
|
|
containing <em>v</em> printed in the standard way. Reimplementations may
|
|
return anything. (See the example in the detailed description.)
|
|
<p> Note that TQt does not call this function for <a href="#specialValueText">specialValueText</a>()
|
|
and that neither <a href="#prefix">prefix</a>() nor <a href="#suffix">suffix</a>() are included in the return
|
|
value.
|
|
<p> If you reimplement this, you may also need to reimplement
|
|
<a href="#mapTextToValue">mapTextToValue</a>().
|
|
<p> <p>See also <a href="#updateDisplay">updateDisplay</a>() and <a href="#mapTextToValue">mapTextToValue</a>().
|
|
|
|
<h3 class=fn>int <a name="maxValue"></a>TQSpinBox::maxValue () const
|
|
</h3><p>Returns the maximum value of the spin box.
|
|
See the <a href="ntqspinbox.html#maxValue-prop">"maxValue"</a> property for details.
|
|
<h3 class=fn>int <a name="minValue"></a>TQSpinBox::minValue () const
|
|
</h3><p>Returns the minimum value of the spin box.
|
|
See the <a href="ntqspinbox.html#minValue-prop">"minValue"</a> property for details.
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="prefix"></a>TQSpinBox::prefix () const<tt> [virtual]</tt>
|
|
</h3><p>Returns the spin box's prefix.
|
|
See the <a href="ntqspinbox.html#prefix-prop">"prefix"</a> property for details.
|
|
<h3 class=fn>void <a name="rangeChange"></a>TQSpinBox::rangeChange ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This virtual function is called by <a href="ntqrangecontrol.html">TQRangeControl</a> whenever the
|
|
range has changed. It adjusts the default validator and updates
|
|
the display; if you need additional processing, you can
|
|
reimplement this function.
|
|
|
|
<p>Reimplemented from <a href="ntqrangecontrol.html#rangeChange">TQRangeControl</a>.
|
|
<h3 class=fn>void <a name="selectAll"></a>TQSpinBox::selectAll ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Selects all the text in the spin box's editor.
|
|
|
|
<h3 class=fn>void <a name="setButtonSymbols"></a>TQSpinBox::setButtonSymbols ( <a href="ntqspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> )<tt> [virtual]</tt>
|
|
</h3><p>Sets the current button symbol mode.
|
|
See the <a href="ntqspinbox.html#buttonSymbols-prop">"buttonSymbols"</a> property for details.
|
|
<h3 class=fn>void <a name="setLineStep"></a>TQSpinBox::setLineStep ( int )
|
|
</h3><p>Sets the line step.
|
|
See the <a href="ntqspinbox.html#lineStep-prop">"lineStep"</a> property for details.
|
|
<h3 class=fn>void <a name="setMaxValue"></a>TQSpinBox::setMaxValue ( int )
|
|
</h3><p>Sets the maximum value of the spin box.
|
|
See the <a href="ntqspinbox.html#maxValue-prop">"maxValue"</a> property for details.
|
|
<h3 class=fn>void <a name="setMinValue"></a>TQSpinBox::setMinValue ( int )
|
|
</h3><p>Sets the minimum value of the spin box.
|
|
See the <a href="ntqspinbox.html#minValue-prop">"minValue"</a> property for details.
|
|
<h3 class=fn>void <a name="setPrefix"></a>TQSpinBox::setPrefix ( const <a href="ntqstring.html">TQString</a> & text )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets the spin box's prefix to <em>text</em>.
|
|
See the <a href="ntqspinbox.html#prefix-prop">"prefix"</a> property for details.
|
|
<h3 class=fn>void <a name="setSpecialValueText"></a>TQSpinBox::setSpecialValueText ( const <a href="ntqstring.html">TQString</a> & text )<tt> [virtual]</tt>
|
|
</h3><p>Sets the special-value text to <em>text</em>.
|
|
See the <a href="ntqspinbox.html#specialValueText-prop">"specialValueText"</a> property for details.
|
|
<h3 class=fn>void <a name="setSuffix"></a>TQSpinBox::setSuffix ( const <a href="ntqstring.html">TQString</a> & text )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets the suffix of the spin box to <em>text</em>.
|
|
See the <a href="ntqspinbox.html#suffix-prop">"suffix"</a> property for details.
|
|
<h3 class=fn>void <a name="setValidator"></a>TQSpinBox::setValidator ( const <a href="ntqvalidator.html">TQValidator</a> * v )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the validator to <em>v</em>. The validator controls what keyboard
|
|
input is accepted when the user is editing in the value field. The
|
|
default is to use a suitable <a href="qintvalidator.html">TQIntValidator</a>.
|
|
<p> Use <a href="#setValidator">setValidator</a>(0) to turn off input validation (entered input
|
|
will still be kept within the spin box's range).
|
|
|
|
<h3 class=fn>void <a name="setValue"></a>TQSpinBox::setValue ( int value )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets the value of the spin box to <em>value</em>.
|
|
See the <a href="ntqspinbox.html#value-prop">"value"</a> property for details.
|
|
<h3 class=fn>void <a name="setWrapping"></a>TQSpinBox::setWrapping ( bool on )<tt> [virtual]</tt>
|
|
</h3><p>Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to <em>on</em>.
|
|
See the <a href="ntqspinbox.html#wrapping-prop">"wrapping"</a> property for details.
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="specialValueText"></a>TQSpinBox::specialValueText () const
|
|
</h3><p>Returns the special-value text.
|
|
See the <a href="ntqspinbox.html#specialValueText-prop">"specialValueText"</a> property for details.
|
|
<h3 class=fn>void <a name="stepDown"></a>TQSpinBox::stepDown ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Decreases the spin box's value one <a href="#lineStep">lineStep</a>(), wrapping as
|
|
necessary if <a href="#wrapping">wrapping</a>() is TRUE. This is the same as clicking on
|
|
the pointing-down button and can be used for keyboard
|
|
accelerators, for example.
|
|
<p> <p>See also <a href="#stepUp">stepUp</a>(), <a href="ntqrangecontrol.html#subtractLine">subtractLine</a>(), <a href="#lineStep-prop">lineStep</a>, <a href="ntqrangecontrol.html#setSteps">setSteps</a>(), <a href="#value-prop">value</a>, and <a href="#value-prop">value</a>.
|
|
|
|
<h3 class=fn>void <a name="stepUp"></a>TQSpinBox::stepUp ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Increases the spin box's value by one <a href="#lineStep">lineStep</a>(), wrapping as
|
|
necessary if <a href="#wrapping">wrapping</a>() is TRUE. This is the same as clicking on
|
|
the pointing-up button and can be used for keyboard accelerators,
|
|
for example.
|
|
<p> <p>See also <a href="#stepDown">stepDown</a>(), <a href="ntqrangecontrol.html#addLine">addLine</a>(), <a href="#lineStep-prop">lineStep</a>, <a href="ntqrangecontrol.html#setSteps">setSteps</a>(), <a href="#value-prop">value</a>, and <a href="#value-prop">value</a>.
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="suffix"></a>TQSpinBox::suffix () const<tt> [virtual]</tt>
|
|
</h3><p>Returns the suffix of the spin box.
|
|
See the <a href="ntqspinbox.html#suffix-prop">"suffix"</a> property for details.
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQSpinBox::text () const
|
|
</h3><p>Returns the spin box's text, including any <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>().
|
|
See the <a href="ntqspinbox.html#text-prop">"text"</a> property for details.
|
|
<h3 class=fn>void <a name="textChanged"></a>TQSpinBox::textChanged ()<tt> [protected slot]</tt>
|
|
</h3>
|
|
This slot is called whenever the user edits the spin box's text.
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="upRect"></a>TQSpinBox::upRect () const
|
|
</h3>
|
|
Returns the geometry of the "up" button.
|
|
|
|
<h3 class=fn>void <a name="updateDisplay"></a>TQSpinBox::updateDisplay ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
Updates the contents of the embedded <a href="ntqlineedit.html">TQLineEdit</a> to reflect the
|
|
current value using <a href="#mapValueToText">mapValueToText</a>(). Also enables/disables the
|
|
up/down push buttons accordingly.
|
|
<p> <p>See also <a href="#mapValueToText">mapValueToText</a>().
|
|
|
|
<h3 class=fn>const <a href="ntqvalidator.html">TQValidator</a> * <a name="validator"></a>TQSpinBox::validator () const
|
|
</h3>
|
|
Returns the validator that constrains editing for this spin box if
|
|
there is any; otherwise returns 0.
|
|
<p> <p>See also <a href="#setValidator">setValidator</a>() and <a href="ntqvalidator.html">TQValidator</a>.
|
|
|
|
<h3 class=fn>int <a name="value"></a>TQSpinBox::value () const
|
|
</h3><p>Returns the value of the spin box.
|
|
See the <a href="ntqspinbox.html#value-prop">"value"</a> property for details.
|
|
<h3 class=fn>void <a name="valueChange"></a>TQSpinBox::valueChange ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This virtual function is called by <a href="ntqrangecontrol.html">TQRangeControl</a> whenever the
|
|
value has changed. The TQSpinBox reimplementation updates the
|
|
display and emits the <a href="#valueChanged">valueChanged</a>() signals; if you need
|
|
additional processing, either reimplement this or connect to one
|
|
of the valueChanged() signals.
|
|
|
|
<p>Reimplemented from <a href="ntqrangecontrol.html#valueChange">TQRangeControl</a>.
|
|
<h3 class=fn>void <a name="valueChanged"></a>TQSpinBox::valueChanged ( int value )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted every time the value of the spin box
|
|
changes; the new value is passed in <em>value</em>. This signal will be
|
|
emitted as a result of a call to <a href="#setValue">setValue</a>(), or because the user
|
|
changed the value by using a keyboard accelerator or mouse click,
|
|
etc.
|
|
<p> Note that the <a href="#valueChanged">valueChanged</a>() signal is emitted <em>every</em> time, not
|
|
just for the "last" step; i.e. if the user clicks "up" three
|
|
times, this signal is emitted three times.
|
|
<p> <p>See also <a href="#value-prop">value</a>.
|
|
|
|
<p>Examples: <a href="listbox-example.html#x1445">listbox/listbox.cpp</a>, <a href="qfd-example.html#x2009">qfd/fontdisplayer.cpp</a>, and <a href="scribble-example.html#x939">scribble/scribble.cpp</a>.
|
|
<h3 class=fn>void <a name="valueChanged-2"></a>TQSpinBox::valueChanged ( const <a href="ntqstring.html">TQString</a> & valueText )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> This signal is emitted whenever the <a href="#valueChanged">valueChanged</a>( int ) signal is
|
|
emitted, i.e. every time the value of the spin box changes
|
|
(whatever the cause, e.g. by <a href="#setValue">setValue</a>(), by a keyboard
|
|
accelerator, by mouse clicks, etc.).
|
|
<p> The <em>valueText</em> parameter is the same string that is displayed in
|
|
the edit field of the spin box.
|
|
<p> <p>See also <a href="#value-prop">value</a>, <a href="#prefix-prop">prefix</a>, <a href="#suffix-prop">suffix</a>, and <a href="#specialValueText-prop">specialValueText</a>.
|
|
|
|
<h3 class=fn>bool <a name="wrapping"></a>TQSpinBox::wrapping () const
|
|
</h3><p>Returns TRUE if it is possible to step the value from the highest value to the lowest value and vice versa; otherwise returns FALSE.
|
|
See the <a href="ntqspinbox.html#wrapping-prop">"wrapping"</a> property for details.
|
|
<hr><h2>Property Documentation</h2>
|
|
<h3 class=fn><a href="ntqspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> <a name="buttonSymbols-prop"></a>buttonSymbols</h3>
|
|
<p>This property holds the current button symbol mode.
|
|
<p>The possible values can be either <a href="#ButtonSymbols-enum">UpDownArrows</a> or <a href="#ButtonSymbols-enum">PlusMinus</a>.
|
|
The default is <a href="#ButtonSymbols-enum">UpDownArrows</a>.
|
|
<p> <p>See also <a href="#ButtonSymbols-enum">ButtonSymbols</a>.
|
|
|
|
<p>Set this property's value with <a href="#setButtonSymbols">setButtonSymbols</a>() and get this property's value with <a href="#buttonSymbols">buttonSymbols</a>().
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="cleanText-prop"></a>cleanText</h3>
|
|
<p>This property holds the spin box's text with no <a href="#prefix">prefix</a>(), <a href="#suffix">suffix</a>() or leading or trailing whitespace.
|
|
<p>Get this property's value with <a href="#cleanText">cleanText</a>().
|
|
<p><p>See also <a href="#text-prop">text</a>, <a href="#prefix-prop">prefix</a>, and <a href="#suffix-prop">suffix</a>.
|
|
|
|
<h3 class=fn>int <a name="lineStep-prop"></a>lineStep</h3>
|
|
<p>This property holds the line step.
|
|
<p>When the user uses the arrows to change the spin box's value the
|
|
value will be incremented/decremented by the amount of the line
|
|
step.
|
|
<p> The <a href="#setLineStep">setLineStep</a>() function calls the virtual <a href="ntqrangecontrol.html#stepChange">stepChange</a>() function
|
|
if the new line step is different from the previous setting.
|
|
<p> <p>See also <a href="ntqrangecontrol.html#setSteps">TQRangeControl::setSteps</a>() and <a href="ntqrangecontrol.html#setRange">setRange</a>().
|
|
|
|
<p>Set this property's value with <a href="#setLineStep">setLineStep</a>() and get this property's value with <a href="#lineStep">lineStep</a>().
|
|
<h3 class=fn>int <a name="maxValue-prop"></a>maxValue</h3>
|
|
<p>This property holds the maximum value of the spin box.
|
|
<p>When setting this property, <a href="#minValue-prop">TQSpinBox::minValue</a> is adjusted, if
|
|
necessary, to ensure that the range remains valid.
|
|
<p> <p>See also <a href="ntqrangecontrol.html#setRange">setRange</a>() and <a href="#specialValueText-prop">specialValueText</a>.
|
|
|
|
<p>Set this property's value with <a href="#setMaxValue">setMaxValue</a>() and get this property's value with <a href="#maxValue">maxValue</a>().
|
|
<h3 class=fn>int <a name="minValue-prop"></a>minValue</h3>
|
|
<p>This property holds the minimum value of the spin box.
|
|
<p>When setting this property, <a href="#maxValue-prop">TQSpinBox::maxValue</a> is adjusted, if
|
|
necessary, to ensure that the range remains valid.
|
|
<p> <p>See also <a href="ntqrangecontrol.html#setRange">setRange</a>() and <a href="#specialValueText-prop">specialValueText</a>.
|
|
|
|
<p>Set this property's value with <a href="#setMinValue">setMinValue</a>() and get this property's value with <a href="#minValue">minValue</a>().
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="prefix-prop"></a>prefix</h3>
|
|
<p>This property holds the spin box's prefix.
|
|
<p>The prefix is prepended to the start of the displayed value.
|
|
Typical use is to display a unit of measurement or a currency
|
|
symbol. For example:
|
|
<p> <pre>
|
|
sb->setPrefix( "$" );
|
|
</pre>
|
|
|
|
<p> To turn off the prefix display, set this property to an empty
|
|
string. The default is no prefix. The prefix is not displayed for
|
|
the <a href="#minValue">minValue</a>() if <a href="#specialValueText">specialValueText</a>() is not empty.
|
|
<p> If no prefix is set, <a href="#prefix">prefix</a>() returns <a href="ntqstring.html#TQString-null">TQString::null</a>.
|
|
<p> <p>See also <a href="#suffix-prop">suffix</a>.
|
|
|
|
<p>Set this property's value with <a href="#setPrefix">setPrefix</a>() and get this property's value with <a href="#prefix">prefix</a>().
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="specialValueText-prop"></a>specialValueText</h3>
|
|
<p>This property holds the special-value text.
|
|
<p>If set, the spin box will display this text instead of a numeric
|
|
value whenever the current value is equal to minVal(). Typical use
|
|
is to indicate that this choice has a special (default) meaning.
|
|
<p> For example, if your spin box allows the user to choose the margin
|
|
width in a print dialog and your application is able to
|
|
automatically choose a good margin width, you can set up the spin
|
|
box like this:
|
|
<pre>
|
|
TQSpinBox marginBox( -1, 20, 1, parent, "marginBox" );
|
|
marginBox-><a href="#setSuffix">setSuffix</a>( " mm" );
|
|
marginBox-><a href="#setSpecialValueText">setSpecialValueText</a>( "Auto" );
|
|
</pre>
|
|
|
|
The user will then be able to choose a margin width from 0-20
|
|
millimeters or select "Auto" to leave it to the application to
|
|
choose. Your code must then interpret the spin box value of -1 as
|
|
the user requesting automatic margin width.
|
|
<p> All values are displayed with the <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>() (if set),
|
|
<em>except</em> for the special value, which only shows the special
|
|
value text.
|
|
<p> To turn off the special-value text display, call this function
|
|
with an empty string. The default is no special-value text, i.e.
|
|
the numeric value is shown as usual.
|
|
<p> If no special-value text is set, <a href="#specialValueText">specialValueText</a>() returns
|
|
<a href="ntqstring.html#TQString-null">TQString::null</a>.
|
|
|
|
<p>Set this property's value with <a href="#setSpecialValueText">setSpecialValueText</a>() and get this property's value with <a href="#specialValueText">specialValueText</a>().
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="suffix-prop"></a>suffix</h3>
|
|
<p>This property holds the suffix of the spin box.
|
|
<p>The suffix is appended to the end of the displayed value. Typical
|
|
use is to display a unit of measurement or a currency symbol. For
|
|
example:
|
|
<p> <pre>
|
|
sb->setSuffix( " km" );
|
|
</pre>
|
|
|
|
<p> To turn off the suffix display, set this property to an empty
|
|
string. The default is no suffix. The suffix is not displayed for
|
|
the <a href="#minValue">minValue</a>() if <a href="#specialValueText">specialValueText</a>() is not empty.
|
|
<p> If no suffix is set, <a href="#suffix">suffix</a>() returns a <a href="ntqstring.html#TQString-null">TQString::null</a>.
|
|
<p> <p>See also <a href="#prefix-prop">prefix</a>.
|
|
|
|
<p>Set this property's value with <a href="#setSuffix">setSuffix</a>() and get this property's value with <a href="#suffix">suffix</a>().
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text-prop"></a>text</h3>
|
|
<p>This property holds the spin box's text, including any <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>().
|
|
<p>There is no default text.
|
|
<p> <p>See also <a href="#value-prop">value</a>.
|
|
|
|
<p>Get this property's value with <a href="#text">text</a>().
|
|
<h3 class=fn>int <a name="value-prop"></a>value</h3>
|
|
<p>This property holds the value of the spin box.
|
|
<p>Set this property's value with <a href="#setValue">setValue</a>() and get this property's value with <a href="#value">value</a>().
|
|
<p><p>See also <a href="ntqrangecontrol.html#setValue">TQRangeControl::setValue</a>().
|
|
|
|
<h3 class=fn>bool <a name="wrapping-prop"></a>wrapping</h3>
|
|
<p>This property holds whether it is possible to step the value from the highest value to the lowest value and vice versa.
|
|
<p>By default, wrapping is turned off.
|
|
<p> If you have a range of 0..100 and wrapping is off when the user
|
|
reaches 100 and presses the Up Arrow nothing will happen; but if
|
|
wrapping is on the value will change from 100 to 0, then to 1,
|
|
etc. When wrapping is on, navigating past the highest value takes
|
|
you to the lowest and vice versa.
|
|
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, and <a href="ntqrangecontrol.html#setRange">setRange</a>().
|
|
|
|
<p>Set this property's value with <a href="#setWrapping">setWrapping</a>() and get this property's value with <a href="#wrapping">wrapping</a>().
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|