The PySide.QtGui.QInputDialog class provides a simple convenience dialog to get a single value from the user.
The input value can be a string, a number or an item from a list. A label must be set to tell the user what they should enter.
Four static convenience functions are provided: PySide.QtGui.QInputDialog.getText() , PySide.QtGui.QInputDialog.getInt() , PySide.QtGui.QInputDialog.getDouble() , and PySide.QtGui.QInputDialog.getItem() . All the functions can be used in a similar way, for example:
text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"), self.tr("User name:"), QLineEdit.Normal, QDir().home().dirName(), ok) if ok and text: textLabel.setText(text)The ok variable is set to true if the user clicks OK ; otherwise it is set to false.
The Standard Dialogs example shows how to use PySide.QtGui.QInputDialog as well as other built-in Qt dialogs.
See also
PySide.QtGui.QMessageBox Standard Dialogs Example
Parameters: |
|
---|
This enum describes the different modes of input that can be selected for the dialog.
Constant | Description |
---|---|
QInputDialog.TextInput | Used to input text strings. |
QInputDialog.IntInput | Used to input integers. |
QInputDialog.DoubleInput | Used to input floating point numbers with double precision accuracy. |
This enum specifies various options that affect the look and feel of an input dialog.
Constant | Description |
---|---|
QInputDialog.NoButtons | Don’t display OK and Cancel buttons. (Useful for “live dialogs”.) |
QInputDialog.UseListViewForComboBoxItems | Use a PySide.QtGui.QListView rather than a non-editable PySide.QtGui.QComboBox for displaying the items set with PySide.QtGui.QInputDialog.setComboBoxItems() . |
See also
options() PySide.QtGui.QInputDialog.setOption() PySide.QtGui.QInputDialog.testOption()
Return type: | unicode |
---|
Return type: | list of strings |
---|
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.double |
---|
Return type: | PySide.QtCore.double |
---|
Return type: | PySide.QtCore.double |
---|
Parameters: | value – PySide.QtCore.double |
---|
Parameters: | value – PySide.QtCore.double |
---|
Parameters: |
|
---|---|
Return type: | PySide.QtCore.double |
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Parameters: |
|
---|---|
Return type: | unicode |
Parameters: |
|
---|---|
Return type: | unicode |
Parameters: |
|
---|---|
Return type: | unicode |
Parameters: |
|
---|---|
Return type: | unicode |
Return type: | PySide.QtGui.QInputDialog.InputMode |
---|
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.int |
---|
Return type: | PySide.QtCore.int |
---|
Parameters: | value – PySide.QtCore.int |
---|
Parameters: | value – PySide.QtCore.int |
---|
Return type: | PySide.QtCore.bool |
---|
Return type: | unicode |
---|
Return type: | unicode |
---|
Parameters: |
|
---|
This is an overloaded function.
This function connects one of its signals to the slot specified by receiver and member . The specific signal depends on the arguments that are specified in member . These are:
The signal will be disconnected from the slot when the dialog is closed.
Parameters: | text – unicode |
---|
Parameters: | editable – PySide.QtCore.bool |
---|
Parameters: | items – list of strings |
---|
Parameters: | decimals – PySide.QtCore.int |
---|
Parameters: | max – PySide.QtCore.double |
---|
Parameters: | min – PySide.QtCore.double |
---|
Parameters: |
|
---|
Sets the range of double precision floating point values accepted by the dialog when used in DoubleInput mode, with minimum and maximum values specified by min and max respectively.
Parameters: | value – PySide.QtCore.double |
---|
Parameters: | mode – PySide.QtGui.QInputDialog.InputMode |
---|
Parameters: | max – PySide.QtCore.int |
---|
Parameters: | min – PySide.QtCore.int |
---|
Parameters: |
|
---|
Sets the range of integer values accepted by the dialog when used in IntInput mode, with minimum and maximum values specified by min and max respectively.
Parameters: | step – PySide.QtCore.int |
---|
See also
Parameters: | value – PySide.QtCore.int |
---|
See also
Parameters: | text – unicode |
---|
Parameters: | text – unicode |
---|
Parameters: |
|
---|
Sets the given option to be enabled if on is true; otherwise, clears the given option .
See also
options() PySide.QtGui.QInputDialog.testOption()
Parameters: | mode – PySide.QtGui.QLineEdit.EchoMode |
---|
Parameters: | text – unicode |
---|
Parameters: | option – PySide.QtGui.QInputDialog.InputDialogOption |
---|---|
Return type: | PySide.QtCore.bool |
Returns true if the given option is enabled; otherwise, returns false.
See also
options() PySide.QtGui.QInputDialog.setOption()
Return type: | PySide.QtGui.QLineEdit.EchoMode |
---|
Return type: | unicode |
---|
Parameters: | text – unicode |
---|
Parameters: | text – unicode |
---|