File: qtest.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 (251 lines) | stat: -rw-r--r-- 22,635 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
<?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>QTest 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">QTest Class Reference<br /><sup><sup>[<a href="qttest.html">QtTest</a> module]</sup></sup></h1><p>The QTest namespace contains all the functions and declarations
that are related to the <a href="qtestlib-manual.html#qtestlib">QTestLib</a> tool. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtest.html#KeyAction-enum">KeyAction</a></b> { Press, Release, Click }</li><li><div class="fn" />enum <b><a href="qtest.html#MouseAction-enum">MouseAction</a></b> { MousePress, MouseRelease, MouseClick, MouseDClick, MouseMove }</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qtest.html#keyClick">keyClick</a></b> (QWidget&#160;<i>widget</i>, Qt.Key&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyClick-2">keyClick</a></b> (QWidget&#160;<i>widget</i>, str&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyClicks">keyClicks</a></b> (QWidget&#160;<i>widget</i>, QString&#160;<i>sequence</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyEvent">keyEvent</a></b> (KeyAction&#160;<i>action</i>, QWidget&#160;<i>widget</i>, Qt.Key&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyEvent-2">keyEvent</a></b> (KeyAction&#160;<i>action</i>, QWidget&#160;<i>widget</i>, str&#160;<i>ascii</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyPress">keyPress</a></b> (QWidget&#160;<i>widget</i>, Qt.Key&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyPress-2">keyPress</a></b> (QWidget&#160;<i>widget</i>, str&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyRelease">keyRelease</a></b> (QWidget&#160;<i>widget</i>, Qt.Key&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#keyRelease-2">keyRelease</a></b> (QWidget&#160;<i>widget</i>, str&#160;<i>key</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mouseClick">mouseClick</a></b> (QWidget&#160;<i>widget</i>, Qt.MouseButton&#160;<i>button</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;0, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mouseDClick">mouseDClick</a></b> (QWidget&#160;<i>widget</i>, Qt.MouseButton&#160;<i>button</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;0, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mouseEvent">mouseEvent</a></b> (MouseAction&#160;<i>action</i>, QWidget&#160;<i>widget</i>, Qt.MouseButton&#160;<i>button</i>, Qt.KeyboardModifiers&#160;<i>stateKey</i>, QPoint&#160;<i>pos</i>, int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mouseMove">mouseMove</a></b> (QWidget&#160;<i>widget</i>, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mousePress">mousePress</a></b> (QWidget&#160;<i>widget</i>, Qt.MouseButton&#160;<i>button</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;0, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#mouseRelease">mouseRelease</a></b> (QWidget&#160;<i>widget</i>, Qt.MouseButton&#160;<i>button</i>, Qt.KeyboardModifiers&#160;<i>modifier</i>&#160;=&#160;0, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qtest.html#qSleep">qSleep</a></b> (int&#160;<i>ms</i>)</li><li><div class="fn" /><b><a href="qtest.html#qWait">qWait</a></b> (int&#160;<i>ms</i>)</li><li><div class="fn" />bool <b><a href="qtest.html#qWaitForWindowShown">qWaitForWindowShown</a></b> (QWidget&#160;<i>window</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTest namespace contains all the functions and declarations
that are related to the <a href="qtestlib-manual.html#qtestlib">QTestLib</a> tool.</p>
<p>Please refer to the <a href="qtestlib-manual.html">QTestLib
Manual</a> documentation for information on how to write unit
tests.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="KeyAction-enum" />QTest.KeyAction</h3><p>This enum describes possible actions for key handling.</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>QTest.Press</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The key is pressed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.Release</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The key is released.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.Click</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The key is clicked (pressed and
released).</td>
</tr>
</table>


<h3 class="fn"><a name="MouseAction-enum" />QTest.MouseAction</h3><p>This enum describes possible actions for mouse handling.</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>QTest.MousePress</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A mouse button is pressed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.MouseRelease</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">A mouse button is released.</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.MouseClick</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">A mouse button is clicked (pressed and
released).</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.MouseDClick</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">A mouse button is double clicked (pressed and
released twice).</td>
</tr>
<tr>
<td class="topAlign"><tt>QTest.MouseMove</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The mouse pointer has moved.</td>
</tr>
</table>


<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="keyClick" />QTest.keyClick (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#Key-enum">Qt.Key</a>&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates clicking of <i>key</i> with an optional
<i>modifier</i> on a <i>widget</i>. If <i>delay</i> is larger than
0, the test will wait for <i>delay</i> milliseconds.</p>
<p>Examples:</p>
<pre class="cpp">
 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>keyClick(myWidget<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Key_Escape);

 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>keyClick(myWidget<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>Key_Escape<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>ShiftModifier<span class="operator">,</span> <span class="number">200</span>);
</pre>
<p>The first example above simulates clicking the <tt>escape</tt>
key on <tt>myWidget</tt> without any keyboard modifiers and without
delay. The second example simulates clicking <tt>shift-escape</tt>
on <tt>myWidget</tt> with a following 200 ms delay of the test.</p>
<p><b>See also</b> <a href="qtest.html#keyClicks">QTest.keyClicks</a>().</p>


<h3 class="fn"><a name="keyClick-2" />QTest.keyClick (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, str&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>Simulates clicking of <i>key</i> with an optional
<i>modifier</i> on a <i>widget</i>. If <i>delay</i> is larger than
0, the test will wait for <i>delay</i> milliseconds.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>keyClick(myWidget<span class="operator">,</span> <span class="char">'a'</span>);
</pre>
<p>The example above simulates clicking <tt>a</tt> on
<tt>myWidget</tt> without any keyboard modifiers and without delay
of the test.</p>
<p><b>See also</b> <a href="qtest.html#keyClicks">QTest.keyClicks</a>().</p>


<h3 class="fn"><a name="keyClicks" />QTest.keyClicks (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, QString&#160;<i>sequence</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates clicking a <i>sequence</i> of keys on a <i>widget</i>.
Optionally, a keyboard <i>modifier</i> can be specified as well as
a <i>delay</i> (in milliseconds) of the test before each key
click.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>keyClicks(myWidget<span class="operator">,</span> <span class="string">"hello world"</span>);
</pre>
<p>The example above simulates clicking the sequence of keys
representing "hello world" on <tt>myWidget</tt> without any
keyboard modifiers and without delay of the test.</p>
<p><b>See also</b> <a href="qtest.html#keyClick">QTest.keyClick</a>().</p>


<h3 class="fn"><a name="keyEvent" />QTest.keyEvent (<a href="qtest.html#KeyAction-enum">KeyAction</a>&#160;<i>action</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#Key-enum">Qt.Key</a>&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Sends a Qt key event to <i>widget</i> with the given <i>key</i>
and an associated <i>action</i>. Optionally, a keyboard
<i>modifier</i> can be specified, as well as a <i>delay</i> (in
milliseconds) of the test before sending the event.</p>


<h3 class="fn"><a name="keyEvent-2" />QTest.keyEvent (<a href="qtest.html#KeyAction-enum">KeyAction</a>&#160;<i>action</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, str&#160;<i>ascii</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>Sends a Qt key event to <i>widget</i> with the given key
<i>ascii</i> and an associated <i>action</i>. Optionally, a
keyboard <i>modifier</i> can be specified, as well as a
<i>delay</i> (in milliseconds) of the test before sending the
event.</p>


<h3 class="fn"><a name="keyPress" />QTest.keyPress (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#Key-enum">Qt.Key</a>&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates pressing a <i>key</i> with an optional <i>modifier</i>
on a <i>widget</i>. If <i>delay</i> is larger than 0, the test will
wait for <i>delay</i> milliseconds.</p>
<p><b>Note:</b> At some point you should release the key using
<a href="qtest.html#keyRelease">keyRelease</a>().</p>
<p><b>See also</b> <a href="qtest.html#keyRelease">QTest.keyRelease</a>() and <a href="qtest.html#keyClick">QTest.keyClick</a>().</p>


<h3 class="fn"><a name="keyPress-2" />QTest.keyPress (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, str&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>Simulates pressing a <i>key</i> with an optional <i>modifier</i>
on a <i>widget</i>. If <i>delay</i> is larger than 0, the test will
wait for <i>delay</i> milliseconds.</p>
<p><b>Note:</b> At some point you should release the key using
<a href="qtest.html#keyRelease">keyRelease</a>().</p>
<p><b>See also</b> <a href="qtest.html#keyRelease">QTest.keyRelease</a>() and <a href="qtest.html#keyClick">QTest.keyClick</a>().</p>


<h3 class="fn"><a name="keyRelease" />QTest.keyRelease (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#Key-enum">Qt.Key</a>&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates releasing a <i>key</i> with an optional
<i>modifier</i> on a <i>widget</i>. If <i>delay</i> is larger than
0, the test will wait for <i>delay</i> milliseconds.</p>
<p><b>See also</b> <a href="qtest.html#keyPress">QTest.keyPress</a>() and <a href="qtest.html#keyClick">QTest.keyClick</a>().</p>


<h3 class="fn"><a name="keyRelease-2" />QTest.keyRelease (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, str&#160;<i>key</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;Qt.NoModifier, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>This is an overloaded function.</p>
<p>Simulates releasing a <i>key</i> with an optional
<i>modifier</i> on a <i>widget</i>. If <i>delay</i> is larger than
0, the test will wait for <i>delay</i> milliseconds.</p>
<p><b>See also</b> <a href="qtest.html#keyClick">QTest.keyClick</a>().</p>


<h3 class="fn"><a name="mouseClick" />QTest.mouseClick (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;0, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates clicking a mouse <i>button</i> with an optional
<i>modifier</i> on a <i>widget</i>. The position of the click is
defined by <i>pos</i>; the default position is the center of the
widget. If <i>delay</i> is specified, the test will wait for the
specified amount of milliseconds before pressing and before
releasing the button.</p>
<p><b>See also</b> <a href="qtest.html#mousePress">QTest.mousePress</a>() and <a href="qtest.html#mouseRelease">QTest.mouseRelease</a>().</p>


<h3 class="fn"><a name="mouseDClick" />QTest.mouseDClick (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;0, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates double clicking a mouse <i>button</i> with an optional
<i>modifier</i> on a <i>widget</i>. The position of the click is
defined by <i>pos</i>; the default position is the center of the
widget. If <i>delay</i> is specified, the test will wait for the
specified amount of milliseconds before each press and release.</p>
<p><b>See also</b> <a href="qtest.html#mouseClick">QTest.mouseClick</a>().</p>


<h3 class="fn"><a name="mouseEvent" />QTest.mouseEvent (<a href="qtest.html#MouseAction-enum">MouseAction</a>&#160;<i>action</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>stateKey</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, int&#160;<i>delay</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="mouseMove" />QTest.mouseMove (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Moves the mouse pointer to a <i>widget</i>. If <i>pos</i> is not
specified, the mouse pointer moves to the center of the widget. If
a <i>delay</i> (in milliseconds) is given, the test will wait
before moving the mouse pointer.</p>


<h3 class="fn"><a name="mousePress" />QTest.mousePress (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;0, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates pressing a mouse <i>button</i> with an optional
<i>modifier</i> on a <i>widget</i>. The position is defined by
<i>pos</i>; the default position is the center of the widget. If
<i>delay</i> is specified, the test will wait for the specified
amount of milliseconds before the press.</p>
<p><b>See also</b> <a href="qtest.html#mouseRelease">QTest.mouseRelease</a>() and <a href="qtest.html#mouseClick">QTest.mouseClick</a>().</p>


<h3 class="fn"><a name="mouseRelease" />QTest.mouseRelease (<a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, <a href="qt.html#MouseButton-enum">Qt.MouseButton</a>&#160;<i>button</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a>&#160;<i>modifier</i>&#160;=&#160;0, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint(), int&#160;<i>delay</i>&#160;=&#160;-1)</h3><p>Simulates releasing a mouse <i>button</i> with an optional
<i>modifier</i> on a <i>widget</i>. The position of the release is
defined by <i>pos</i>; the default position is the center of the
widget. If <i>delay</i> is specified, the test will wait for the
specified amount of milliseconds before releasing the button.</p>
<p><b>See also</b> <a href="qtest.html#mousePress">QTest.mousePress</a>() and <a href="qtest.html#mouseClick">QTest.mouseClick</a>().</p>


<h3 class="fn"><a name="qSleep" />QTest.qSleep (int&#160;<i>ms</i>)</h3><p>Sleeps for <i>ms</i> milliseconds, blocking execution of the
test. qSleep() will not do any event processing and leave your test
unresponsive. Network communication might time out while sleeping.
Use <a href="qtest.html#qWait">qWait</a>() to do non-blocking
sleeping.</p>
<p><i>ms</i> must be greater than 0.</p>
<p><b>Note:</b> The qSleep() function calls either
<tt>nanosleep()</tt> on unix or <tt>Sleep()</tt> on windows, so the
accuracy of time spent in qSleep() depends on the operating
system.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>qSleep(<span class="number">250</span>);
</pre>
<p><b>See also</b> <a href="qtest.html#qWait">qWait</a>().</p>


<h3 class="fn"><a name="qWait" />QTest.qWait (int&#160;<i>ms</i>)</h3><p>Waits for <i>ms</i> milliseconds. While waiting, events will be
processed and your test will stay responsive to user interface
events or network communication.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>;
 <span class="keyword">while</span> (myNetworkServerNotResponding() <span class="operator">&amp;</span><span class="operator">&amp;</span> i<span class="operator">+</span><span class="operator">+</span> <span class="operator">&lt;</span> <span class="number">50</span>)
     <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>qWait(<span class="number">250</span>);
</pre>
<p>The code above will wait until the network server is responding
for a maximum of about 12.5 seconds.</p>
<p><b>See also</b> <a href="qtest.html#qSleep">QTest.qSleep</a>().</p>


<h3 class="fn"><a name="qWaitForWindowShown" />bool QTest.qWaitForWindowShown (<a href="qwidget.html">QWidget</a>&#160;<i>window</i>)</h3><p>Waits until the <i>window</i> is shown in the screen. This is
mainly useful for asynchronous systems like X11, where a window
will be mapped to screen some time after being asked to show itself
on the screen. Returns true.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qwidget.html">QWidget</a></span> widget;
 widget<span class="operator">.</span>show();
 <span class="type"><a href="qtest.html">QTest</a></span><span class="operator">.</span>qWaitForWindowShown(<span class="operator">&amp;</span>widget);
</pre>
<p>This function was introduced in Qt 4.6.</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>