#include </home/clem/local/src/opie/libqtaux/qinputdialog.h>
Collaboration diagram for QInputDialog:

Static Public Member Functions | |
| static QString | getText (const QString &caption, const QString &label, const QString &text=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0) |
| static QString | getText (const QString &caption, const QString &label, QLineEdit::EchoMode echo, const QString &text=QString::null, bool *ok=0, QWidget *parent=0, const char *name=0) |
| static int | getInteger (const QString &caption, const QString &label, int num=0, int from=-2147483647, int to=2147483647, int step=1, bool *ok=0, QWidget *parent=0, const char *name=0) |
| static double | getDouble (const QString &caption, const QString &label, double num=0, double from=-2147483647, double to=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=TRUE, bool *ok=0, QWidget *parent=0, const char *name=0) |
Private Types | |
| enum | Type { LineEdit, SpinBox, ComboBox, EditableComboBox } |
Private Slots | |
| void | textChanged (const QString &s) |
| void | tryAccept () |
Private Member Functions | |
| QInputDialog (const QString &label, QWidget *parent=0, const char *name=0, bool modal=TRUE, Type type=LineEdit) | |
| ~QInputDialog () | |
| QLineEdit * | lineEdit () const |
| QSpinBox * | spinBox () const |
| QComboBox * | comboBox () const |
| QComboBox * | editableComboBox () const |
| void | setType (Type t) |
| Type | type () const |
Private Attributes | |
| QInputDialogPrivate * | d |
Friends | |
| class | QInputDialogPrivate |
The QInputDialog is a simple dialog which can be used if you need a simple input from the user. This can be text, a number or an item from a list. Also a label has to be set to tell the user what he/she should input.
In this Qt version only the 4 static convenience functions getText(), getInteger(), getDouble() and getItem() of QInputDialog are available.
Use it like this:
bool ok = FALSE; QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this ); if ( ok && !text.isEmpty() ) ;// user entered something and pressed ok else ;// user entered nothing or pressed cancel
There are more static convenience methods!
Definition at line 52 of file qinputdialog.h.
|
|
This enum type specifies the type of the dialog (which kind of input can be done):
Definition at line 60 of file qinputdialog.h. |
|
||||||||||||||||||||||||
|
Constructs the dialog. label is the text which is shown to the user (it should mention to the user what he/she should input), parent the parent widget of the dialog, name the name of it and if you set modal to TRUE, the dialog pops up modally, else it pops up modeless. With type you specify the type of the dialog.
Definition at line 121 of file qinputdialog.cpp. References QInputDialogPrivate::comboBox, d, QInputDialogPrivate::editComboBox, FALSE, height, l, QInputDialogPrivate::lineEdit, QInputDialogPrivate::ok, qApp, setType(), QInputDialogPrivate::spinBox, QInputDialogPrivate::stack, textChanged(), tr, TRUE, tryAccept(), and width. Referenced by getDouble(), getInteger(), getItem(), and getText(). |
|
|
Destructor. Definition at line 257 of file qinputdialog.cpp. References d. |
|
|
Returns the combobox, which is used in the ComboBox mode Definition at line 200 of file qinputdialog.cpp. References QInputDialogPrivate::comboBox, and d. Referenced by getItem(). |
|
|
Returns the combobox, which is used in the EditableComboBox mode Definition at line 209 of file qinputdialog.cpp. References d, and QInputDialogPrivate::editComboBox. Referenced by getItem(). |
|
||||||||||||||||||||||||||||||||||||||||
|
Static convenience function to get a decimal input from the user. caption is the text which is displayed in the title bar of the dialog. label is the text which is shown to the user (it should mention to the user what he/she should input), num the default decimal number which will be initially set to the line edit, from and to the range in which the entered number has to be, decimals the number of decimal which the number may have, ok a pointer to a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the user pressed cancel, parent the parent widget of the dialog and name the name of it. The dialogs pops up modally! This method returns the number which has been entered by the user. You will use this static method like this:
bool ok = FALSE; double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this ); if ( ok ) ;// user entered something and pressed ok else ;// user pressed cancel Definition at line 389 of file qinputdialog.cpp. References lineEdit(), LineEdit, QString::number(), QInputDialog(), and TRUE. |
|
||||||||||||||||||||||||||||||||||||||||
|
Static convenience function to get an integral input from the user. caption is the text which is displayed in the title bar of the dialog. label is the text which is shown to the user (it should mention to the user what he/she should input), num the default number which will be initially set to the spinbox, from and to the range in which the entered number has to be, step the step in which the number can be increased/decreased by the spinbox, ok a pointer to a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the user pressed cancel, parent the parent widget of the dialog and name the name of it. The dialogs pops up modally! This method returns the number which has been entered by the user. You will use this static method like this:
bool ok = FALSE; int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); if ( ok ) ;// user entered something and pressed ok else ;// user pressed cancel Definition at line 344 of file qinputdialog.cpp. References FALSE, QInputDialog(), spinBox(), SpinBox, and TRUE. |
|
||||||||||||||||||||||||||||||||||||
|
Static convenience function to let the user select an item from a string list. caption is the text which is displayed in the title bar of the dialog. label is the text which is shown to the user (it should mention to the user what he/she should input), list the string list which is inserted into the combobox, current the number of the item which should be initially the current item, editable specifies if the combobox should be editable (if it is TRUE) or read-only (if editable is FALSE), ok a pointer to a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the user pressed cancel, parent the parent widget of the dialog and name the name of it. The dialogs pops up modally! This method returns the text of the current item, or if editable was TRUE, the current text of the combobox. You will use this static method like this:
QStringList lst; lst << "First" << "Second" << "Third" << "Fourth" << "Fifth"; bool ok = FALSE; QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this ); if ( ok ) ;// user selected an item and pressed ok else ;// user pressed cancel Definition at line 437 of file qinputdialog.cpp. References comboBox(), ComboBox, editableComboBox(), EditableComboBox, FALSE, QInputDialog(), and TRUE. |
|
||||||||||||||||||||||||||||||||
|
Like above, but accepts an a mode which the line edit will use to display text.
Definition at line 297 of file qinputdialog.cpp. References FALSE, lineEdit(), LineEdit, QInputDialog(), and TRUE. |
|
||||||||||||||||||||||||||||
|
Static convenience function to get a textual input from the user. caption is the text which is displayed in the title bar of the dialog. label is the text which is shown to the user (it should mention to the user what he/she should input), text the default text which will be initially set to the line edit, ok a pointer to a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the user pressed cancel, parent the parent widget of the dialog and name the name of it. The dialogs pops up modally! This method returns the text which has been entered in the line edit. You will use this static method like this:
bool ok = FALSE; QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this ); if ( ok && !text.isEmpty() ) ;// user entered something and pressed ok else ;// user entered nothing or pressed cancel Definition at line 285 of file qinputdialog.cpp. References Dasher::Opts::Normal. |
|
|
Returns the line edit, which is used in the LineEdit mode Definition at line 182 of file qinputdialog.cpp. References d, and QInputDialogPrivate::lineEdit. Referenced by getDouble(), and getText(). |
|
|
Sets the input type of the dialog to t. Definition at line 218 of file qinputdialog.cpp. References QInputDialogPrivate::comboBox, ComboBox, d, EditableComboBox, QInputDialogPrivate::editComboBox, QInputDialogPrivate::lineEdit, LineEdit, QInputDialogPrivate::spinBox, SpinBox, QInputDialogPrivate::stack, and QInputDialogPrivate::type. Referenced by QInputDialog(). |
|
|
Returns the spinbox, which is used in the SpinBox mode Definition at line 191 of file qinputdialog.cpp. References d, and QInputDialogPrivate::spinBox. Referenced by getInteger(). |
|
|
For internal use only.
Definition at line 469 of file qinputdialog.cpp. References d, QInputDialogPrivate::lineEdit, QInputDialogPrivate::ok, on, and str. Referenced by QInputDialog(). |
|
|
For internal use only.
Definition at line 487 of file qinputdialog.cpp. References d, and QInputDialogPrivate::lineEdit. Referenced by QInputDialog(). |
|
|
Returns the input type of the dialog.
Definition at line 248 of file qinputdialog.cpp. References d, and QInputDialogPrivate::type. |
|
|
Definition at line 97 of file qinputdialog.h. |
|
|
Definition at line 95 of file qinputdialog.h. Referenced by comboBox(), editableComboBox(), lineEdit(), QInputDialog(), setType(), spinBox(), textChanged(), tryAccept(), type(), and ~QInputDialog(). |
1.4.2