KDE 4.9 PyKDE API Reference

- KDE's Python API

# KDoubleNumInput Class Reference

`from PyKDE4.kdeui import *`

Inherits: KNumInput → QWidget → QObject

## Detailed Description

An input control for real numbers, consisting of a spinbox and a slider.

KDoubleNumInput combines a QSpinBox and optionally a QSlider with a label to make an easy to use control for setting some float 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 with the slider parameter set to "true".

A special feature of KDoubleNumInput, designed specifically for the situation when there are several instances 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.

"KDE Double Number Input Spinbox"

See also:
  KIntNumInput

## Signals

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

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, float lower, float upper, float value, QWidget parent=0, float singleStep=0.01, int precision=2)
| __init__ (self, KNumInput below, float lower, float upper, float value, QWidget parent=0, float singleStep=0.02, int precision=2)
| __init__ (self, KDoubleNumInput a0)
int | decimals (self)
| doLayout (self)
float | exponentRatio (self)
float | maximum (self)
float | minimum (self)
QSize | minimumSizeHint (self)
QString | prefix (self)
float | referencePoint (self)
float | relativeValue (self)
| resizeEvent (self, QResizeEvent a0)
| setDecimals (self, int decimals)
| setExponentRatio (self, float dbl)
| setLabel (self, QString label, Qt::Alignment a=Qt.AlignLeft|Qt.AlignTop)
| setMaximum (self, float max)
| setMinimum (self, float min)
| setPrecision (self, int precision)
| setPrefix (self, QString prefix)
| setRange (self, float min, float max, float singleStep=1, bool slider=1)
| setReferencePoint (self, float ref)
| setRelativeValue (self, float a0)
| setSingleStep (self, float singleStep)
| setSliderEnabled (self, bool enabled)
| setSpecialValueText (self, QString text)
| setSuffix (self, QString suffix)
| setValue (self, float a0)
float | singleStep (self)
QString | specialValueText (self)
QString | suffix (self)
float | value (self)

## Signal Documentation

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

This is an overloaded member function, provided for convenience. It essentially behaves like the above function.

Contains the value in units of referencePoint.

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

valueChanged | ( | float | a0
| ) |  |  |

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

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

## Method Documentation

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

Constructs an input control for double values with initial value 0.00.

__init__ | ( | self, |
|  | float | lower,
|  | float | upper,
|  | float | value,
|  | QWidget | parent=0,
|  | float | singleStep=0.01,
|  | int | precision=2
| ) |  |  |

Constructor

Parameters:

  | lower | lower boundary value
  | upper | upper boundary value
  | value | initial value for the control
  | singleStep | step size to use for up/down arrow clicks
  | precision | number of digits after the decimal point
  | parent | parent QWidget

__init__ | ( | self, |
|  | KNumInput | below,
|  | float | lower,
|  | float | upper,
|  | float | value,
|  | QWidget | parent=0,
|  | float | singleStep=0.02,
|  | int | precision=2
| ) |  |  |

Constructor

the difference here 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 KDoubleNumInput to the KDoubleNumInput chain
  | lower | lower boundary value
  | upper | upper boundary value
  | value | initial value for the control
  | singleStep | step size to use for up/down arrow clicks
  | precision | number of digits after the decimal point
  | parent | parent QWidget

Deprecated:
  use the version without below instead

__init__ | ( | self, |
|  | KDoubleNumInput | a0
| ) |  |  |

int decimals | ( |  | self ) |

Returns:
  number of decimals.

See also:
  setDecimals()

doLayout | ( |  | self ) |

float exponentRatio | ( |  | self ) |

Returns:
  the value of the exponent use to map the slider to the spin box.

float maximum | ( |  | self ) |

Returns:
  the maximum value.

float minimum | ( |  | self ) |

Returns:
  the minimum value.

QSize minimumSizeHint | ( |  | self ) |

QString prefix | ( |  | self ) |

Returns:
  the prefix.

See also:
  setPrefix()

float referencePoint | ( |  | self ) |

Returns:
  the reference point for relativeValue calculation

float relativeValue | ( |  | self ) |

Returns:
  the current value in units of referencePoint.

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

setDecimals | ( | self, |
|  | int | decimals
| ) |  |  |

Specifies the number of digits to use.

setExponentRatio | ( | self, |
|  | float | dbl
| ) |  |  |

Parameters:

  | dbl | the value of the exponent use to map the slider to the spin box (dbl need to be strictly positive).

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

setMaximum | ( | self, |
|  | float | max
| ) |  |  |

Sets the maximum value.

setMinimum | ( | self, |
|  | float | min
| ) |  |  |

Sets the minimum value.

setPrecision | ( | self, |
|  | int | precision
| ) |  |  |

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

Sets the prefix to be displayed to prefix. Use QString() to disable this feature. Note that the prefix is attached to the value without any spacing.

See also:
  setPrefix()

setRange | ( | self, |
|  | float | min,
|  | float | max,
|  | float | singleStep=1,
|  | bool | slider=1
| ) |  |  |

Parameters:

  | min | minimum value
  | max | maximum value
  | singleStep | step size for the QSlider
  | slider | whether the slider is created or not

setReferencePoint | ( | self, |
|  | float | ref
| ) |  |  |

Sets the reference Point to ref. It ref == 0, emitting of relativeValueChanged is blocked and relativeValue just returns 0.

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

Sets the value in units of referencePoint.

setSingleStep | ( | self, |
|  | float | singleStep
| ) |  |  |

Returns:
  the step of the spin box

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

Parameters:

  | enabled | Show the slider

@default enabled

setSpecialValueText | ( | self, |
|  | QString | text
| ) |  |  |

Sets the special value text. If set, the spin box 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 be displayed to suffix. Use QString() to disable this feature. Note that the suffix is attached to the value without any spacing. So if you prefer to display a space separator, set suffix to something like " cm".

See also:
  setSuffix()

setValue | ( | self, |
|  | float | a0
| ) |  |  |

Sets the value of the control.

float singleStep | ( |  | self ) |

Returns:
  the step of the spin box

QString specialValueText | ( |  | self ) |

Returns:
  the string displayed for a special value.

See also:
  setSpecialValueText()

QString suffix | ( |  | self ) |

Returns:
  the suffix.

See also:
  setSuffix()

float value | ( |  | self ) |

Returns:
  the current value.