KDE 4.9 PyKDE API Reference

- KDE's Python API

# KIntNumInput Class Reference

`from PyKDE4.kdeui import *`

Inherits: KNumInput → QWidget → QObject

## Detailed Description

An input widget for integer numbers, consisting of a spinbox and a slider.

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.

The slider is created only when the user specifies a range for the control using the setRange function or when the user calls setSliderEnabled.

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.

"KDE Int Number Input Spinbox"

## Signals

| relativeValueChanged (float a0)
| valueChanged (int a0)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, int value, QWidget parent=0, int base=10)
| __init__ (self, KNumInput below, int value, QWidget parent, int base=10)
| __init__ (self, KIntNumInput a0)
| doLayout (self)
int | maximum (self)
int | minimum (self)
QSize | minimumSizeHint (self)
QString | prefix (self)
int | referencePoint (self)
float | relativeValue (self)
| resizeEvent (self, QResizeEvent a0)
| setEditFocus (self, bool mark=1)
| setLabel (self, QString label, Qt::Alignment a=Qt.AlignLeft|Qt.AlignTop)
| setMaximum (self, int max)
| setMinimum (self, int min)
| setPrefix (self, QString prefix)
| setRange (self, int min, int max, int singleStep=1)
| setRange (self, int min, int max, int singleStep, bool slider)
| setReferencePoint (self, int a0)
| setRelativeValue (self, float a0)
| setSingleStep (self, int step)
| setSliderEnabled (self, bool enabled=1)
| setSpecialValueText (self, QString text)
| setSuffix (self, QString suffix)
| setSuffix (self, KLocalizedString suffix)
| setValue (self, int a0)
int | singleStep (self)
QString | specialValueText (self)
QSpinBox | spinBox (self)
QString | suffix (self)
int | value (self)

## Signal Documentation

relativeValueChanged | ( | float | a0
| ) |  |  |

Emitted whenever valueChanged is. Contains the change relative to the referencePoint.

Signal syntax:
  `QObject.connect(source, SIGNAL("relativeValueChanged(double)"), target_slot)`

valueChanged | ( | int | a0
| ) |  |  |

Emitted every time the value changes (by calling setValue() or by user interaction).

Signal syntax:
  `QObject.connect(source, SIGNAL("valueChanged(int)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Constructs an input control for integer values with base 10 and initial value 0.

__init__ | ( | self, |
|  | int | value,
|  | QWidget | parent=0,
|  | int | base=10
| ) |  |  |

Constructor It constructs a QSpinBox that allows the input of integer numbers in the range of -INT_MAX to +INT_MAX. To set a descriptive label, use setLabel(). To enforce the value being in a range and optionally to attach a slider to it, use setRange().

Parameters:

  | value | initial value for the control
  | base | numeric base used for display
  | parent | parent QWidget

__init__ | ( | self, |
|  | KNumInput | below,
|  | int | value,
|  | QWidget | parent,
|  | int | base=10
| ) |  |  |

Constructor

the difference to the one above is the "below" parameter. It tells this instance that it is visually put below some other KNumInput widget. Note that these two KNumInput's need not to have the same parent widget or be in the same layout group. The effect is that it'll adjust its layout in correspondence with the layout of the other KNumInput's (you can build an arbitrary long chain).

Parameters:

  | below | append KIntNumInput to the KNumInput chain
  | value | initial value for the control
  | base | numeric base used for display
  | parent | parent QWidget

Deprecated:
  use the version without the below parameter instead.

__init__ | ( | self, |
|  | KIntNumInput | a0
| ) |  |  |

doLayout | ( |  | self ) |

int maximum | ( |  | self ) |

Returns:
  the maximum value.

int minimum | ( |  | self ) |

Returns:
  the minimum value.

QSize minimumSizeHint | ( |  | self ) |

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

QString prefix | ( |  | self ) |

Returns:
  the prefix displayed in front of the value.

See also:
  setPrefix()

int referencePoint | ( |  | self ) |

Returns:
  the current reference point

float relativeValue | ( |  | self ) |

Returns:
  the curent value in units of the referencePoint.

resizeEvent | ( | self, |
|  | QResizeEvent | a0
| ) |  |  |

setEditFocus | ( | self, |
|  | bool | mark=1
| ) |  |  |

sets focus to the edit widget and marks all text in if mark == true

setLabel | ( | self, |
|  | QString | label,
|  | Qt::Alignment | a=Qt.AlignLeft|Qt.AlignTop
| ) |  |  |

setMaximum | ( | self, |
|  | int | max
| ) |  |  |

Sets the maximum value.

setMinimum | ( | self, |
|  | int | min
| ) |  |  |

Sets the minimum value.

setPrefix | ( | self, |
|  | QString | prefix
| ) |  |  |

Sets the prefix to prefix. Use QString() to disable this feature. Formatting has to be provided (see above).

See also:
  QSpinBox.setPrefix(), #setSuffix()

setRange | ( | self, |
|  | int | min,
|  | int | max,
|  | int | singleStep=1
| ) |  |  |

Deprecated:
  Use the other setRange function and setSliderEnabled instead

setRange | ( | self, |
|  | int | min,
|  | int | max,
|  | int | singleStep,
|  | bool | slider
| ) |  |  |

Deprecated:
  Use the other setRange function and setSliderEnabled instead

setReferencePoint | ( | self, |
|  | int | a0
| ) |  |  |

Sets the reference point for relativeValue.

setRelativeValue | ( | self, |
|  | float | a0
| ) |  |  |

Sets the value in units of the referencePoint

setSingleStep | ( | self, |
|  | int | step
| ) |  |  |

Returns:
  the step of the spin box

setSliderEnabled | ( | self, |
|  | bool | enabled=1
| ) |  |  |

Parameters:

  | enabled | Show the slider

@default enabled

setSpecialValueText | ( | self, |
|  | 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.

setSuffix | ( | self, |
|  | QString | suffix
| ) |  |  |

Sets the suffix to suffix. Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural").

Since:
  4.3

setSuffix | ( | self, |
|  | KLocalizedString | suffix
| ) |  |  |

Sets the suffix to suffix. Use this to add a plural-aware suffix, e.g. by using ki18np("singular", "plural").

Since:
  4.3

setValue | ( | self, |
|  | int | a0
| ) |  |  |

Sets the value of the control.

int singleStep | ( |  | self ) |

Returns:
  the step of the spin box

QString specialValueText | ( |  | self ) |

Returns:
  the string displayed for a special value.

See also:
  setSpecialValueText()

QSpinBox spinBox | ( |  | self ) |

Returns:
  the spin box widget.

Internal:

QString suffix | ( |  | self ) |

Returns:
  the suffix displayed behind the value.

See also:
  setSuffix()

int value | ( |  | self ) |

Returns:
  the current value.