📄 qspinbox.3qt
字号:
.TP\fCPlusMinus\fR - the buttons show '+' and '-' symbols. This is often considered to be more meaningful than \fCUpDownArrows.\fR.IP.SH MEMBER FUNCTION DOCUMENTATION.SH "QSpinBox::QSpinBox ( QWidget * parent = 0, const char * name = 0 )"Constructs a spin box with the default QRangeControl range and step values..PPSee also minValue(), maxValue(), setRange(), lineStep() and setSteps()..SH "QSpinBox::QSpinBox ( int minValue, int maxValue, int step = 1, QWidget * parent = 0, const char * name = 0 )"Constructs a spin box with range from \fIminValue\fR to \fImaxValue\fR inclusive, with step amount \fIstep.\fR The value is initially set to \fIminValue.\fR.PPSee also minValue(), maxValue(), setRange(), lineStep() and setSteps()..SH "QSpinBox::~QSpinBox ()"Destroys the spin box, freeing all memory and other resources..SH "QSpinBox::ButtonSymbols QSpinBox::buttonSymbols() const"Returns the current button symbol mode. The default is \fCUpDownArrows.\fR.PPSee also setButtonSymbols() and ButtonSymbols..SH "QString QSpinBox::cleanText () const \fC[virtual]\fR"Returns a copy of the current text of the spin box with any prefix and/or suffix and white space at the start and end removed..PPSee also text(), setPrefix() and setSuffix()..SH "QString QSpinBox::currentValueText () \fC[protected]\fR"Returns the full text calculated from the current value, including any prefix, suffix or special-value text..SH "QPushButton* QSpinBox::downButton () const \fC[protected]\fR"Returns a pointer to the embedded 'down' button..SH "QLineEdit* QSpinBox::editor () const \fC[protected]\fR"Returns a pointer to the embedded QLineEdit..SH "bool QSpinBox::eventFilter ( QObject * obj, QEvent * ev ) \fC[virtual protected]\fR"Intercepts and handles those events coming to the embedded QLineEdit which have special meaning for the QSpinBox..PPReimplemented from QObject..SH "void QSpinBox::interpretText () \fC[virtual protected]\fR"QSpinBox calls this after the user has manually edited the contents of the spin box (not using the up/down buttons/keys)..PPThe default implementation of this function interprets the new text using mapTextToValue(). If mapTextToValue() is successful, it changes the spin box' value. If not the value if left unchanged..SH "void QSpinBox::leaveEvent ( QEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QSpinBox::lineStep () const"Reimplemented for internal reasons; the API is not affected..SH "int QSpinBox::mapTextToValue ( bool * ok ) \fC[virtual protected]\fR"This virtual function is used by the spin box whenever it needs to interpret the text entered by the user as a value. The default implementation tries to interpret it as an integer in the standard way, and returns the integer value..PPReimplement this function in in a subclass if you want a specialized spin box, handling something else than integers. It should call text() (or cleanText() ) and return the value corresponding to that text. If the text does not represent a legal value (uninterpretable), the bool pointed to by \fIok\fR should be set to FALSE..PPThis function need not be concerned with special-value text, the QSpinBox handles that automatically..PPSee also interpretText() and mapValueToText()..SH "QString QSpinBox::mapValueToText ( int v ) \fC[virtual protected]\fR"This virtual function is used by the spin box whenever it needs to display value \fIv.\fR The default implementation returns a string containing \fIv\fR printed in the standard way..PPReimplement this function in in a subclass if you want a specialized spin box, handling something else than integers. This function need not be concerned with prefix or suffix or special-value text, the QSpinBox handles that automatically..PPSee also updateDisplay() and mapTextToValue()..SH "int QSpinBox::maxValue () const"Reimplemented for internal reasons; the API is not affected..SH "int QSpinBox::minValue () const"Reimplemented for internal reasons; the API is not affected..SH "QString QSpinBox::prefix () const \fC[virtual]\fR"Returns the currently set prefix, or a null string if no prefix is set..PPSee also setPrefix(), setSuffix() and suffix()..SH "void QSpinBox::rangeChange () \fC[virtual protected]\fR"This method gets called by QRangeControl whenever the range has changed. It adjusts the default validator and updates the display..SH "void QSpinBox::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QSpinBox::setButtonSymbols ( ButtonSymbols newSymbols )"Sets the spin box to display \fInewSymbols\fR on its buttons. \fInewSymbols\fR can be either \fCUpDownArrows\fR (the default) or \fCPlusMinus.\fR.PPSee also buttonSymbols() and ButtonSymbols..SH "void QSpinBox::setEnabled ( bool on ) \fC[virtual slot]\fR"Reimplemented for internal reasons; the API is not affected..SH "void QSpinBox::setLineStep ( int i )"Sets the line step to \fIi.\fR.PPCalls the virtual stepChange() function if the new line step is different from the previous setting..PPSee also lineStep(), QRangeControl::setSteps() and setRange()..SH "void QSpinBox::setMaxValue ( int i )"A convenience function which just calls setRange( minValue(), i ).PPSee also setRange()..SH "void QSpinBox::setMinValue ( int i )"A convenience function which just calls setRange( i, maxValue() ).PPSee also setRange()..SH "void QSpinBox::setPrefix ( const QString & text ) \fC[virtual slot]\fR"Sets the prefix to \fItext.\fR The prefix is prepended to the start of the displayed value. Typical use is to indicate the unit of measurement to the user. eg..PP.nf.br sb->setPrefix("$");.fi.PPTo turn off the prefix display, call this function with an empty string as parameter. The default is no prefix..PPSee also prefix(), setSuffix() and suffix()..SH "void QSpinBox::setSpecialValueText ( const QString & text ) \fC[virtual]\fR"Sets the special-value text to \fItext.\fR If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minVal(). Typically used for indicating that this choice has a special (default) meaning..PPFor 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:.PP.nf.br QSpinBox marginBox( -1, 20, 1, parent, "marginBox" );.br marginBox->setSuffix( " mm" );.br marginBox->setSpecialValueText( "Auto" );.fi.PPThe 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..PPNeither prefix nor suffix, if set, are added to the special-value text when displayed..PPTo turn off the special-value text display, call this function with an empty string as parameter. The default is no special-value text, i.e. the numeric value is shown as usual..PPSee also specialValueText()..SH "void QSpinBox::setSuffix ( const QString & text ) \fC[virtual slot]\fR"Sets the suffix to \fItext.\fR The suffix is appended to the end of the displayed value. Typical use is to indicate the unit of measurement to the user. eg..PP.nf.br sb->setSuffix("cm");.fi.PPTo turn off the suffix display, call this function with an empty string as parameter. The default is no suffix..PPSee also suffix(), setPrefix() and prefix()..SH "void QSpinBox::setValidator ( const QValidator * v ) \fC[virtual]\fR"Sets the validator to \fIv.\fR The validator controls what keyboard input is accepted when the user is editing in the value field. The default is to use a suitable QIntValidator..PPUse setValidator(0) to turn off input validation (entered input will still be clamped to the range of the spinbox)..SH "void QSpinBox::setValue ( int value ) \fC[virtual slot]\fR"Sets the current value of the spin box to \fIvalue.\fR This is QRangeControl::setValue() made available as a slot..SH "void QSpinBox::setWrapping ( bool on ) \fC[virtual]\fR"Setting wrapping to TRUE will allow the value to be stepped from the highest value to the lowest, and vice versa. By default, wrapping is turned off..PPSee also wrapping(), minValue(), maxValue() and setRange()..SH "QSize QSpinBox::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSizePolicy QSpinBox::sizePolicy () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QString QSpinBox::specialValueText () const"Returns the currently special-value text, or a null string if no special-value text is currently set..PPSee also setSpecialValueText()..SH "void QSpinBox::stepDown () \fC[virtual slot]\fR"Decreases the current value one step, wrapping as necessary. This is the same as clicking on the pointing-down button, and can be used for e.g. keyboard accelerators..PPSee also stepUp(), subtractLine(), lineStep(), setSteps(), setValue() and value()..SH "void QSpinBox::stepUp () \fC[virtual slot]\fR"Increases the current value one step, wrapping as necessary. This is the same as clicking on the pointing-up button, and can be used for e.g. keyboard accelerators..PPSee also stepDown(), addLine(), lineStep(), setSteps(), setValue() and value()..SH "void QSpinBox::styleChange ( QStyle & old ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QString QSpinBox::suffix () const \fC[virtual]\fR"Returns the currently set suffix, or a null string if no suffix is set..PPSee also setSuffix(), setPrefix() and suffix()..SH "QString QSpinBox::text () const"Returns the current text of the spin box, including any prefix() and suffix()..PPSee also value()..SH "void QSpinBox::textChanged () \fC[protected slot]\fR"This slot gets called whenever the user edits the text of the spin box..SH "QPushButton* QSpinBox::upButton () const \fC[protected]\fR"Returns a pointer to the embedded 'up' button..SH "void QSpinBox::updateDisplay () \fC[virtual protected]\fR"Updates the contents of the embedded QLineEdit to reflect current value, using mapValueToText(). Also enables/disables the push buttons accordingly..PPSee also mapValueToText()..SH "const QValidator * QSpinBox::validator () const"Returns the validator which constrains editing for this spin box if there is any, or else 0..PPSee also setValidator() and QValidator..SH "int QSpinBox::value () const"Reimplemented for internal reasons; the API is not affected..SH "void QSpinBox::valueChange () \fC[virtual protected]\fR"This method gets called by QRangeControl whenever the value has changed. Updates the display and emits the valueChanged() signals..SH "void QSpinBox::valueChanged ( const QString & valueText ) \fC[signal]\fR"This signal is emitted whenever the valueChanged( int ) signal is emitted, i.e. every time the value of the spin box changes (whatever the cause - by setValue(), by a keyboard accelerator, by mouse clicks etc.)..PPThe \fIvalueText\fR parameter is the same string that is displayed in the edit field of the spin box..PPSee also value()..SH "void QSpinBox::valueChanged ( int value ) \fC[signal]\fR"This signal is emitted every time the value of the spin box changes (whatever the cause - by setValue(), by a keyboard accelerator, by mouse clicks etc.)..PPNote that it is emitted \fIevery\fR time, not just for the "final" step - if the user clicks 'up' three times, this signal is emitted three times..PPSee also value()..SH "void QSpinBox::wheelEvent ( QWheelEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QSpinBox::wrapping () const"Returns the current setWrapping() value..SH "SEE ALSO".BR http://doc.trolltech.com/qspinbox.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qspinbox.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -