# Namespace KInputDialog

Module | kdeui
Namespace | KInputDialog

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 <nhasan@kde.org>

### methods

- getDouble (caption, label, value, minValue, maxValue, step, decimals, parent)

  returns double, bool (ok)
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | double | 0
  minValue | double | -DBL_MAX
  maxValue | double | DBL_MAX
  step | double | 0.1
  decimals | int | 1
  parent | QWidget | 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.

  caption - Caption of the dialog

  label - Text of the label for the spin box

  value - Initial value of the spin box

  minValue - Minimum value user can input

  maxValue - Maximum value user can input

  step - Amount by which value is incremented or decremented

  decimals - Number of digits after the decimal point

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  Returns Number user entered if Ok was pressed, else 0

- getDouble (caption, label, value, minValue, maxValue, decimals, parent)

  returns double, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | double | 0
  minValue | double | -DBL_MAX
  maxValue | double | DBL_MAX
  decimals | int | 1
  parent | QWidget | 0

  This is an overloaded convenience function. It behaves exctly like the above function.

- getInteger (caption, label, value, minValue, maxValue, step, base, parent)

  returns int, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | int | 0
  minValue | int | INT_MIN
  maxValue | int | INT_MAX
  step | int | 1
  base | int | 10
  parent | QWidget | 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.

  caption - Caption of the dialog

  label - Text of the label for the spin box

  value - Initial value of the spin box

  minValue - Minimum value user can input

  maxValue - Maximum value user can input

  step - Amount by which value is incremented or decremented

  base - Base of the number

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  Returns Number user entered if Ok was pressed, else 0

- getInteger (caption, label, value, minValue, maxValue, step, parent)

  returns int, bool (ok)
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | int | 0
  minValue | int | INT_MIN
  maxValue | int | INT_MAX
  step | int | 1
  parent | QWidget | 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.

- getItem (caption, label, list, current, editable, parent)

  returns QString, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  list | QStringList |
  current | int | 0
  editable | bool | 0
  parent | QWidget | 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.

  caption - Caption of the dialog

  label - Text of the label for the list

  list - List of item for user to choose from

  current - Index of the selected item

  editable - If true, user can enter own text

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  Returns Text of the selected item. If editable is true this can be a text entered by the user.

- getItemList (caption, label, list, select, multiple, parent)

  returns QStringList, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  list | QStringList | QStringList()
  select | QStringList | QStringList()
  multiple | bool | 0
  parent | QWidget | 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.

  caption - Caption of the dialog

  label - Text of the label for the list

  list - List of item for user to choose from

  select - List of item(s) that should be selected

  multiple - If true, user can select multiple items

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  Returns List of selected items if multiple is true, else currently selected item as a QStringList

- getMultiLineText (caption, label, value, parent)

  returns QString, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | QString | QString()
  parent | QWidget | 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.

  caption - Caption of the dialog

  label - Text of the label for the line edit

  value - Initial value of the line edit

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  Returns String user entered if Ok was pressed, else a null string

- getText (caption, label, value, parent, validator, mask, whatsThis, completionList)

  returns QString, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  caption | QString |
  label | QString |
  value | QString | QString()
  parent | QWidget | 0
  validator | QValidator | 0
  mask | QString | QString()
  whatsThis | QString | QString()
  completionList | QStringList | 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 ".*".

  caption - Caption of the dialog

  label - Text of the label for the line edit

  value - Initial value of the line edit

  ok - This bool would be set to true if user pressed Ok

  parent - Parent of the dialog widget

  validator - A QValidator to be associated with the line edit

  mask - Mask associated with the line edit. See the documentation for QLineEdit about masks

  whatsThis - a QWhatsThis text for the input widget.

  completionList - a list of items which should be used for input completion Returns String user entered if Ok was pressed, else a null string