⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qspinbox.3qt

📁 tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件
💻 3QT
字号:
.TH QSpinBox 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQSpinBox \- Spin box widget, sometimes called up-down widget, little arrows widget or spin button.SH SYNOPSIS.br.PP\fC#include <qspinbox.h>\fR.PPInherits QFrame and QRangeControl..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQSpinBox\fR ( QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "\fBQSpinBox\fR ( int " "minValue" ", int " "maxValue" ", int " "step" " = 1, QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "\fB~QSpinBox\fR ()".br.ti -1c.BI "QString \fBtext\fR () const".br.ti -1c.BI "virtual QString \fBprefix\fR () const".br.ti -1c.BI "virtual QString \fBsuffix\fR () const".br.ti -1c.BI "virtual QString \fBcleanText\fR () const".br.ti -1c.BI "virtual void \fBsetSpecialValueText\fR ( const QString & text )".br.ti -1c.BI "QString \fBspecialValueText\fR () const".br.ti -1c.BI "virtual void \fBsetWrapping\fR ( bool on )".br.ti -1c.BI "bool \fBwrapping\fR () const".br.ti -1c.BI "virtual void \fBsetValidator\fR ( const QValidator * v )".br.ti -1c.BI "const QValidator* \fBvalidator\fR () const".br.ti -1c.BI "virtual QSize \fBsizeHint\fR () const".br.ti -1c.BI "virtual QSizePolicy \fBsizePolicy\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetValue\fR ( int value )".br.ti -1c.BI "virtual void \fBsetPrefix\fR ( const QString & text )".br.ti -1c.BI "virtual void \fBsetSuffix\fR ( const QString & text )".br.ti -1c.BI "virtual void \fBstepUp\fR ()".br.ti -1c.BI "virtual void \fBstepDown\fR ()".br.ti -1c.BI "virtual void \fBsetEnabled\fR ( bool )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBvalueChanged\fR ( int value )".br.ti -1c.BI "void \fBvalueChanged\fR ( const QString & valueText )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual QString \fBmapValueToText\fR ( int value )".br.ti -1c.BI "virtual int \fBmapTextToValue\fR ( bool * ok )".br.ti -1c.BI "QString \fBcurrentValueText\fR ()".br.ti -1c.BI "virtual void \fBupdateDisplay\fR ()".br.ti -1c.BI "virtual void \fBinterpretText\fR ()".br.ti -1c.BI "QPushButton* \fBupButton\fR () const".br.ti -1c.BI "QPushButton* \fBdownButton\fR () const".br.ti -1c.BI "QLineEdit* \fBeditor\fR () const".br.ti -1c.BI "virtual void \fBvalueChange\fR ()".br.ti -1c.BI "virtual void \fBrangeChange\fR ()".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject * " "obj" ", QEvent * ev )".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * ev )".br.ti -1c.BI "virtual void \fBwheelEvent\fR ( QWheelEvent * )".br.ti -1c.BI "virtual void \fBstyleChange\fR ( QStyle & )".br.in -1c.SS "Protected Slots".in +1c.ti -1c.BI "void \fBtextChanged\fR ()".br.in -1c.SH DESCRIPTIONThe QSpinBox class provides a spin box widget, sometimes called up-down widget, little arrows widget or spin button..PPQSpinBox allows the user to choose an integer 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..PPEvery time the value changes, QSpinBox emits the valueChanged() signal. The current value can be fetched with value() and set with setValue()..PPThe spin box clamps the value within a numeric range, see QRangeControl for details. Clicking the up/down down buttons (or using the keyboard accelerators: Up-arrow and Down-arrow) will increase or decrease the current value in steps of size lineStep()..PPMost spin boxes are directional, but QSpinBox 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 setWrapping() to if you want circular behavior..PPThe displayed value can be appended and/or prepended with an arbitrary string indicating for example the unit of measurement. See setPrefix() and setSuffix()..PPIt is often desirable to give the user a special, often default, choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with QSpinBox..PPThe default focus policy is StrongFocus..PPQSpinBox can easily be subclassed to allow the user to input other things than a numeric value, as long as the allowed input can be mapped down to a range of integers. This can be done by overriding the virtual functions mapValueToText() and mapTextToValue() and setting another, suitable validator using setValidator()..PP<img src=qspinbox-m.png> <img src=qspinbox-w.png>.PPSee also: QScrollBar, QSlider and GUI Design Handbook: Spin Box.SH MEMBER FUNCTION DOCUMENTATION.SH "QSpinBox::QSpinBox ( QWidget * parent = 0, const char * name = 0 )"Creates a spin box with the default QRangeControl range and step value..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 )"Creates a spin box with range from \fIminValue\fR to \fImaxValue\fR inclusive, with step value \fIstep.\fR The value is set to \fIminValue.\fR.PPSee also: minValue(), maxValue(), setRange(), lineStep() and setSteps()..SH "QSpinBox::~QSpinBox ()"Deletes the spin box, freeing all memory and other resources..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 of the current value, i.e. 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"Called after the user has manually edited the contents of the spin box. Interprets the text using mapTextToValue(), and calls setValue() if successful..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..PPOverride 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..PPOverride 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 "QString QSpinBox::prefix () const \fC[virtual]\fR"Returns the currently set prefix, or 0 if no prefix is currently 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"Handles resize events for the spin box..PPReimplemented from QWidget..SH "void QSpinBox::setEnabled ( bool on ) \fC[virtual slot]\fR"Reimplemented for internal reasons; the API is not affected..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..PPTo turn off the prefix display, call this function with 0 or 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 you use a spin box for letting the user choose 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 0 or 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..PPTo turn off the suffix display, call this function with 0 or 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"Returns a good-looking size for the spin box..PPReimplemented from QWidget..SH "QSizePolicy QSpinBox::sizePolicy () const \fC[virtual]\fR"Specifies that this widget may stretch horizontally, but is fixed vertically..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 0 if no suffix is currently set..PPSee also: setSuffix(), setPrefix() and suffix()..SH "QString QSpinBox::text () const"Returns the current text of the spin box..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 "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 string pointed to by \fIvalueText\fR 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"Handles wheel events for the spinbox..PPReimplemented from QWidget..SH "bool QSpinBox::wrapping () const"Returns the current setWrapping() value..SH "SEE ALSO".BR http://www.troll.no/qt/qspinbox.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS.  See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -