KInputDialog
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=nullptr, QWidget *parent=nullptr) |
double | getDouble (const QString &caption, const QString &label, double value=0, double minValue=-DBL_MAX, double maxValue=DBL_MAX, int decimals=1, bool *ok=nullptr, QWidget *parent=nullptr) |
int | getInteger (const QString &caption, const QString &label, int value=0, int minValue=INT_MIN, int maxValue=INT_MAX, int step=1, bool *ok=nullptr, QWidget *parent=nullptr) |
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=nullptr, QWidget *parent=nullptr) |
QString | getItem (const QString &caption, const QString &label, const QStringList &list, int current=0, bool editable=false, bool *ok=nullptr, QWidget *parent=nullptr) |
QStringList | getItemList (const QString &caption, const QString &label, const QStringList &list=QStringList(), const QStringList &select=QStringList(), bool multiple=false, bool *ok=nullptr, QWidget *parent=nullptr) |
QString | getMultiLineText (const QString &caption, const QString &label, const QString &value=QString(), bool *ok=nullptr, QWidget *parent=nullptr) |
QString | getText (const QString &caption, const QString &label, const QString &value=QString(), bool *ok=nullptr, QWidget *parent=nullptr, QValidator *validator=nullptr, 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.
- Deprecated:
- since 5.0 in favor of QInputDialog
Function Documentation
◆ getDouble() [1/2]
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 = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
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
- Returns
- Number user entered if Ok was pressed, else 0
- Deprecated:
- since 5.0, use QInputDialog::getDouble() instead
Definition at line 447 of file kinputdialog.cpp.
◆ getDouble() [2/2]
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 = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
This is an overloaded convenience function.
It behaves exctly like the above function.
- Deprecated:
- since 5.0, use QInputDialog::getDouble() instead
Definition at line 467 of file kinputdialog.cpp.
◆ getInteger() [1/2]
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 = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
This is an overloaded convenience function.
It behaves exactly same as above except it assumes base to be 10, i.e. accepts decimal numbers.
- Deprecated:
- since 5.0, use QInputDialog::getInt() instead
Definition at line 440 of file kinputdialog.cpp.
◆ getInteger() [2/2]
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 = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
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
- Returns
- Number user entered if Ok was pressed, else 0
- Deprecated:
- since 5.0, use QInputDialog::getInt() instead
Definition at line 420 of file kinputdialog.cpp.
◆ getItem()
QString KInputDialog::getItem | ( | const QString & | caption, |
const QString & | label, | ||
const QStringList & | list, | ||
int | current = 0 , |
||
bool | editable = false , |
||
bool * | ok = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
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
-
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.
- Deprecated:
- since 5.0, use QInputDialog::getItem() instead
Definition at line 474 of file kinputdialog.cpp.
◆ getItemList()
QStringList KInputDialog::getItemList | ( | const QString & | caption, |
const QString & | label, | ||
const QStringList & | list = QStringList() , |
||
const QStringList & | select = QStringList() , |
||
bool | multiple = false , |
||
bool * | ok = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
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 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
- Deprecated:
- since 5.0, use QInputDialog with the option UseListViewForComboBoxItems instead (yet only one item allowed)
Definition at line 502 of file kinputdialog.cpp.
◆ getMultiLineText()
QString KInputDialog::getMultiLineText | ( | const QString & | caption, |
const QString & | label, | ||
const QString & | value = QString() , |
||
bool * | ok = nullptr , |
||
QWidget * | parent = nullptr |
||
) |
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
- Returns
- String user entered if Ok was pressed, else a null string
- Deprecated:
- since 5.0, use QInputDialog::getMultiLineText() instead
Definition at line 400 of file kinputdialog.cpp.
◆ getText()
QString KInputDialog::getText | ( | const QString & | caption, |
const QString & | label, | ||
const QString & | value = QString() , |
||
bool * | ok = nullptr , |
||
QWidget * | parent = nullptr , |
||
QValidator * | validator = nullptr , |
||
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
-
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
- Deprecated:
- since 5.0, use QInputDialog::getText() instead; the returned value must be checked, because QInputDialog accepts also empty strings and does not use a QValidator object.
Definition at line 363 of file kinputdialog.cpp.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Jan 31 2023 03:59:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.