class KIntNumInput

Easy integer parameter entry, with spin and slider. More...

Definition#include <knuminput.h>
InheritsQWidget (qk)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Methods

Protected Members


Detailed Description

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:
labelmain label for the control
lowerlower bound on range
upperupper bound on range
stepstep size for the QSlider
valueinitial value for the control
unitsthe units for the control (can be empty or 0)
basenumeric base (default is 10)
sliderwhether a slider should be added (default: true)
parentparent QWidget
nameinternal 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 ()
[const virtual]

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 ()
[const virtual]

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:
minorminor tickmark separation
majormajor 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:
aone 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:
fracfraction (1..100) of width taken by SpinBox

QSizePolicy sizePolicy ()
[const]

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)
[slot]

Sets the Widget enabled/disabled

void setValue (int)
[slot]

Sets the value of the control.