|
|
KIntNumInput combines a QSpinBox and optionally a QSlider with a label to make an easy to use control for setting some integer parameter. This is especially nice for configuration dialogs, which can have many such combinated controls.
A special feature of KIntNumInput, designed specifically for the situation when there are several KIntNumInputs in a column, is that you can specify what portion of the control is taken by the QSpinBox (the remaining portion is used by the slider). This makes it very simple to have all the sliders in a column be the same size.
It uses KIntValidator validator class. KIntNumInput enforces the value to be in the given range, and can display it in any base between 2 and 36.
KIntNumInput (const QString& label, int lower, int upper, int step, int value, const QString& units, int base = 10, bool slider = true, QWidget *parent=0, const char *name=0) |
Constructor
Parameters:
label | main label for the control |
lower | lower bound on range |
upper | upper bound on range |
step | step size for the QSlider |
value | initial value for the control |
units | the units for the control (can be empty or 0) |
base | numeric base (default is 10) |
slider | whether a slider should be added (default: true) |
parent | parent QWidget |
name | internal name for this widget |
KIntNumInput (int lower, int upper, int step, int value, QWidget* parent=0, const QString& label = QString::null, const QString& units = QString::null, bool slider = true, int base = 10, const char* name = 0) |
overloaded constructor, provided for convenience
QSize minimumSize () |
This method returns the minimum size necessary to display the control. The minimum size is enough to show all the labels in the current font (font change may invalidate the return value).
Returns: the minimum size necessary to show the control
QSize sizeHint () |
Returns a size which fits the contents of the control.
Returns: the preferred size necessary to show the control
int value () |
Returns: the current value
void setSteps (int minor, int major) |
Sets the spacing of tockmarks for the slider.
Parameters:
minor | minor tickmark separation |
major | major tickmark separation |
void setLabelAlignment (int a) |
Sets the alignment of the main control label. The value label, including the specified units, is always centered under the slider.
Parameters:
a | one of AlignLeft, AlignCenter, AlignRight |
void setSpinBoxSize (int frac) |
Sets the fraction of the controls width taken by the SpinBox. 100-frac is taken by the slider (if exists).
default is 33 (33%)
Parameters:
frac | fraction (1..100) of width taken by SpinBox |
QSizePolicy sizePolicy () |
Specifies that this widget may stretch horizontally, but is fixed vertically (like QSpinBox itself)
void setSpecialValueText (const QString& text) |
Sets the special value text. If set, the SpinBox will display this text instead of the numeric value whenever the current value is equal to minVal(). Typically this is used for indicating that the choice has a special (default) meaning.
void setEnabled (bool) |
Sets the Widget enabled/disabled
void setValue (int) |
Sets the value of the control.