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

KDEUI

Functions
KInputDialog Namespace Reference

Functions

double getDouble (const QString &caption, const QString &label, double value=0, double minValue=-DBL_MAX, double maxValue=DBL_MAX, double step=0.1, int decimals=1, bool *ok=0, QWidget *parent=0)
 
double getDouble (const QString &caption, const QString &label, double value=0, double minValue=-DBL_MAX, double maxValue=DBL_MAX, int decimals=1, bool *ok=0, QWidget *parent=0)
 
int getInteger (const QString &caption, const QString &label, int value=0, int minValue=INT_MIN, int maxValue=INT_MAX, int step=1, int base=10, bool *ok=0, QWidget *parent=0)
 
int getInteger (const QString &caption, const QString &label, int value=0, int minValue=INT_MIN, int maxValue=INT_MAX, int step=1, bool *ok=0, QWidget *parent=0)
 
QString getItem (const QString &caption, const QString &label, const QStringList &list, int current=0, bool editable=false, bool *ok=0, QWidget *parent=0)
 
QStringList getItemList (const QString &caption, const QString &label, const QStringList &list=QStringList(), const QStringList &select=QStringList(), bool multiple=false, bool *ok=0, QWidget *parent=0)
 
QString getMultiLineText (const QString &caption, const QString &label, const QString &value=QString(), bool *ok=0, QWidget *parent=0)
 
QString getText (const QString &caption, const QString &label, const QString &value=QString(), bool *ok=0, QWidget *parent=0, QValidator *validator=0, const QString &mask=QString(), const QString &whatsThis=QString(), const QStringList &completionList=QStringList())
 

Detailed Description

The KInputDialog namespace provides simple dialogs to get a single value from the user.

The value can be a string, a number (either an integer or a float) or an item from a list.

Author
Nadeem Hasan nhasa.nosp@m.n@kd.nosp@m.e.org

Function Documentation

double KInputDialog::getDouble ( const QString &  caption,
const QString &  label,
double  value = 0,
double  minValue = -DBL_MAX,
double  maxValue = DBL_MAX,
double  step = 0.1,
int  decimals = 1,
bool *  ok = 0,
QWidget *  parent = 0 
)

Static convenience function to get a floating point number from the user.

caption is the text that is displayed in the title bar. label is the text that appears as the label for the spin box. value is the initial value for the spin box. minValue and maxValue are the minimum and maximum allowable values the user may choose. step is the amount by which the value will change as the user presses the increment and decrement buttons of the spin box.

Parameters
captionCaption of the dialog
labelText of the label for the spin box
valueInitial value of the spin box
minValueMinimum value user can input
maxValueMaximum value user can input
stepAmount by which value is incremented or decremented
decimalsNumber of digits after the decimal point
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
Returns
Number user entered if Ok was pressed, else 0

Definition at line 405 of file kinputdialog.cpp.

double KInputDialog::getDouble ( const QString &  caption,
const QString &  label,
double  value = 0,
double  minValue = -DBL_MAX,
double  maxValue = DBL_MAX,
int  decimals = 1,
bool *  ok = 0,
QWidget *  parent = 0 
)

This is an overloaded convenience function.

It behaves exctly like the above function.

Definition at line 423 of file kinputdialog.cpp.

int KInputDialog::getInteger ( const QString &  caption,
const QString &  label,
int  value = 0,
int  minValue = INT_MIN,
int  maxValue = INT_MAX,
int  step = 1,
int  base = 10,
bool *  ok = 0,
QWidget *  parent = 0 
)

Static convenience function to get an integer from the user.

caption is the text that is displayed in the title bar. label is the text that appears as the label for the spin box. value is the initial value for the spin box. minValue and maxValue are the minimum and maximum allowable values the user may choose. step is the amount by which the value will change as the user presses the increment and decrement buttons of the spin box. Base is the base of the number.

Parameters
captionCaption of the dialog
labelText of the label for the spin box
valueInitial value of the spin box
minValueMinimum value user can input
maxValueMaximum value user can input
stepAmount by which value is incremented or decremented
baseBase of the number
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
Returns
Number user entered if Ok was pressed, else 0

Definition at line 380 of file kinputdialog.cpp.

int KInputDialog::getInteger ( const QString &  caption,
const QString &  label,
int  value = 0,
int  minValue = INT_MIN,
int  maxValue = INT_MAX,
int  step = 1,
bool *  ok = 0,
QWidget *  parent = 0 
)

This is an overloaded convenience function.

It behaves exactly same as above except it assumes base to be 10, i.e. accepts decimal numbers.

Definition at line 398 of file kinputdialog.cpp.

QString KInputDialog::getItem ( const QString &  caption,
const QString &  label,
const QStringList &  list,
int  current = 0,
bool  editable = false,
bool *  ok = 0,
QWidget *  parent = 0 
)

Static convenience function to let the user select an item from a list.

caption is the text that is displayed in the title bar. label is the text that appears as the label for the list. list is the string list which is inserted into the list, and current is the number of the item which should be the selected item. If editable is true, the user can enter his own text.

Parameters
captionCaption of the dialog
labelText of the label for the list
listList of item for user to choose from
currentIndex of the selected item
editableIf true, user can enter own text
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
Returns
Text of the selected item. If editable is true this can be a text entered by the user.

Definition at line 430 of file kinputdialog.cpp.

QStringList KInputDialog::getItemList ( const QString &  caption,
const QString &  label,
const QStringList &  list = QStringList(),
const QStringList &  select = QStringList(),
bool  multiple = false,
bool *  ok = 0,
QWidget *  parent = 0 
)

Static convenience function to let the user select one or more items from a listbox.

caption is the text that is displayed in the title bar. label is the text that appears as the label for the listbox. list is the string list which is inserted into the listbox, select is the list of item(s) that should be the selected. If multiple is true, the user can select multiple items.

Parameters
captionCaption of the dialog
labelText of the label for the list
listList of item for user to choose from
selectList of item(s) that should be selected
multipleIf true, user can select multiple items
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
Returns
List of selected items if multiple is true, else currently selected item as a QStringList

Definition at line 455 of file kinputdialog.cpp.

QString KInputDialog::getMultiLineText ( const QString &  caption,
const QString &  label,
const QString &  value = QString(),
bool *  ok = 0,
QWidget *  parent = 0 
)

Static convenience function to get a multiline string from the user.

caption is the text that is displayed in the title bar. label is the text that appears as a label for the line edit. value is the initial value of the line edit. ok will be set to true if user pressed Ok and false if user pressed Cancel.

Parameters
captionCaption of the dialog
labelText of the label for the line edit
valueInitial value of the line edit
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
Returns
String user entered if Ok was pressed, else a null string

Definition at line 362 of file kinputdialog.cpp.

QString KInputDialog::getText ( const QString &  caption,
const QString &  label,
const QString &  value = QString(),
bool *  ok = 0,
QWidget *  parent = 0,
QValidator *  validator = 0,
const QString &  mask = QString(),
const QString &  whatsThis = QString(),
const QStringList &  completionList = QStringList() 
)

Static convenience function to get a string from the user.

caption is the text that is displayed in the title bar. label is the text that appears as a label for the line edit. value is the initial value of the line edit. ok will be set to true if user pressed Ok and false if user pressed Cancel.

If you provide a validator, the Ok button is disabled as long as the validator doesn't return Acceptable. If there is no validator, the Ok button is enabled whenever the line edit isn't empty. If you want to accept empty input, create a trivial QValidator that always returns acceptable, e.g. QRegExpValidator with a regexp of ".*".

Parameters
captionCaption of the dialog
labelText of the label for the line edit
valueInitial value of the line edit
okThis bool would be set to true if user pressed Ok
parentParent of the dialog widget
validatorA QValidator to be associated with the line edit
maskMask associated with the line edit. See the documentation for QLineEdit about masks
whatsThisa QWhatsThis text for the input widget.
completionLista list of items which should be used for input completion
Returns
String user entered if Ok was pressed, else a null string

Definition at line 330 of file kinputdialog.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:04 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • 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