File: qinputdialog.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (316 lines) | stat: -rw-r--r-- 40,230 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QInputDialog Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QInputDialog Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QInputDialog class provides a simple convenience dialog to
get a single value from the user. <a href="#details">More...</a></p>

<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a></b> { NoButtons, UseListViewForComboBoxItems }</li><li><div class="fn" />class <b><a href="qinputdialog-inputdialogoptions.html">InputDialogOptions</a></b></li><li><div class="fn" />enum <b><a href="qinputdialog.html#InputMode-enum">InputMode</a></b> { TextInput, IntInput, DoubleInput }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qinputdialog.html#QInputDialog">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />QString <b><a href="qinputdialog.html#cancelButtonText">cancelButtonText</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qinputdialog.html#comboBoxItems">comboBoxItems</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#done">done</a></b> (<i>self</i>, int&#160;<i>result</i>)</li><li><div class="fn" />int <b><a href="qinputdialog.html#doubleDecimals">doubleDecimals</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qinputdialog.html#doubleMaximum">doubleMaximum</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qinputdialog.html#doubleMinimum">doubleMinimum</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qinputdialog.html#doubleValue">doubleValue</a></b> (<i>self</i>)</li><li><div class="fn" />InputMode <b><a href="qinputdialog.html#inputMode">inputMode</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputdialog.html#intMaximum">intMaximum</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputdialog.html#intMinimum">intMinimum</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputdialog.html#intStep">intStep</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputdialog.html#intValue">intValue</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qinputdialog.html#isComboBoxEditable">isComboBoxEditable</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputdialog.html#labelText">labelText</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qinputdialog.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputdialog.html#okButtonText">okButtonText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#open-2">open</a></b> (<i>self</i>, QObject&#160;<i>receiver</i>, object&#160;<i>member</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#open-3">open</a></b> (<i>self</i>, object&#160;<i>slot</i>)</li><li><div class="fn" />InputDialogOptions <b><a href="qinputdialog.html#options">options</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setCancelButtonText">setCancelButtonText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setComboBoxEditable">setComboBoxEditable</a></b> (<i>self</i>, bool&#160;<i>editable</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setComboBoxItems">setComboBoxItems</a></b> (<i>self</i>, QStringList&#160;<i>items</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setDoubleDecimals">setDoubleDecimals</a></b> (<i>self</i>, int&#160;<i>decimals</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setDoubleMaximum">setDoubleMaximum</a></b> (<i>self</i>, float&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setDoubleMinimum">setDoubleMinimum</a></b> (<i>self</i>, float&#160;<i>min</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setDoubleRange">setDoubleRange</a></b> (<i>self</i>, float&#160;<i>min</i>, float&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setDoubleValue">setDoubleValue</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setInputMode">setInputMode</a></b> (<i>self</i>, InputMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setIntMaximum">setIntMaximum</a></b> (<i>self</i>, int&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setIntMinimum">setIntMinimum</a></b> (<i>self</i>, int&#160;<i>min</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setIntRange">setIntRange</a></b> (<i>self</i>, int&#160;<i>min</i>, int&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setIntStep">setIntStep</a></b> (<i>self</i>, int&#160;<i>step</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setIntValue">setIntValue</a></b> (<i>self</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setLabelText">setLabelText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setOkButtonText">setOkButtonText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setOption">setOption</a></b> (<i>self</i>, InputDialogOption&#160;<i>option</i>, bool&#160;<i>on</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qinputdialog.html#setOptions">setOptions</a></b> (<i>self</i>, InputDialogOptions&#160;<i>options</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setTextEchoMode">setTextEchoMode</a></b> (<i>self</i>, QLineEdit.EchoMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setTextValue">setTextValue</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qinputdialog.html#setVisible">setVisible</a></b> (<i>self</i>, bool&#160;<i>visible</i>)</li><li><div class="fn" />QSize <b><a href="qinputdialog.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qinputdialog.html#testOption">testOption</a></b> (<i>self</i>, InputDialogOption&#160;<i>option</i>)</li><li><div class="fn" />QLineEdit.EchoMode <b><a href="qinputdialog.html#textEchoMode">textEchoMode</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputdialog.html#textValue">textValue</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />(float, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getDouble">getDouble</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, float&#160;<i>value</i>&#160;=&#160;0, float&#160;<i>min</i>&#160;=&#160;-2147483647, float&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>decimals</i>&#160;=&#160;1, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />(int, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getInt">getInt</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, int&#160;<i>value</i>&#160;=&#160;0, int&#160;<i>min</i>&#160;=&#160;-2147483647, int&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>step</i>&#160;=&#160;1, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />(int, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getInteger">getInteger</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, int&#160;<i>value</i>&#160;=&#160;0, int&#160;<i>min</i>&#160;=&#160;-2147483647, int&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>step</i>&#160;=&#160;1, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />(QString, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getItem">getItem</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QStringList&#160;<i>list</i>, int&#160;<i>current</i>&#160;=&#160;0, bool&#160;<i>editable</i>&#160;=&#160;True, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />(QString, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getItem-2">getItem</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QStringList&#160;<i>list</i>, int&#160;<i>current</i>, bool&#160;<i>editable</i>, Qt.WindowFlags&#160;<i>flags</i>, Qt.InputMethodHints&#160;<i>inputMethodHints</i>)</li><li><div class="fn" />(QString, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getText">getText</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QLineEdit.EchoMode&#160;<i>mode</i>&#160;=&#160;QLineEdit.Normal, QString&#160;<i>text</i>&#160;=&#160;'', Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />(QString, bool&#160;<i>ok</i>) <b><a href="qinputdialog.html#getText-2">getText</a></b> (QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QLineEdit.EchoMode&#160;<i>mode</i>, QString&#160;<i>text</i>, Qt.WindowFlags&#160;<i>flags</i>, Qt.InputMethodHints&#160;<i>inputMethodHints</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qinputdialog.html#doubleValueChanged">doubleValueChanged</a></b> (double)</li><li><div class="fn" />void <b><a href="qinputdialog.html#doubleValueSelected">doubleValueSelected</a></b> (double)</li><li><div class="fn" />void <b><a href="qinputdialog.html#intValueChanged">intValueChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qinputdialog.html#intValueSelected">intValueSelected</a></b> (int)</li><li><div class="fn" />void <b><a href="qinputdialog.html#textValueChanged">textValueChanged</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qinputdialog.html#textValueSelected">textValueSelected</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QInputDialog class provides a simple convenience dialog to
get a single value from the user.</p>
<p>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.</p>
<p>Four static convenience functions are provided: <a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), <a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>(). All the functions can be
used in a similar way, for example:</p>
<pre class="cpp">
     <span class="type">bool</span> ok;
     <span class="type"><a href="qstring.html">QString</a></span> text <span class="operator">=</span> <span class="type">QInputDialog</span><span class="operator">.</span>getText(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog.getText()"</span>)<span class="operator">,</span>
                                          tr(<span class="string">"User name:"</span>)<span class="operator">,</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">.</span>Normal<span class="operator">,</span>
                                          <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>home()<span class="operator">.</span>dirName()<span class="operator">,</span> <span class="operator">&amp;</span>ok);
     <span class="keyword">if</span> (ok <span class="operator">&amp;</span><span class="operator">&amp;</span> <span class="operator">!</span>text<span class="operator">.</span>isEmpty())
         textLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(text);
</pre>
<p>The <tt>ok</tt> variable is set to true if the user clicks
<b>OK</b>; otherwise it is set to false.</p>
<p class="centerAlign"><img alt="Input Dialogs" src="images/inputdialogs.png" /></p>
<p>The <a href="dialogs-standarddialogs.html">Standard Dialogs</a>
example shows how to use QInputDialog as well as other built-in Qt
dialogs.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="InputDialogOption-enum" />QInputDialog.InputDialogOption</h3><p>This enum specifies various options that affect the look and
feel of an input dialog.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QInputDialog.NoButtons</tt></td>
<td class="topAlign"><tt>0x00000001</tt></td>
<td class="topAlign">Don't display <b>OK</b> and <b>Cancel</b>
buttons. (Useful for "live dialogs".)</td>
</tr>
<tr>
<td class="topAlign">
<tt>QInputDialog.UseListViewForComboBoxItems</tt></td>
<td class="topAlign"><tt>0x00000002</tt></td>
<td class="topAlign">Use a <a href="qlistview.html">QListView</a>
rather than a non-editable <a href="qcombobox.html">QComboBox</a>
for displaying the items set with <a href="qinputdialog.html#comboBoxItems-prop">setComboBoxItems</a>().</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.5.</p>
<p>The InputDialogOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;InputDialogOption&gt;. It stores an OR
combination of InputDialogOption values.</p>
<p><b>See also</b> <a href="qinputdialog.html#options-prop">options</a>, <a href="qinputdialog.html#setOption">setOption</a>(), and <a href="qinputdialog.html#testOption">testOption</a>().</p>


<h3 class="fn"><a name="InputMode-enum" />QInputDialog.InputMode</h3><p>This enum describes the different modes of input that can be
selected for the dialog.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QInputDialog.TextInput</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Used to input text strings.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputDialog.IntInput</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Used to input integers.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputDialog.DoubleInput</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Used to input floating point numbers with
double precision accuracy.</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.5.</p>
<p><b>See also</b> <a href="qinputdialog.html#inputMode-prop">inputMode</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QInputDialog" />QInputDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new input dialog with the given <i>parent</i> and
window <i>flags</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="cancelButtonText" />QString QInputDialog.cancelButtonText (<i>self</i>)</h3><h3 class="fn"><a name="comboBoxItems" />QStringList QInputDialog.comboBoxItems (<i>self</i>)</h3><h3 class="fn"><a name="done" />QInputDialog.done (<i>self</i>, int&#160;<i>result</i>)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p>
<p>Closes the dialog and sets its result code to <i>result</i>. If
this dialog is shown with <a href="qdialog.html#exec">exec_</a>(),
done() causes the local event loop to finish, and <a href="qdialog.html#exec">exec_</a>() to return <i>result</i>.</p>
<p><b>See also</b> <a href="qdialog.html#done">QDialog.done</a>().</p>


<h3 class="fn"><a name="doubleDecimals" />int QInputDialog.doubleDecimals (<i>self</i>)</h3><h3 class="fn"><a name="doubleMaximum" />float QInputDialog.doubleMaximum (<i>self</i>)</h3><h3 class="fn"><a name="doubleMinimum" />float QInputDialog.doubleMinimum (<i>self</i>)</h3><h3 class="fn"><a name="doubleValue" />float QInputDialog.doubleValue (<i>self</i>)</h3><h3 class="fn"><a name="getDouble" />(float, bool&#160;<i>ok</i>) QInputDialog.getDouble (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, float&#160;<i>value</i>&#160;=&#160;0, float&#160;<i>min</i>&#160;=&#160;-2147483647, float&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>decimals</i>&#160;=&#160;1, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>Static convenience function to get a floating point number from
the user.</p>
<p><i>title</i> is the text which is displayed in the title bar of
the dialog. <i>label</i> is the text which is shown to the user (it
should say what should be entered). <i>value</i> is the default
floating point number that the line edit will be set to. <i>min</i>
and <i>max</i> are the minimum and maximum values the user may
choose. <i>decimals</i> is the maximum number of decimal places the
number may have.</p>
<p>If <i>ok</i> is nonnull, *<i>ok</i> will be set to true if the
user pressed <b>OK</b> and to false if the user pressed
<b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog
will be modal and uses the widget <i>flags</i>.</p>
<p>This function returns the floating point number which has been
entered by the user.</p>
<p>Use this static function like this:</p>
<pre class="cpp">
     <span class="type">bool</span> ok;
     <span class="type">double</span> d <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">.</span>getDouble(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog.getDouble()"</span>)<span class="operator">,</span>
                                        tr(<span class="string">"Amount:"</span>)<span class="operator">,</span> <span class="number">37.56</span><span class="operator">,</span> <span class="operator">-</span><span class="number">10000</span><span class="operator">,</span> <span class="number">10000</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="operator">&amp;</span>ok);
     <span class="keyword">if</span> (ok)
         doubleLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"$%1"</span>)<span class="operator">.</span>arg(d));
</pre>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p>
<p><b>See also</b> <a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p>


<h3 class="fn"><a name="getInt" />(int, bool&#160;<i>ok</i>) QInputDialog.getInt (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, int&#160;<i>value</i>&#160;=&#160;0, int&#160;<i>min</i>&#160;=&#160;-2147483647, int&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>step</i>&#160;=&#160;1, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>Static convenience function to get an integer input from the
user.</p>
<p><i>title</i> is the text which is displayed in the title bar of
the dialog. <i>label</i> is the text which is shown to the user (it
should say what should be entered). <i>value</i> is the default
integer which the spinbox will be set to. <i>min</i> and <i>max</i>
are the minimum and maximum values the user may choose. <i>step</i>
is the amount by which the values change as the user presses the
arrow buttons to increment or decrement the value.</p>
<p>If <i>ok</i> is nonnull *<i>ok</i> will be set to true if the
user pressed <b>OK</b> and to false if the user pressed
<b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog
will be modal and uses the widget <i>flags</i>.</p>
<p>On success, this function returns the integer which has been
entered by the user; on failure, it returns the initial
<i>value</i>.</p>
<p>Use this static function like this:</p>
<pre class="cpp">
     <span class="type">bool</span> ok;
     <span class="type">int</span> i <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">.</span>getInt(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog.getInteger()"</span>)<span class="operator">,</span>
                                  tr(<span class="string">"Percentage:"</span>)<span class="operator">,</span> <span class="number">25</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="operator">&amp;</span>ok);
     <span class="keyword">if</span> (ok)
         integerLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(tr(<span class="string">"%1%"</span>)<span class="operator">.</span>arg(i));
</pre>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p>


<h3 class="fn"><a name="getInteger" />(int, bool&#160;<i>ok</i>) QInputDialog.getInteger (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, int&#160;<i>value</i>&#160;=&#160;0, int&#160;<i>min</i>&#160;=&#160;-2147483647, int&#160;<i>max</i>&#160;=&#160;2147483647, int&#160;<i>step</i>&#160;=&#160;1, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="getItem" />(QString, bool&#160;<i>ok</i>) QInputDialog.getItem (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QStringList&#160;<i>list</i>, int&#160;<i>current</i>&#160;=&#160;0, bool&#160;<i>editable</i>&#160;=&#160;True, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>Static convenience function to let the user select an item from
a string list.</p>
<p><i>title</i> is the text which is displayed in the title bar of
the dialog. <i>label</i> is the text which is shown to the user (it
should say what should be entered). <i>items</i> is the string list
which is inserted into the combobox. <i>current</i> is the number
of the item which should be the current item.
<i>inputMethodHints</i> is the input method hints that will be used
if the combobox is editable and an input method is active.</p>
<p>If <i>editable</i> is true the user can enter their own text;
otherwise the user may only select one of the existing items.</p>
<p>If <i>ok</i> is nonnull <i>*a</i> ok will be set to true if the
user pressed <b>OK</b> and to false if the user pressed
<b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog
will be modal and uses the widget <i>flags</i>.</p>
<p>This function returns the text of the current item, or if
<i>editable</i> is true, the current text of the combobox.</p>
<p>Use this static function like this:</p>
<pre class="cpp">
     <span class="type"><a href="qstringlist.html">QStringList</a></span> items;
     items <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">"Spring"</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">"Summer"</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">"Fall"</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">"Winter"</span>);

     <span class="type">bool</span> ok;
     <span class="type"><a href="qstring.html">QString</a></span> item <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">.</span>getItem(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog.getItem()"</span>)<span class="operator">,</span>
                                          tr(<span class="string">"Season:"</span>)<span class="operator">,</span> items<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="keyword">false</span><span class="operator">,</span> <span class="operator">&amp;</span>ok);
     <span class="keyword">if</span> (ok <span class="operator">&amp;</span><span class="operator">&amp;</span> <span class="operator">!</span>item<span class="operator">.</span>isEmpty())
         itemLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(item);
</pre>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p>
<p><b>See also</b> <a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), and <a href="qinputdialog.html#getDouble">getDouble</a>().</p>


<h3 class="fn"><a name="getItem-2" />(QString, bool&#160;<i>ok</i>) QInputDialog.getItem (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, QStringList&#160;<i>list</i>, int&#160;<i>current</i>, bool&#160;<i>editable</i>, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>, <a href="qt-inputmethodhints.html">Qt.InputMethodHints</a>&#160;<i>inputMethodHints</i>)</h3><h3 class="fn"><a name="getText" />(QString, bool&#160;<i>ok</i>) QInputDialog.getText (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, <a href="qlineedit.html#EchoMode-enum">QLineEdit.EchoMode</a>&#160;<i>mode</i>&#160;=&#160;QLineEdit.Normal, QString&#160;<i>text</i>&#160;=&#160;'', <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>Static convenience function to get a string from the user.</p>
<p><i>title</i> is the text which is displayed in the title bar of
the dialog. <i>label</i> is the text which is shown to the user (it
should say what should be entered). <i>text</i> is the default text
which is placed in the line edit. <i>mode</i> is the echo mode the
line edit will use. <i>inputMethodHints</i> is the input method
hints that will be used in the edit widget if an input method is
active.</p>
<p>If <i>ok</i> is nonnull <i>*a</i> ok will be set to true if the
user pressed <b>OK</b> and to false if the user pressed
<b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog
will be modal and uses the specified widget <i>flags</i>.</p>
<p>If the dialog is accepted, this function returns the text in the
dialog's line edit. If the dialog is rejected, a null <a href="qstring.html">QString</a> is returned.</p>
<p>Use this static function like this:</p>
<pre class="cpp">
     <span class="type">bool</span> ok;
     <span class="type"><a href="qstring.html">QString</a></span> text <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">.</span>getText(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog.getText()"</span>)<span class="operator">,</span>
                                          tr(<span class="string">"User name:"</span>)<span class="operator">,</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">.</span>Normal<span class="operator">,</span>
                                          <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>home()<span class="operator">.</span>dirName()<span class="operator">,</span> <span class="operator">&amp;</span>ok);
     <span class="keyword">if</span> (ok <span class="operator">&amp;</span><span class="operator">&amp;</span> <span class="operator">!</span>text<span class="operator">.</span>isEmpty())
         textLabel<span class="operator">-</span><span class="operator">&gt;</span>setText(text);
</pre>
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
of the dialog. If you want to do this, you should create the dialog
yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p>
<p><b>See also</b> <a href="qinputdialog.html#getInt">getInt</a>(),
<a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p>


<h3 class="fn"><a name="getText-2" />(QString, bool&#160;<i>ok</i>) QInputDialog.getText (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, QString&#160;<i>label</i>, <a href="qlineedit.html#EchoMode-enum">QLineEdit.EchoMode</a>&#160;<i>mode</i>, QString&#160;<i>text</i>, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>, <a href="qt-inputmethodhints.html">Qt.InputMethodHints</a>&#160;<i>inputMethodHints</i>)</h3><h3 class="fn"><a name="inputMode" /><a href="qinputdialog.html#InputMode-enum">InputMode</a> QInputDialog.inputMode (<i>self</i>)</h3><h3 class="fn"><a name="intMaximum" />int QInputDialog.intMaximum (<i>self</i>)</h3><h3 class="fn"><a name="intMinimum" />int QInputDialog.intMinimum (<i>self</i>)</h3><h3 class="fn"><a name="intStep" />int QInputDialog.intStep (<i>self</i>)</h3><h3 class="fn"><a name="intValue" />int QInputDialog.intValue (<i>self</i>)</h3><h3 class="fn"><a name="isComboBoxEditable" />bool QInputDialog.isComboBoxEditable (<i>self</i>)</h3><h3 class="fn"><a name="labelText" />QString QInputDialog.labelText (<i>self</i>)</h3><h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QInputDialog.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>


<h3 class="fn"><a name="okButtonText" />QString QInputDialog.okButtonText (<i>self</i>)</h3><h3 class="fn"><a name="open" />QInputDialog.open (<i>self</i>)</h3><p>This is an overloaded function.</p>
<p>This function connects one of its signals to the slot specified
by <i>receiver</i> and <i>member</i>. The specific signal depends
on the arguments that are specified in <i>member</i>. These
are:</p>
<ul>
<li><a href="qinputdialog.html#textValueSelected">textValueSelected</a>() if
<i>member</i> has a <a href="qstring.html">QString</a> for its
first argument.</li>
<li><a href="qinputdialog.html#intValueSelected">intValueSelected</a>() if
<i>member</i> has an int for its first argument.</li>
<li><a href="qinputdialog.html#doubleValueSelected">doubleValueSelected</a>()
if <i>member</i> has a double for its first argument.</li>
<li><a href="qdialog.html#accepted">accepted</a>() if <i>member</i>
has NO arguments.</li>
</ul>
<p>The signal will be disconnected from the slot when the dialog is
closed.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="open-2" />QInputDialog.open (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, object&#160;<i>member</i>)</h3><h3 class="fn"><a name="open-3" />QInputDialog.open (<i>self</i>, object&#160;<i>slot</i>)</h3><h3 class="fn"><a name="options" /><a href="qinputdialog-inputdialogoptions.html">InputDialogOptions</a> QInputDialog.options (<i>self</i>)</h3><h3 class="fn"><a name="setCancelButtonText" />QInputDialog.setCancelButtonText (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setComboBoxEditable" />QInputDialog.setComboBoxEditable (<i>self</i>, bool&#160;<i>editable</i>)</h3><h3 class="fn"><a name="setComboBoxItems" />QInputDialog.setComboBoxItems (<i>self</i>, QStringList&#160;<i>items</i>)</h3><h3 class="fn"><a name="setDoubleDecimals" />QInputDialog.setDoubleDecimals (<i>self</i>, int&#160;<i>decimals</i>)</h3><h3 class="fn"><a name="setDoubleMaximum" />QInputDialog.setDoubleMaximum (<i>self</i>, float&#160;<i>max</i>)</h3><h3 class="fn"><a name="setDoubleMinimum" />QInputDialog.setDoubleMinimum (<i>self</i>, float&#160;<i>min</i>)</h3><h3 class="fn"><a name="setDoubleRange" />QInputDialog.setDoubleRange (<i>self</i>, float&#160;<i>min</i>, float&#160;<i>max</i>)</h3><p>Sets the range of double precision floating point values
accepted by the dialog when used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode, with
minimum and maximum values specified by <i>min</i> and <i>max</i>
respectively.</p>


<h3 class="fn"><a name="setDoubleValue" />QInputDialog.setDoubleValue (<i>self</i>, float&#160;<i>value</i>)</h3><h3 class="fn"><a name="setInputMode" />QInputDialog.setInputMode (<i>self</i>, <a href="qinputdialog.html#InputMode-enum">InputMode</a>&#160;<i>mode</i>)</h3><h3 class="fn"><a name="setIntMaximum" />QInputDialog.setIntMaximum (<i>self</i>, int&#160;<i>max</i>)</h3><h3 class="fn"><a name="setIntMinimum" />QInputDialog.setIntMinimum (<i>self</i>, int&#160;<i>min</i>)</h3><h3 class="fn"><a name="setIntRange" />QInputDialog.setIntRange (<i>self</i>, int&#160;<i>min</i>, int&#160;<i>max</i>)</h3><p>Sets the range of integer values accepted by the dialog when
used in <a href="qinputdialog.html#InputMode-enum">IntInput</a>
mode, with minimum and maximum values specified by <i>min</i> and
<i>max</i> respectively.</p>


<h3 class="fn"><a name="setIntStep" />QInputDialog.setIntStep (<i>self</i>, int&#160;<i>step</i>)</h3><h3 class="fn"><a name="setIntValue" />QInputDialog.setIntValue (<i>self</i>, int&#160;<i>value</i>)</h3><h3 class="fn"><a name="setLabelText" />QInputDialog.setLabelText (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setOkButtonText" />QInputDialog.setOkButtonText (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setOption" />QInputDialog.setOption (<i>self</i>, <a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a>&#160;<i>option</i>, bool&#160;<i>on</i>&#160;=&#160;True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true;
otherwise, clears the given <i>option</i>.</p>
<p><b>See also</b> <a href="qinputdialog.html#options-prop">options</a> and <a href="qinputdialog.html#testOption">testOption</a>().</p>


<h3 class="fn"><a name="setOptions" />QInputDialog.setOptions (<i>self</i>, <a href="qinputdialog-inputdialogoptions.html">InputDialogOptions</a>&#160;<i>options</i>)</h3><h3 class="fn"><a name="setTextEchoMode" />QInputDialog.setTextEchoMode (<i>self</i>, <a href="qlineedit.html#EchoMode-enum">QLineEdit.EchoMode</a>&#160;<i>mode</i>)</h3><h3 class="fn"><a name="setTextValue" />QInputDialog.setTextValue (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="setVisible" />QInputDialog.setVisible (<i>self</i>, bool&#160;<i>visible</i>)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QInputDialog.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>


<h3 class="fn"><a name="testOption" />bool QInputDialog.testOption (<i>self</i>, <a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a>&#160;<i>option</i>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise,
returns false.</p>
<p><b>See also</b> <a href="qinputdialog.html#options-prop">options</a> and <a href="qinputdialog.html#setOption">setOption</a>().</p>


<h3 class="fn"><a name="textEchoMode" /><a href="qlineedit.html#EchoMode-enum">QLineEdit.EchoMode</a> QInputDialog.textEchoMode (<i>self</i>)</h3><h3 class="fn"><a name="textValue" />QString QInputDialog.textValue (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="doubleValueChanged" />void doubleValueChanged (double)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the double value changes in the
dialog. The current value is specified by <i>value</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">DoubleInput</a>
mode.</p>


<h3 class="fn"><a name="doubleValueSelected" />void doubleValueSelected (double)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the user selects a double value
by accepting the dialog; for example, by clicking the <b>OK</b>
button. The selected value is specified by <i>value</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">DoubleInput</a>
mode.</p>


<h3 class="fn"><a name="intValueChanged" />void intValueChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the integer value changes in the
dialog. The current value is specified by <i>value</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p>


<h3 class="fn"><a name="intValueSelected" />void intValueSelected (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the user selects a integer value
by accepting the dialog; for example, by clicking the <b>OK</b>
button. The selected value is specified by <i>value</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p>


<h3 class="fn"><a name="textValueChanged" />void textValueChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the text string changes in the
dialog. The current string is specified by <i>text</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p>


<h3 class="fn"><a name="textValueSelected" />void textValueSelected (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the user selects a text string
by accepting the dialog; for example, by clicking the <b>OK</b>
button. The selected string is specified by <i>text</i>.</p>
<p>This signal is only relevant when the input dialog is used in
<a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>