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

📄 qspinbox.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QSpinBox 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech 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 (spin button).SH SYNOPSIS\fC#include <qspinbox.h>\fR.PPInherits QWidget 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 "enum \fBButtonSymbols\fR { UpDownArrows, PlusMinus }".br.ti -1c.BI "virtual void \fBsetButtonSymbols\fR ( ButtonSymbols )".br.ti -1c.BI "ButtonSymbols \fBbuttonSymbols\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 "int \fBminValue\fR () const".br.ti -1c.BI "int \fBmaxValue\fR () const".br.ti -1c.BI "void \fBsetMinValue\fR ( int )".br.ti -1c.BI "void \fBsetMaxValue\fR ( int )".br.ti -1c.BI "int \fBlineStep\fR () const".br.ti -1c.BI "void \fBsetLineStep\fR ( int )".br.ti -1c.BI "int \fBvalue\fR () const".br.ti -1c.BI "QRect \fBupRect\fR () const".br.ti -1c.BI "QRect \fBdownRect\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 \fBselectAll\fR ()".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 "Properties".in +1c.ti -1c.BI "ButtonSymbols \fBbuttonSymbols\fR - the current button symbol mode".br.ti -1c.BI "QString \fBcleanText\fR - the spin box's text with no prefix(), suffix() or leading or trailing whitespace  \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBlineStep\fR - the line step".br.ti -1c.BI "int \fBmaxValue\fR - the maximum value of the spin box".br.ti -1c.BI "int \fBminValue\fR - the minimum value of the spin box".br.ti -1c.BI "QString \fBprefix\fR - the spin box's prefix".br.ti -1c.BI "QString \fBspecialValueText\fR - the special-value text".br.ti -1c.BI "QString \fBsuffix\fR - the suffix of the spin box".br.ti -1c.BI "QString \fBtext\fR - the spin box's " "text" ", including any prefix() and suffix()  \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBvalue\fR - the value of the spin box".br.ti -1c.BI "bool \fBwrapping\fR - whether it is possible to step the value from the highest value to the lowest value and vice versa".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual QString \fBmapValueToText\fR ( int v )".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 "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 * o, QEvent * ev )".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 (spin button)..PPQSpinBox 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..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 keeps the value within a numeric range, and to multiples of the lineStep() size (see QRangeControl 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 setMinValue(), setMaxValue() and setLineStep()..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() if you want circular behavior..PPThe displayed value can be prepended and appended with arbitrary strings indicating, for example, currency or the unit of measurement. See setPrefix() and setSuffix(). The text in the spin box is retrieved with text() (which includes any prefix() and suffix()), or with cleanText() (which has no prefix(), no suffix() and no leading or trailing whitespace). currentValueText() returns the spin box's current value as text..PPNormally the spin box displays up and down arrows in the buttons. You can use setButtonSymbols() to change the display to show \fB+\fR and \fB-\fR symbols if you prefer. In either case the up and down arrow keys work as expected..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 QWidget::focusPolicy() is StrongFocus..PPIf using prefix(), suffix() and specialValueText() don't provide enough control, you can ignore them and subclass QSpinBox instead..PPQSpinBox 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 mapValueToText() and mapTextToValue(), and setting another suitable validator using setValidator()..PPFor 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:.PP.nf.br        class MySpinBox : public QSpinBox.br        {.br            Q_OBJECT.br        public:.br            ....br.br            QString mapValueToText( int value ).br            {.br                if ( value == -1 ) // special case.br                    return QString( "Auto" );.br.br                return QString( "%1.%2" ) // 0.0 to 10.0.br                    .arg( value / 10 ).arg( value % 10 );.br            }.br.br            int mapTextToValue( bool *ok ).br            {.br                if ( text() == "Auto" ) // special case.br                    return -1;.br.br                return (int) ( 10 * text().toFloat() ); // 0 to 100.br            }.br        };.br.fi.PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also QScrollBar, QSlider, GUI Design Handbook: Spin Box, and Basic Widgets..SS "Member Type Documentation".SH "QSpinBox::ButtonSymbols"This enum type determines what the buttons in a spin box show..TP\fCQSpinBox::UpDownArrows\fR - the buttons show little arrows in the classic style..TP\fCQSpinBox::PlusMinus\fR - the buttons show \fB+\fR and \fB-\fR symbols..PPSee also QSpinBox::buttonSymbols..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. It is called \fIname\fR and has parent \fIparent\fR..PP

⌨️ 快捷键说明

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