📄 qrangecontrol.3qt
字号:
.TH QRangeControl 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 NAMEQRangeControl \- Integer value within a range.SH SYNOPSIS.br.PP\fC#include <qrangecontrol.h>\fR.PPInherited by QDial, QScrollBar, QSlider and QSpinBox..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQRangeControl\fR ()".br.ti -1c.BI "\fBQRangeControl\fR ( int " "minValue" ", int " "maxValue" ", int " "lineStep" ", int " "pageStep" ", int value )".br.ti -1c.BI "int \fBvalue\fR () const".br.ti -1c.BI "void \fBsetValue\fR ( int )".br.ti -1c.BI "void \fBaddPage\fR ()".br.ti -1c.BI "void \fBsubtractPage\fR ()".br.ti -1c.BI "void \fBaddLine\fR ()".br.ti -1c.BI "void \fBsubtractLine\fR ()".br.ti -1c.BI "int \fBminValue\fR () const".br.ti -1c.BI "int \fBmaxValue\fR () const".br.ti -1c.BI "void \fBsetRange\fR ( int " "minValue" ", int maxValue )".br.ti -1c.BI "int \fBlineStep\fR () const".br.ti -1c.BI "int \fBpageStep\fR () const".br.ti -1c.BI "void \fBsetSteps\fR ( int " "line" ", int page )".br.ti -1c.BI "int \fBbound\fR ( int ) const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "int \fBpositionFromValue\fR ( int " "val" ", int space ) const".br.ti -1c.BI "int \fBvalueFromPosition\fR ( int " "pos" ", int space ) const".br.ti -1c.BI "void \fBdirectSetValue\fR ( int val )".br.ti -1c.BI "int \fBprevValue\fR () const".br.ti -1c.BI "virtual void \fBvalueChange\fR ()".br.ti -1c.BI "virtual void \fBrangeChange\fR ()".br.ti -1c.BI "virtual void \fBstepChange\fR ()".br.in -1c.SH DESCRIPTIONThe QRangeControl class provides an integer value within a range..PPIt was originally designed for the QScrollBar widget, but it can also be practical for other purposes. QSlider, QSpinBox and QDial also inherit QRangeControl. Here are the five main concepts the class has: .IP.TPThe current value. This is the bounded integer that QRangeControl maintains. value() returns this, and several functions including setValue() set it..IP.TPThe minimum. This is the lowest value value() can ever return. Returned by minValue(), set by setRange() or one of the constructors..IP.TPThe maximum. This is the highest value value() can ever return. Returned by maxValue(), set by setRange() or one of the constructors..IP.TPThe line step. This is the smaller of two natural steps QRangeControl provides, and typically corresponds to the user pressing an arrow key. Returned by lineStep(), set using setSteps(), and the addLine() and subtractLine() allow easy movement of the current value by lineStep()..IP.TPThe page step. This is the larger of two natural steps QRangeControl provides, and typically corresponds to the user pressing one of the PageUp and PageDown keys. Returned by pageStep(), set using setSteps(), and the addPage() and substractPage() allow easy movement of the current value by pageStep()..IP.PPNote that unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minValue()+n*lineStep() for integer values of n. Some widgets may allow the user to set any value at all, others may just provide multiples of lineStep()/pageStep(). The choice is up to you..PPQRangeControl provides three virtual functions that are well-suited e.g. to updating the on-screen representation of range controls and emitting signals, namely valueChange(), rangeChange() and stepChange()..PPFinally, QRangeControl provides a function called bound() to let you force arbitrary integers to within the range of a range control..PPWe recommend that all widgets provide at least a signal called valueChanged(), and many widgets will want to provide addStep(), addPage(), substractStep() and substractPage() as slots..SH MEMBER FUNCTION DOCUMENTATION.SH "QRangeControl::QRangeControl ()"Constructs a range control with min value 0, max value 99, line step 1, page step 10 and initial value 0..SH "QRangeControl::QRangeControl ( int minValue, int maxValue, int lineStep, int pageStep, int value )"Constructs a range control whose value can never be smaller than \fIminValue\fR or greater than \fImaxValue,\fR whose line step size is \fIlineStep\fR and page step size is \fIpageStep,\fR and whose value is initially \fIvalue.\fR.PP\fIvalue\fR is forced to be within the legal range..SH "void QRangeControl::addLine ()"Equivalent to.PP.nf.br setValue( value()+lineStep() ).fiplus a test for numerical overflow.PPSee also: subtractLine()..SH "void QRangeControl::addPage ()"Equivalent to.PP.nf.br setValue( value()+pageStep() ).fiplus a test for numerical overflow..PPSee also: subtractPage()..SH "int QRangeControl::bound ( int v ) const"Forces \fIv\fR within the range from minValue() to maxValue() inclusive, and returns the result..PPThis function is provided so that you can easily force other numbers than value() into the allowed range. You do not need to call it in order to use QRangeControl itself..PPSee also: setValue(), value(), minValue() and maxValue()..SH "void QRangeControl::directSetValue ( int value ) \fC[protected]\fR"Sets the range control value directly without calling valueChange()..PPForces the new value to be within the legal range..PPSee also: setValue()..SH "int QRangeControl::lineStep () const"Returns the current line step..PPSee also: setSteps() and pageStep()..SH "int QRangeControl::maxValue () const"Returns the current maximum value in the range..PPSee also: setRange() and minValue()..SH "int QRangeControl::minValue () const"Returns the current minimum value in the range..PPSee also: setRange() and maxValue()..SH "int QRangeControl::pageStep () const"Returns the current page step..PPSee also: setSteps() and lineStep()..SH "int QRangeControl::positionFromValue ( int logical_val, int span ) const \fC[protected]\fR"Converts \fIlogical_val\fR to a pixel position. minValue() maps to 0, maxValue() maps to \fIspan,\fR and other values are distributed evenly in between..PPThis function can handle the entire integer range without overflow..SH "int QRangeControl::prevValue () const \fC[protected]\fR"Returns the previous value of the range control. When the range control is initially created, this is the same as value()..PPNote that prevValue() can be outside the legal range if a call to setRange() causes the current value to change. (For example if the range was 0-1000 and the current value 500, setRange( 0, 400 ) makes value() return 400 and prevValue() 500.).PPSee also: value() and setRange()..SH "void QRangeControl::rangeChange () \fC[virtual protected]\fR"This virtual function is called whenever the range control range changes. You can reimplement it if you want to be notified when the range changes. The default implementation does nothing..PPSee also: setRange(), valueChange() and stepChange()..PPReimplemented in QSlider, QDial and QScrollBar..SH "void QRangeControl::setRange ( int minValue, int maxValue )"Sets the range min value to \fIminValue\fR and the max value to \fImaxValue.\fR.PPCalls the virtual rangeChange() function if one or both of the new min and max values are different from the previous setting. Calls the virtual valueChange() function if the current value is adjusted because or was is outside the new range..PPIf \fImaxValue\fR is smaller than \fIminValue, minValue\fR becomes the only legal value..PPSee also: minValue() and maxValue()..PPExamples:.(lxform/xform.cpp.)l.SH "void QRangeControl::setSteps ( int lineStep,int pageStep )"Sets the range line step to \fIlineStep\fR and page step to \fIpageStep.\fR.PPCalls the virtual stepChange() function if the new line step and/or page step are different from the previous setting..PPSee also: lineStep(), pageStep() and setRange()..SH "void QRangeControl::setValue ( int value )"Sets the range control value to \fIvalue\fR and forces it to be within the legal range..PPCalls the virtual valueChange() function if the new value is different from the previous value..SH "void QRangeControl::stepChange () \fC[virtual protected]\fR"This virtual function is called whenever the range control step value changes. You can reimplement it if you want to be notified when the step changes. The default implementation does nothing..PPSee also: setSteps(), rangeChange() and valueChange()..PPReimplemented in QScrollBar..SH "void QRangeControl::subtractLine ()"Equivalent to.PP.nf.br setValue( value()-lineStep() ).fiplus a test for numerical underflow.PPSee also: addLine()..SH "void QRangeControl::subtractPage ()"Equivalent to.PP.nf.br setValue( value()-pageStep() ).fiplus a test for numerical underflow.PPSee also: addPage()..SH "int QRangeControl::value () const"Returns the current range control value. This is guaranteed to be within the range [ minValue() ... maxValue() ]..PPSee also: setValue() and prevValue()..PPExamples:.(lxform/xform.cpp.)l.SH "void QRangeControl::valueChange () \fC[virtual protected]\fR"This virtual function is called whenever the range control value changes. You can reimplement it if you want to be notified when the value changes. The default implementation does nothing..PPSee also: setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange() and stepChange()..PPReimplemented in QDial, QSlider and QScrollBar..SH "int QRangeControl::valueFromPosition ( int pos, int span ) const \fC[protected]\fR"Converts the pixel position \fIpos\fR to a value. 0 maps to minValue(), \fIspan\fR maps to maxValue(), and other values are distributed evenly in between..PPThis function can handle the entire integer range without overflow..SH "SEE ALSO".BR http://www.troll.no/qt/qrangecontrol.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 + -