• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KDoubleNumInput Class Reference

#include <knuminput.h>

Inheritance diagram for KDoubleNumInput:
KNumInput QWidget

Public Slots

void setPrefix (const QString &prefix)
void setReferencePoint (double ref)
void setRelativeValue (double)
void setSuffix (const QString &suffix)
void setValue (double)

Signals

void relativeValueChanged (double)
void valueChanged (double)

Public Member Functions

 KDoubleNumInput (double lower, double upper, double value, QWidget *parent=0, double singleStep=0.01, int precision=2)
KDE_CONSTRUCTOR_DEPRECATED KDoubleNumInput (KNumInput *below, double lower, double upper, double value, QWidget *parent=0, double singleStep=0.02, int precision=2)
 KDoubleNumInput (QWidget *parent=0)
virtual ~KDoubleNumInput ()
int decimals () const
double exponentRatio () const
double maximum () const
double minimum () const
virtual QSize minimumSizeHint () const
QString prefix () const
double referencePoint () const
double relativeValue () const
void setDecimals (int decimals)
void setExponentRatio (double dbl)
virtual void setLabel (const QString &label, Qt::Alignment a=Qt::AlignLeft|Qt::AlignTop)
void setMaximum (double max)
void setMinimum (double min)
void setPrecision (int precision)
void setRange (double min, double max, double singleStep=1, bool slider=true)
void setSingleStep (double singleStep)
void setSliderEnabled (bool enabled)
void setSpecialValueText (const QString &text)
double singleStep () const
QString specialValueText () const
QString suffix () const
double value () const
Public Member Functions inherited from KNumInput
KDE_CONSTRUCTOR_DEPRECATED KNumInput (QWidget *parent, KNumInput *below)
 KNumInput (QWidget *parent=0)
 ~KNumInput ()
QString label () const
void setSteps (int minor, int major)
bool showSlider () const
virtual QSize sizeHint () const

Protected Member Functions

virtual void doLayout ()
void resizeEvent (QResizeEvent *)
Protected Member Functions inherited from KNumInput
void layout (bool deep)
QSlider * slider () const

Properties

int decimals
double exponentRatio
double maximum
double minimum
QString prefix
double referencePoint
double relativeValue
double singleStep
bool sliderEnabled
QString specialValueText
QString suffix
double value
Properties inherited from KNumInput
QString label

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

Definition at line 450 of file knuminput.h.

Constructor & Destructor Documentation

◆ KDoubleNumInput() [1/3]

KDoubleNumInput::KDoubleNumInput ( QWidget * parent = 0)
explicit

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

Definition at line 697 of file knuminput.cpp.

◆ KDoubleNumInput() [2/3]

KDoubleNumInput::KDoubleNumInput ( double lower,
double upper,
double value,
QWidget * parent = 0,
double singleStep = 0.01,
int precision = 2 )

Constructor.

Parameters
lowerlower boundary value
upperupper boundary value
valueinitial value for the control
singleStepstep size to use for up/down arrow clicks
precisionnumber of digits after the decimal point
parentparent QWidget

Definition at line 705 of file knuminput.cpp.

◆ ~KDoubleNumInput()

KDoubleNumInput::~KDoubleNumInput ( )
virtual

destructor

Definition at line 724 of file knuminput.cpp.

◆ KDoubleNumInput() [3/3]

KDoubleNumInput::KDoubleNumInput ( KNumInput * below,
double lower,
double upper,
double value,
QWidget * parent = 0,
double 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
belowappend KDoubleNumInput to the KDoubleNumInput chain
lowerlower boundary value
upperupper boundary value
valueinitial value for the control
singleStepstep size to use for up/down arrow clicks
precisionnumber of digits after the decimal point
parentparent QWidget
Deprecated
use the version without below instead

Definition at line 714 of file knuminput.cpp.

Member Function Documentation

◆ decimals()

int KDoubleNumInput::decimals ( ) const
Returns
number of decimals.
See also
setDecimals()

Definition at line 1047 of file knuminput.cpp.

◆ doLayout()

void KDoubleNumInput::doLayout ( )
protectedvirtual

You need to overwrite this method and implement your layout calculations there.

See KIntNumInput::doLayout and KDoubleNumInput::doLayout implementation for details.

Implements KNumInput.

Definition at line 876 of file knuminput.cpp.

◆ exponentRatio()

double KDoubleNumInput::exponentRatio ( ) const
Returns
the value of the exponent use to map the slider to the spin box.

Definition at line 1071 of file knuminput.cpp.

◆ maximum()

double KDoubleNumInput::maximum ( ) const
Returns
the maximum value.

Definition at line 983 of file knuminput.cpp.

◆ minimum()

double KDoubleNumInput::minimum ( ) const
Returns
the minimum value.

Definition at line 972 of file knuminput.cpp.

◆ minimumSizeHint()

QSize KDoubleNumInput::minimumSizeHint ( ) const
virtual

Definition at line 807 of file knuminput.cpp.

◆ prefix()

QString KDoubleNumInput::prefix ( ) const
Returns
the prefix.
See also
setPrefix()

Definition at line 1021 of file knuminput.cpp.

◆ referencePoint()

double KDoubleNumInput::referencePoint ( ) const
Returns
the reference point for relativeValue calculation

Definition at line 1011 of file knuminput.cpp.

◆ relativeValue()

double KDoubleNumInput::relativeValue ( ) const
Returns
the current value in units of referencePoint.

Definition at line 1003 of file knuminput.cpp.

◆ relativeValueChanged

void KDoubleNumInput::relativeValueChanged ( double )
signal

This is an overloaded member function, provided for convenience.

It essentially behaves like the above function.

Contains the value in units of referencePoint.

◆ resizeEvent()

void KDoubleNumInput::resizeEvent ( QResizeEvent * e)
protected

Definition at line 836 of file knuminput.cpp.

◆ setDecimals()

void KDoubleNumInput::setDecimals ( int decimals)

Specifies the number of digits to use.

Definition at line 1040 of file knuminput.cpp.

◆ setExponentRatio()

void KDoubleNumInput::setExponentRatio ( double dbl)
Parameters
dblthe value of the exponent use to map the slider to the spin box (dbl need to be strictly positive).

Definition at line 1076 of file knuminput.cpp.

◆ setLabel()

void KDoubleNumInput::setLabel ( const QString & label,
Qt::Alignment a = Qt::AlignLeft | Qt::AlignTop )
virtual

Sets the text and alignment of the main description label.

Parameters
labelThe text of the label. Use QString() to remove an existing one.
aThe alignment of the label (Qt::Alignment). Default is Qt:AlignLeft | Qt:AlignTop.

The vertical alignment flags have special meaning with this widget:

@li @p Qt:AlignTop     The label is placed above the edit/slider
@li @p Qt:AlignVCenter The label is placed left beside the edit
@li @p Qt:AlignBottom  The label is placed below the edit/slider

Reimplemented from KNumInput.

Definition at line 1060 of file knuminput.cpp.

◆ setMaximum()

void KDoubleNumInput::setMaximum ( double max)

Sets the maximum value.

Definition at line 977 of file knuminput.cpp.

◆ setMinimum()

void KDoubleNumInput::setMinimum ( double min)

Sets the minimum value.

Definition at line 966 of file knuminput.cpp.

◆ setPrecision()

void KDoubleNumInput::setPrecision ( int precision)
inline

Definition at line 595 of file knuminput.h.

◆ setPrefix

void KDoubleNumInput::setPrefix ( const QString & prefix)
slot

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()

Definition at line 1033 of file knuminput.cpp.

◆ setRange()

void KDoubleNumInput::setRange ( double min,
double max,
double singleStep = 1,
bool slider = true )
Parameters
minminimum value
maxmaximum value
singleStepstep size for the QSlider
sliderwhether the slider is created or not

Definition at line 906 of file knuminput.cpp.

◆ setReferencePoint

void KDoubleNumInput::setReferencePoint ( double ref)
slot

Sets the reference Point to ref.

It ref == 0, emitting of relativeValueChanged is blocked and relativeValue just returns 0.

Definition at line 899 of file knuminput.cpp.

◆ setRelativeValue

void KDoubleNumInput::setRelativeValue ( double r)
slot

Sets the value in units of referencePoint.

Definition at line 889 of file knuminput.cpp.

◆ setSingleStep()

void KDoubleNumInput::setSingleStep ( double singleStep)
Returns
the step of the spin box

Definition at line 993 of file knuminput.cpp.

◆ setSliderEnabled()

void KDoubleNumInput::setSliderEnabled ( bool enabled)
Parameters
enabledShow the slider @default enabled

Definition at line 928 of file knuminput.cpp.

◆ setSpecialValueText()

void KDoubleNumInput::setSpecialValueText ( const 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.

Definition at line 1052 of file knuminput.cpp.

◆ setSuffix

void KDoubleNumInput::setSuffix ( const QString & suffix)
slot

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()

Definition at line 1026 of file knuminput.cpp.

◆ setValue

void KDoubleNumInput::setValue ( double val)
slot

Sets the value of the control.

Definition at line 884 of file knuminput.cpp.

◆ singleStep()

double KDoubleNumInput::singleStep ( ) const
Returns
the step of the spin box

Definition at line 988 of file knuminput.cpp.

◆ specialValueText()

QString KDoubleNumInput::specialValueText ( ) const
Returns
the string displayed for a special value.
See also
setSpecialValueText()

Definition at line 729 of file knuminput.cpp.

◆ suffix()

QString KDoubleNumInput::suffix ( ) const
Returns
the suffix.
See also
setSuffix()

Definition at line 1016 of file knuminput.cpp.

◆ value()

double KDoubleNumInput::value ( ) const
Returns
the current value.

Definition at line 998 of file knuminput.cpp.

◆ valueChanged

void KDoubleNumInput::valueChanged ( double )
signal

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

Property Documentation

◆ decimals

int KDoubleNumInput::decimals
readwrite

Definition at line 460 of file knuminput.h.

◆ exponentRatio

double KDoubleNumInput::exponentRatio
readwrite

Definition at line 464 of file knuminput.h.

◆ maximum

double KDoubleNumInput::maximum
readwrite

Definition at line 455 of file knuminput.h.

◆ minimum

double KDoubleNumInput::minimum
readwrite

Definition at line 454 of file knuminput.h.

◆ prefix

QString KDoubleNumInput::prefix
readwrite

Definition at line 458 of file knuminput.h.

◆ referencePoint

double KDoubleNumInput::referencePoint
readwrite

Definition at line 461 of file knuminput.h.

◆ relativeValue

double KDoubleNumInput::relativeValue
readwrite

Definition at line 462 of file knuminput.h.

◆ singleStep

double KDoubleNumInput::singleStep
readwrite

Definition at line 456 of file knuminput.h.

◆ sliderEnabled

bool KDoubleNumInput::sliderEnabled
readwrite

Definition at line 463 of file knuminput.h.

◆ specialValueText

QString KDoubleNumInput::specialValueText
readwrite

Definition at line 459 of file knuminput.h.

◆ suffix

QString KDoubleNumInput::suffix
readwrite

Definition at line 457 of file knuminput.h.

◆ value

double KDoubleNumInput::value
readwrite

Definition at line 453 of file knuminput.h.


The documentation for this class was generated from the following files:
  • knuminput.h
  • knuminput.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal