| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KInputDialog Class Reference

The KInputDialog class provides a simple dialog to get a single value from the user. More...

`#include <kinputdialog.h>`

Inheritance diagram for KInputDialog:

[legend]
Collaboration diagram for KInputDialog:

[legend]
List of all members.

## Static Public Member Functions
static QString | getText (const QString &caption, const QString &label, const QString &value=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0, QValidator *validator=0, const QString &mask=QString::null)
static QString | text (const QString &caption, const QString &label, const QString &value=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0, QValidator *validator=0, const QString &mask=QString::null, const QString &whatsThis=QString::null)
static QString | getMultiLineText (const QString &caption, const QString &label, const QString &value=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0)
static int | getInteger (const QString &caption, const QString &label, int value=0, int minValue=-2147483647, int maxValue=2147483647, int step=1, int base=10, bool *ok=0, QWidget *parent=0, const char *name=0)
static int | getInteger (const QString &caption, const QString &label, int value=0, int minValue=-2147483647, int maxValue=2147483647, int step=1, bool *ok=0, QWidget *parent=0, const char *name=0)
static double | getDouble (const QString &caption, const QString &label, double value=0, double minValue=-2147483647, double maxValue=2147483647, double step=0.1, int decimals=1, bool *ok=0, QWidget *parent=0, const char *name=0)
static double | getDouble (const QString &caption, const QString &label, double value=0, double minValue=-2147483647, double maxValue=2147483647, int decimals=1, bool *ok=0, QWidget *parent=0, const char *name=0)
static QString | getItem (const QString &caption, const QString &label, const QStringList &list, int current=0, bool editable=false, bool *ok=0, QWidget *parent=0, const char *name=0)
static 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, const char *name=0)
## Friends
class | KInputDialogPrivate

## Detailed Description

The KInputDialog class provides a simple dialog 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. This class is designed to be source compatible with QInputDialog.

Five static convenience functions are provided: getText(), getInteger(). getDouble(), getItem() and getItemList().

Since:
  3.2

Author:
  Nadeem Hasan <nhasan@kde.org>

Definition at line 46 of file kinputdialog.h.

## Member Function Documentation

QString KInputDialog::getText | ( | const QString & | caption,
|  | const QString & | label,
|  | const QString & | value = `QString::null`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | QValidator * | validator = `0`,
|  | const QString & | mask = `QString::null`
| ) | `[static]`

  | 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:
  | 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
  | name | Name 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.
Returns: String user entered if Ok was pressed, else a null string Definition at line 259 of file kinputdialog.cpp. References text().

QString KInputDialog::text | ( | const QString & | caption,
|  | const QString & | label,
|  | const QString & | value = `QString::null`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | QValidator * | validator = `0`,
|  | const QString & | mask = `QString::null`,
|  | const QString & | whatsThis = `QString::null`
| ) | `[static]`

| Same as getText except it provides an extra parameter to specify a QWhatsThis text for the input widget. ### KDE4: Merge with getText. Since: KDE 3.3 Definition at line 267 of file kinputdialog.cpp. References QWhatsThis::add(), QDialog::exec(), QString::isEmpty(), lineEdit(), QString::stripWhiteSpace(), and QLineEdit::text(). Referenced by getText().

QString KInputDialog::getMultiLineText | ( | const QString & | caption,
|  | const QString & | label,
|  | const QString & | value = `QString::null`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

  | 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:
  | 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
  | name | Name of the dialog widget
Returns: String user entered if Ok was pressed, else a null string Since: 3.3 Definition at line 293 of file kinputdialog.cpp. References QDialog::exec(), QTextEdit::text(), and textEdit().

int KInputDialog::getInteger | ( | const QString & | caption,
|  | const QString & | label,
|  | int | value = `0`,
|  | int | minValue = `-2147483647`,
|  | int | maxValue = `2147483647`,
|  | int | step = `1`,
|  | int | base = `10`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

  | 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:
  | 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
  | name | Name of the dialog widget
Returns: Number user entered if Ok was pressed, else 0 Definition at line 311 of file kinputdialog.cpp. References QDialog::exec(), intSpinBox(), and QSpinBox::value(). Referenced by getInteger().

int KInputDialog::getInteger | ( | const QString & | caption,
|  | const QString & | label,
|  | int | value = `0`,
|  | int | minValue = `-2147483647`,
|  | int | maxValue = `2147483647`,
|  | int | step = `1`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

| 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 330 of file kinputdialog.cpp. References getInteger().

double KInputDialog::getDouble | ( | const QString & | caption,
|  | const QString & | label,
|  | double | value = `0`,
|  | double | minValue = `-2147483647`,
|  | double | maxValue = `2147483647`,
|  | double | step = `0.1`,
|  | int | decimals = `1`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

  | 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:
  | 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
  | name | Name of the dialog widget
Returns: Number user entered if Ok was pressed, else 0 Definition at line 338 of file kinputdialog.cpp. References doubleSpinBox(), QDialog::exec(), and KDoubleSpinBox::value(). Referenced by getDouble().

double KInputDialog::getDouble | ( | const QString & | caption,
|  | const QString & | label,
|  | double | value = `0`,
|  | double | minValue = `-2147483647`,
|  | double | maxValue = `2147483647`,
|  | int | decimals = `1`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

| This is an overloaded convenience function. It behaves exctly like the above function. Definition at line 357 of file kinputdialog.cpp. References getDouble().

QString KInputDialog::getItem | ( | const QString & | caption,
|  | const QString & | label,
|  | const QStringList & | list,
|  | int | current = `0`,
|  | bool | editable = `false`,
|  | bool * | ok = `0`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) | `[static]`

  | 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 their own text. Parameters:
  | caption | Caption of the dialog
  | label | Text of the label for the spin box
  | 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
  | name | Name 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 365 of file kinputdialog.cpp. References comboBox(), QListBox::currentText(), QComboBox::currentText(), QDialog::exec(), listBox(), and KDialogBase::slotOk().

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`,
|  | const char * | name = `0`
| ) | `[static]`

  | 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:
  | caption | Caption of the dialog
  | label | Text of the label for the spin box
  | 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
  | name | Name of the dialog widget
Returns: List of selected items if multiple is true, else currently selected item as a QStringList Definition at line 390 of file kinputdialog.cpp. References QDialog::exec(), QListBox::firstItem(), and listBox().

The documentation for this class was generated from the following files:

- kinputdialog.h
- kinputdialog.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:21:25 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003