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() ,和 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)
ok variable is set to true if the user clicks OK ; otherwise it is set to false.
标准对话框 example shows how to use PySide.QtGui.QInputDialog as well as other built-in Qt dialogs.
另请参阅
PySide.QtGui.QMessageBox 标准对话框范例
| 参数: |
|
|---|
This enum describes the different modes of input that can be selected for the dialog.
| 常量 | 描述 |
|---|---|
| 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.
| 常量 | 描述 |
|---|---|
| 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() . |
| 返回类型: | unicode |
|---|
| 返回类型: | 字符串列表 |
|---|
| 返回类型: | PySide.QtCore.int |
|---|
| 返回类型: | PySide.QtCore.double |
|---|
| 返回类型: | PySide.QtCore.double |
|---|
| 返回类型: | PySide.QtCore.double |
|---|
| 参数: | value – PySide.QtCore.double |
|---|
| 参数: | value – PySide.QtCore.double |
|---|
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.double |
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
| 参数: |
|
|---|---|
| 返回类型: |
unicode |
| 参数: |
|
|---|---|
| 返回类型: |
unicode |
| 参数: |
|
|---|---|
| 返回类型: |
unicode |
| 参数: |
|
|---|---|
| 返回类型: |
unicode |
| 返回类型: | PySide.QtGui.QInputDialog.InputMode |
|---|
| 返回类型: | PySide.QtCore.int |
|---|
| 返回类型: | PySide.QtCore.int |
|---|
| 返回类型: | PySide.QtCore.int |
|---|
| 返回类型: | PySide.QtCore.int |
|---|
| 参数: | value – PySide.QtCore.int |
|---|
| 参数: | value – PySide.QtCore.int |
|---|
| 返回类型: | PySide.QtCore.bool |
|---|
| 返回类型: | unicode |
|---|
| 返回类型: | unicode |
|---|
| 参数: |
|
|---|
这是重载函数。
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:
信号将断开槽连接,当对话框被关闭时。
| 参数: | text – unicode |
|---|
| 参数: | editable – PySide.QtCore.bool |
|---|
| 参数: | items – list of strings |
|---|
| 参数: | decimals – PySide.QtCore.int |
|---|
| 参数: | max – PySide.QtCore.double |
|---|
| 参数: | min – PySide.QtCore.double |
|---|
| 参数: |
|
|---|
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 分别。
| 参数: | value – PySide.QtCore.double |
|---|
| 参数: | mode – PySide.QtGui.QInputDialog.InputMode |
|---|
| 参数: | max – PySide.QtCore.int |
|---|
| 参数: | min – PySide.QtCore.int |
|---|
| 参数: |
|
|---|
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 分别。
| 参数: | step – PySide.QtCore.int |
|---|
| 参数: | value – PySide.QtCore.int |
|---|
| 参数: | text – unicode |
|---|
| 参数: | text – unicode |
|---|
| 参数: |
|
|---|
设置给定 option to be enabled if on is true; otherwise, clears the given option .
另请参阅
options() PySide.QtGui.QInputDialog.testOption()
| 参数: | mode – PySide.QtGui.QLineEdit.EchoMode |
|---|
| 参数: | text – unicode |
|---|
| 参数: | option – PySide.QtGui.QInputDialog.InputDialogOption |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if the given option 被启用;否则,返回 false。
另请参阅
options() PySide.QtGui.QInputDialog.setOption()
| 返回类型: | PySide.QtGui.QLineEdit.EchoMode |
|---|
| 返回类型: | unicode |
|---|
| 参数: | text – unicode |
|---|
| 参数: | text – unicode |
|---|