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

KDEUI

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

#include <knuminput.h>

Inheritance diagram for KIntNumInput:
Inheritance graph
[legend]

Public Slots

void setEditFocus (bool mark=true)
 
void setPrefix (const QString &prefix)
 
void setReferencePoint (int)
 
void setRelativeValue (double)
 
void setSuffix (const QString &suffix)
 
void setSuffix (const KLocalizedString &suffix)
 
void setValue (int)
 

Signals

void relativeValueChanged (double)
 
void valueChanged (int)
 

Public Member Functions

 KIntNumInput (QWidget *parent=0)
 
 KIntNumInput (int value, QWidget *parent=0, int base=10)
 
KDE_CONSTRUCTOR_DEPRECATED KIntNumInput (KNumInput *below, int value, QWidget *parent, int base=10)
 
virtual ~KIntNumInput ()
 
int maximum () const
 
int minimum () const
 
virtual QSize minimumSizeHint () const
 
QString prefix () const
 
int referencePoint () const
 
double relativeValue () const
 
virtual void setLabel (const QString &label, Qt::Alignment a=Qt::AlignLeft|Qt::AlignTop)
 
void setMaximum (int max)
 
void setMinimum (int min)
 
void setRange (int min, int max, int singleStep=1)
 
void setRange (int min, int max, int singleStep, bool slider)
 
void setSingleStep (int step)
 
void setSliderEnabled (bool enabled=true)
 
void setSpecialValueText (const QString &text)
 
int singleStep () const
 
QString specialValueText () const
 
QString suffix () const
 
int value () const
 
- Public Member Functions inherited from KNumInput
 KNumInput (QWidget *parent=0)
 
KDE_CONSTRUCTOR_DEPRECATED KNumInput (QWidget *parent, KNumInput *below)
 
 ~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 *)
 
QSpinBox * spinBox () const
 
- Protected Member Functions inherited from KNumInput
void layout (bool deep)
 
QSlider * slider () const
 

Properties

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

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.

kintnuminput.png
KDE Int Number Input Spinbox

Definition at line 172 of file knuminput.h.

Constructor & Destructor Documentation

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

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

Definition at line 347 of file knuminput.cpp.

KIntNumInput::KIntNumInput ( int  value,
QWidget *  parent = 0,
int  base = 10 
)
explicit

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
valueinitial value for the control
basenumeric base used for display
parentparent QWidget

Definition at line 354 of file knuminput.cpp.

KIntNumInput::KIntNumInput ( 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
belowappend KIntNumInput to the KNumInput chain
valueinitial value for the control
basenumeric base used for display
parentparent QWidget
Deprecated:
use the version without the below parameter instead.

Definition at line 339 of file knuminput.cpp.

KIntNumInput::~KIntNumInput ( )
virtual

Destructor.

Definition at line 623 of file knuminput.cpp.

Member Function Documentation

void KIntNumInput::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 574 of file knuminput.cpp.

int KIntNumInput::maximum ( ) const
Returns
the maximum value.
int KIntNumInput::minimum ( ) const
Returns
the minimum value.
QSize KIntNumInput::minimumSizeHint ( ) 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

Definition at line 546 of file knuminput.cpp.

QString KIntNumInput::prefix ( ) const
Returns
the prefix displayed in front of the value.
See also
setPrefix()
int KIntNumInput::referencePoint ( ) const
Returns
the current reference point
double KIntNumInput::relativeValue ( ) const
Returns
the curent value in units of the referencePoint.
void KIntNumInput::relativeValueChanged ( double  )
signal

Emitted whenever valueChanged is.

Contains the change relative to the referencePoint.

void KIntNumInput::resizeEvent ( QResizeEvent *  e)
protected

Definition at line 586 of file knuminput.cpp.

void KIntNumInput::setEditFocus ( bool  mark = true)
slot

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

Definition at line 541 of file knuminput.cpp.

void KIntNumInput::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 668 of file knuminput.cpp.

void KIntNumInput::setMaximum ( int  max)

Sets the maximum value.

Definition at line 491 of file knuminput.cpp.

void KIntNumInput::setMinimum ( int  min)

Sets the minimum value.

Definition at line 481 of file knuminput.cpp.

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

Sets the prefix to prefix.

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

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

Definition at line 529 of file knuminput.cpp.

void KIntNumInput::setRange ( int  min,
int  max,
int  singleStep = 1 
)

Sets the allowed input range and the step size for the slider and the spin box.

Parameters
minminimum value
maxmaximum value
stepstep size

Definition at line 450 of file knuminput.cpp.

void KIntNumInput::setRange ( int  min,
int  max,
int  singleStep,
bool  slider 
)
Deprecated:
Use the other setRange function and setSliderEnabled instead

Definition at line 474 of file knuminput.cpp.

void KIntNumInput::setReferencePoint ( int  ref)
slot

Sets the reference point for relativeValue.

Definition at line 387 of file knuminput.cpp.

void KIntNumInput::setRelativeValue ( double  r)
slot

Sets the value in units of the referencePoint.

Definition at line 634 of file knuminput.cpp.

void KIntNumInput::setSingleStep ( int  step)
Returns
the step of the spin box

Definition at line 506 of file knuminput.cpp.

void KIntNumInput::setSliderEnabled ( bool  enabled = true)
Parameters
enabledShow the slider enabled

Definition at line 418 of file knuminput.cpp.

void KIntNumInput::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.

Definition at line 657 of file knuminput.cpp.

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

Sets the suffix to suffix.

Use QString() to disable this feature. Formatting has to be provided (e.g. a space separator between the prepended value and the suffix's text has to be provided as the first character in the suffix).

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

Definition at line 511 of file knuminput.cpp.

void KIntNumInput::setSuffix ( const KLocalizedString &  suffix)
slot

Sets the suffix to suffix.

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

Since
4.3

Definition at line 518 of file knuminput.cpp.

void KIntNumInput::setValue ( int  val)
slot

Sets the value of the control.

Definition at line 628 of file knuminput.cpp.

int KIntNumInput::singleStep ( ) const
Returns
the step of the spin box
QString KIntNumInput::specialValueText ( ) const
Returns
the string displayed for a special value.
See also
setSpecialValueText()
QSpinBox * KIntNumInput::spinBox ( ) const
protected
Returns
the spin box widget.

Definition at line 361 of file knuminput.cpp.

QString KIntNumInput::suffix ( ) const
Returns
the suffix displayed behind the value.
See also
setSuffix()
int KIntNumInput::value ( ) const
Returns
the current value.
void KIntNumInput::valueChanged ( int  )
signal

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

Property Documentation

int KIntNumInput::maximum
readwrite

Definition at line 177 of file knuminput.h.

int KIntNumInput::minimum
readwrite

Definition at line 176 of file knuminput.h.

QString KIntNumInput::prefix
readwrite

Definition at line 182 of file knuminput.h.

int KIntNumInput::referencePoint
readwrite

Definition at line 179 of file knuminput.h.

double KIntNumInput::relativeValue
readwrite

Definition at line 180 of file knuminput.h.

int KIntNumInput::singleStep
readwrite

Definition at line 178 of file knuminput.h.

bool KIntNumInput::sliderEnabled
readwrite

Definition at line 184 of file knuminput.h.

QString KIntNumInput::specialValueText
readwrite

Definition at line 183 of file knuminput.h.

QString KIntNumInput::suffix
readwrite

Definition at line 181 of file knuminput.h.

int KIntNumInput::value
readwrite

Definition at line 175 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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 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
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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