File: qvariant.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (520 lines) | stat: -rw-r--r-- 63,757 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<?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>QVariant 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="../pyqt4ref.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">QVariant Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QVariant class acts like a union for the most common Qt data types. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qvariant.html#Type-enum">Type</a></b> { Invalid, Bool, Int, UInt, ..., LastType }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qvariant.html#QVariant">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant">__init__</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-2">__init__</a></b> (<i>self</i>, Type&#160;<i>type</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-2">__init__</a></b> (<i>self</i>, QBitmap)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-3">__init__</a></b> (<i>self</i>, int&#160;<i>typeOrUserType</i>, sip.voidptr&#160;<i>copy</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-3">__init__</a></b> (<i>self</i>, QColor)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-4">__init__</a></b> (<i>self</i>, QVariant&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-4">__init__</a></b> (<i>self</i>, QBrush)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-5">__init__</a></b> (<i>self</i>, QDataStream&#160;<i>s</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-5">__init__</a></b> (<i>self</i>, QCursor)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-6">__init__</a></b> (<i>self</i>, bool&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-6">__init__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-7">__init__</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-7">__init__</a></b> (<i>self</i>, QIcon)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-8">__init__</a></b> (<i>self</i>, float&#160;<i>d</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-8">__init__</a></b> (<i>self</i>, QImage)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-9">__init__</a></b> (<i>self</i>, long&#160;<i>ll</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-9">__init__</a></b> (<i>self</i>, QKeySequence)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-10">__init__</a></b> (<i>self</i>, unsigned long&#160;<i>ull</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-10">__init__</a></b> (<i>self</i>, QPalette)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-11">__init__</a></b> (<i>self</i>, QString&#160;<i>string</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-11">__init__</a></b> (<i>self</i>, QPen)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-12">__init__</a></b> (<i>self</i>, QByteArray&#160;<i>bytearray</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-12">__init__</a></b> (<i>self</i>, QPolygon)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-13">__init__</a></b> (<i>self</i>, QBitArray&#160;<i>bitarray</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-13">__init__</a></b> (<i>self</i>, QRegion)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-14">__init__</a></b> (<i>self</i>, QLatin1String&#160;<i>string</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-14">__init__</a></b> (<i>self</i>, QSizePolicy)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-15">__init__</a></b> (<i>self</i>, QStringList&#160;<i>stringlist</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-15">__init__</a></b> (<i>self</i>, QTextLength)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-16">__init__</a></b> (<i>self</i>, QChar&#160;<i>qchar</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-16">__init__</a></b> (<i>self</i>, QTextFormat)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-17">__init__</a></b> (<i>self</i>, QDate&#160;<i>date</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-18">__init__</a></b> (<i>self</i>, QTime&#160;<i>time</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-19">__init__</a></b> (<i>self</i>, QDateTime&#160;<i>datetime</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-20">__init__</a></b> (<i>self</i>, QVariant-list&#160;<i>list</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-21">__init__</a></b> (<i>self</i>, QString-QVariant-dict&#160;<i>map</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-22">__init__</a></b> (<i>self</i>, QSize&#160;<i>size</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-23">__init__</a></b> (<i>self</i>, QSizeF&#160;<i>size</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-24">__init__</a></b> (<i>self</i>, QPoint&#160;<i>pt</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-25">__init__</a></b> (<i>self</i>, QPointF&#160;<i>pt</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-26">__init__</a></b> (<i>self</i>, QLine&#160;<i>line</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-27">__init__</a></b> (<i>self</i>, QLineF&#160;<i>line</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-28">__init__</a></b> (<i>self</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-29">__init__</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-30">__init__</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-31">__init__</a></b> (<i>self</i>, QLocale&#160;<i>locale</i>)</li><li><div class="fn" /><b><a href="qvariant.html#QVariant-32">__init__</a></b> (<i>self</i>, QRegExp&#160;<i>regExp</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#canConvert">canConvert</a></b> (<i>self</i>, Type&#160;<i>t</i>)</li><li><div class="fn" /><b><a href="qvariant.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#convert">convert</a></b> (<i>self</i>, Type&#160;<i>t</i>)</li><li><div class="fn" />sip.voidptr <b><a href="qvariant.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qvariant.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qvariant.html#load">load</a></b> (<i>self</i>, QDataStream&#160;<i>ds</i>)</li><li><div class="fn" /><b><a href="qvariant.html#save">save</a></b> (<i>self</i>, QDataStream&#160;<i>ds</i>)</li><li><div class="fn" />QBitArray <b><a href="qvariant.html#toBitArray">toBitArray</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#toBool">toBool</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qvariant.html#toByteArray">toByteArray</a></b> (<i>self</i>)</li><li><div class="fn" />QChar <b><a href="qvariant.html#toChar">toChar</a></b> (<i>self</i>)</li><li><div class="fn" />QDate <b><a href="qvariant.html#toDate">toDate</a></b> (<i>self</i>)</li><li><div class="fn" />QDateTime <b><a href="qvariant.html#toDateTime">toDateTime</a></b> (<i>self</i>)</li><li><div class="fn" />(float, bool&#160;<i>ok</i>) <b><a href="qvariant.html#toDouble">toDouble</a></b> (<i>self</i>)</li><li><div class="fn" />(int, bool&#160;<i>ok</i>) <b><a href="qvariant.html#toInt">toInt</a></b> (<i>self</i>)</li><li><div class="fn" />QLine <b><a href="qvariant.html#toLine">toLine</a></b> (<i>self</i>)</li><li><div class="fn" />QLineF <b><a href="qvariant.html#toLineF">toLineF</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant-list <b><a href="qvariant.html#toList">toList</a></b> (<i>self</i>)</li><li><div class="fn" />QLocale <b><a href="qvariant.html#toLocale">toLocale</a></b> (<i>self</i>)</li><li><div class="fn" />(long, bool&#160;<i>ok</i>) <b><a href="qvariant.html#toLongLong">toLongLong</a></b> (<i>self</i>)</li><li><div class="fn" />QString-QVariant-dict <b><a href="qvariant.html#toMap">toMap</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qvariant.html#toPoint">toPoint</a></b> (<i>self</i>)</li><li><div class="fn" />QPointF <b><a href="qvariant.html#toPointF">toPointF</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qvariant.html#toRect">toRect</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qvariant.html#toRectF">toRectF</a></b> (<i>self</i>)</li><li><div class="fn" />QRegExp <b><a href="qvariant.html#toRegExp">toRegExp</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qvariant.html#toSize">toSize</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qvariant.html#toSizeF">toSizeF</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qvariant.html#toString">toString</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qvariant.html#toStringList">toStringList</a></b> (<i>self</i>)</li><li><div class="fn" />QTime <b><a href="qvariant.html#toTime">toTime</a></b> (<i>self</i>)</li><li><div class="fn" />(unsigned long, bool&#160;<i>ok</i>) <b><a href="qvariant.html#toUInt">toUInt</a></b> (<i>self</i>)</li><li><div class="fn" />(unsigned long, bool&#160;<i>ok</i>) <b><a href="qvariant.html#toULongLong">toULongLong</a></b> (<i>self</i>)</li><li><div class="fn" />QUrl <b><a href="qvariant.html#toUrl">toUrl</a></b> (<i>self</i>)</li><li><div class="fn" />Type <b><a href="qvariant.html#type">type</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qvariant.html#typeName">typeName</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qvariant.html#userType">userType</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />Type <b><a href="qvariant.html#nameToType">nameToType</a></b> (str&#160;<i>name</i>)</li><li><div class="fn" />str <b><a href="qvariant.html#typeToName">typeToName</a></b> (Type&#160;<i>type</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qvariant.html#__eq__">__eq__</a></b> (<i>self</i>, QVariant&#160;<i>v</i>)</li><li><div class="fn" />bool <b><a href="qvariant.html#__ne__">__ne__</a></b> (<i>self</i>, QVariant&#160;<i>v</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QVariant class acts like a union for the most common Qt data types.</p>
<p>Because C++ forbids unions from including types that have non-default constructors or destructors, most interesting Qt classes cannot be used in unions. Without QVariant, this would be a problem for <a href="qobject.html#property">QObject.property</a>() and for database work, etc.</p>
<p>A QVariant object holds a single value of a single <a href="qvariant.html#type">type</a>() at a time. (Some <a href="qvariant.html#type">type</a>()s are multi-valued, for example a string list.) You can find out what type, T, the variant holds, convert it to a different type using <a href="qvariant.html#convert">convert</a>(), get its value using one of the toT() functions (e.g., <a href="qvariant.html#toSize">toSize</a>()) and check whether the type can be converted to a particular type using <a href="qvariant.html#canConvert">canConvert</a>().</p>
<p>The methods named toT() (e.g., <a href="qvariant.html#toInt">toInt</a>(), <a href="qvariant.html#toString">toString</a>()) are const. If you ask for the stored type, they return a copy of the stored object. If you ask for a type that can be generated from the stored type, toT() copies and converts and leaves the object itself unchanged. If you ask for a type that cannot be generated from the stored type, the result depends on the type; see the function documentation for details.</p>
<p>Here is some example code to demonstrate the use of QVariant:</p>
<pre>
    QDataStream out(...);
    QVariant v(123);                // The variant now contains an int
    int x = v.toInt();              // x = 123
    out &lt;&lt; v;                       // Writes a type tag and an int to out
    v = QVariant("hello");          // The variant now contains a QByteArray
    v = QVariant(tr("hello"));      // The variant now contains a QString
    int y = v.toInt();              // y = 0 since v cannot be converted to an int
    QString s = v.toString();       // s = tr("hello")  (see QObject.tr())
    out &lt;&lt; v;                       // Writes a type tag and a QString to out
    ...
    QDataStream in(...);            // (opening the previously written stream)
    in &gt;&gt; v;                        // Reads an Int variant
    int z = v.toInt();              // z = 123
    qDebug("Type is %s",            // prints "Type is int"
            v.typeName());
    v = v.toInt() + 100;            // The variant now hold the value 223
    v = QVariant(QStringList());
</pre>
<p>You can even store <a href="qlist.html">QList</a>&lt;QVariant&gt; and <a href="qmap.html">QMap</a>&lt;<a href="qstring.html">QString</a>, QVariant&gt; values in a variant, so you can easily construct arbitrarily complex data structures of arbitrary types. This is very powerful and versatile, but may prove less memory and speed efficient than storing specific types in standard data structures.</p>
<p>QVariant also supports the notion of null values, where you have a defined type with no value set.</p>
<pre>
    QVariant x, y(QString()), z(QString(""));
    x.convert(QVariant.Int);
    // x.isNull() == true
    // y.isNull() == true, z.isNull() == false
    // y.isEmpty() == true, z.Empty() == true
</pre>
<p>QVariant can be extended to support other types than those mentioned in the <a href="qvariant.html#Type-enum">Type</a> enum. See the <a href="qmetatype.html">QMetaType</a> documentation for details.</p>
<a id="a-note-on-gui-types" name="a-note-on-gui-types" />
<h3>A Note on GUI Types</h3>
<p>Because QVariant is part of the <a href="qtcore.html">QtCore</a> library, it cannot provide conversion functions to data types such as <a href="qcolor.html">QColor</a>, <a href="qimage.html">QImage</a>, and <a href="qpixmap.html">QPixmap</a>, which are part of <a href="qtgui.html">QtGui</a>. In other words, there is no <tt>toColor()</tt> function.</p>
<p>Instead, you can use the <a href="qvariant.html#value">QVariant.value</a>() or the <a href="qvariant.html#qVariantValue">qVariantValue</a>() template function. For example:</p>
<pre>
    QVariant variant;
    ...
    QColor color = variant.value&lt;QColor&gt;();
</pre>
<p>The inverse conversion (e.g., from <a href="qcolor.html">QColor</a> to QVariant) is automatic for all data types supported by QVariant, including GUI-related types:</p>
<pre>
    QColor color = palette().background().color();
    QVariant variant = color;
</pre>
<p>See also <a href="qmetatype.html">QMetaType</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Type-enum" />QVariant.Type</h3><p>This enum type defines the types of variable that a <a href="qvariant.html">QVariant</a> can contain.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QVariant.Invalid</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">no type</td>
</tr>
<tr>
<td valign="top"><tt>QVariant.BitArray</tt></td>
<td align="center" valign="top"><tt>13</tt></td>
<td valign="top">a <a href="qbitarray.html">QBitArray</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Bitmap</tt></td>
<td align="center" valign="top"><tt>73</tt></td>
<td valign="top">a <a href="qbitmap.html">QBitmap</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Bool</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">a bool</td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Brush</tt></td>
<td align="center" valign="top"><tt>66</tt></td>
<td valign="top">a <a href="qbrush.html">QBrush</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.ByteArray</tt></td>
<td align="center" valign="top"><tt>12</tt></td>
<td valign="top">a <a href="qbytearray.html">QByteArray</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Char</tt></td>
<td align="center" valign="top"><tt>7</tt></td>
<td valign="top">a <a href="qchar.html">QChar</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Color</tt></td>
<td align="center" valign="top"><tt>67</tt></td>
<td valign="top">a <a href="qcolor.html">QColor</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Cursor</tt></td>
<td align="center" valign="top"><tt>74</tt></td>
<td valign="top">a <a href="qcursor.html">QCursor</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Date</tt></td>
<td align="center" valign="top"><tt>14</tt></td>
<td valign="top">a <a href="qdate.html">QDate</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.DateTime</tt></td>
<td align="center" valign="top"><tt>16</tt></td>
<td valign="top">a <a href="qdatetime.html">QDateTime</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Double</tt></td>
<td align="center" valign="top"><tt>6</tt></td>
<td valign="top">a double</td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Font</tt></td>
<td align="center" valign="top"><tt>64</tt></td>
<td valign="top">a <a href="qfont.html">QFont</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Icon</tt></td>
<td align="center" valign="top"><tt>69</tt></td>
<td valign="top">a <a href="qicon.html">QIcon</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Image</tt></td>
<td align="center" valign="top"><tt>70</tt></td>
<td valign="top">a <a href="qimage.html">QImage</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Int</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top">an int</td>
</tr>
<tr>
<td valign="top"><tt>QVariant.KeySequence</tt></td>
<td align="center" valign="top"><tt>76</tt></td>
<td valign="top">a <a href="qkeysequence.html">QKeySequence</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Line</tt></td>
<td align="center" valign="top"><tt>23</tt></td>
<td valign="top">a <a href="qline.html">QLine</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.LineF</tt></td>
<td align="center" valign="top"><tt>24</tt></td>
<td valign="top">a <a href="qlinef.html">QLineF</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.List</tt></td>
<td align="center" valign="top"><tt>9</tt></td>
<td valign="top">a <a href="qvariant.html#QVariantList-typedef">QVariantList</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Locale</tt></td>
<td align="center" valign="top"><tt>18</tt></td>
<td valign="top">a <a href="qlocale.html">QLocale</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.LongLong</tt></td>
<td align="center" valign="top"><tt>4</tt></td>
<td valign="top">a <a href="qtcore.html#qlonglong-typedef">qlonglong</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Map</tt></td>
<td align="center" valign="top"><tt>8</tt></td>
<td valign="top">a <a href="qvariant.html#QVariantMap-typedef">QVariantMap</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Palette</tt></td>
<td align="center" valign="top"><tt>68</tt></td>
<td valign="top">a <a href="qpalette.html">QPalette</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Pen</tt></td>
<td align="center" valign="top"><tt>77</tt></td>
<td valign="top">a <a href="qpen.html">QPen</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Pixmap</tt></td>
<td align="center" valign="top"><tt>65</tt></td>
<td valign="top">a <a href="qpixmap.html">QPixmap</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Point</tt></td>
<td align="center" valign="top"><tt>25</tt></td>
<td valign="top">a <a href="qpoint.html">QPoint</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.PointArray</tt></td>
<td align="center" valign="top"><tt>Polygon</tt></td>
<td valign="top">a <a href="porting4.html#qpointarray">QPointArray</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.PointF</tt></td>
<td align="center" valign="top"><tt>26</tt></td>
<td valign="top">a <a href="qpointf.html">QPointF</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Polygon</tt></td>
<td align="center" valign="top"><tt>71</tt></td>
<td valign="top">a <a href="qpolygon.html">QPolygon</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Rect</tt></td>
<td align="center" valign="top"><tt>19</tt></td>
<td valign="top">a <a href="qrect.html">QRect</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.RectF</tt></td>
<td align="center" valign="top"><tt>20</tt></td>
<td valign="top">a <a href="qrectf.html">QRectF</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.RegExp</tt></td>
<td align="center" valign="top"><tt>27</tt></td>
<td valign="top">a <a href="qregexp.html">QRegExp</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Region</tt></td>
<td align="center" valign="top"><tt>72</tt></td>
<td valign="top">a <a href="qregion.html">QRegion</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Size</tt></td>
<td align="center" valign="top"><tt>21</tt></td>
<td valign="top">a <a href="qsize.html">QSize</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.SizeF</tt></td>
<td align="center" valign="top"><tt>22</tt></td>
<td valign="top">a <a href="qsizef.html">QSizeF</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.SizePolicy</tt></td>
<td align="center" valign="top"><tt>75</tt></td>
<td valign="top">a <a href="qsizepolicy.html">QSizePolicy</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.String</tt></td>
<td align="center" valign="top"><tt>10</tt></td>
<td valign="top">a <a href="qstring.html">QString</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.StringList</tt></td>
<td align="center" valign="top"><tt>11</tt></td>
<td valign="top">a <a href="qstringlist.html">QStringList</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.TextFormat</tt></td>
<td align="center" valign="top"><tt>79</tt></td>
<td valign="top">a <a href="qtextformat.html">QTextFormat</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.TextLength</tt></td>
<td align="center" valign="top"><tt>78</tt></td>
<td valign="top">a <a href="qtextlength.html">QTextLength</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Time</tt></td>
<td align="center" valign="top"><tt>15</tt></td>
<td valign="top">a <a href="qtime.html">QTime</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.UInt</tt></td>
<td align="center" valign="top"><tt>3</tt></td>
<td valign="top">a <a href="qtcore.html#uint-typedef">uint</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.ULongLong</tt></td>
<td align="center" valign="top"><tt>5</tt></td>
<td valign="top">a <a href="qtcore.html#qulonglong-typedef">qulonglong</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.Url</tt></td>
<td align="center" valign="top"><tt>17</tt></td>
<td valign="top">a <a href="qurl.html">QUrl</a></td>
</tr>
<tr>
<td valign="top"><tt>QVariant.UserType</tt></td>
<td align="center" valign="top"><tt>127</tt></td>
<td valign="top">Base value for user-defined types.</td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QVariant" />QVariant.__init__ (<i>self</i>)</h3><p>Constructs an invalid variant.</p>
<h3 class="fn"><a name="QVariant" />QVariant.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs an invalid variant.</p>
<h3 class="fn"><a name="QVariant-2" />QVariant.__init__ (<i>self</i>, <a href="qvariant.html#Type-enum">Type</a>&#160;<i>type</i>)</h3><p>Constructs a null variant of type <i>type</i>.</p>
<h3 class="fn"><a name="QVariant-2" />QVariant.__init__ (<i>self</i>, <a href="qbitmap.html">QBitmap</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a null variant of type <i>type</i>.</p>
<h3 class="fn"><a name="QVariant-3" />QVariant.__init__ (<i>self</i>, int&#160;<i>typeOrUserType</i>, sip.voidptr&#160;<i>copy</i>)</h3><p>Constructs variant of type <i>typeOrUserType</i>, and initializes with <i>copy</i> if <i>copy</i> is not 0.</p>
<p>Note that you have to pass the address of the variable you want stored.</p>
<p>Usually, you never have to use this constructor, use <a href="qvariant.html#qVariantFromValue">qVariantFromValue</a>() instead to construct variants from the pointer types represented by <tt>QMetaType.VoidStar</tt>, <tt>QMetaType.QObjectStar</tt> and <tt>QMetaType.QWidgetStar</tt>.</p>
<p>See also <a href="qvariant.html#qVariantFromValue">qVariantFromValue</a>() and <a href="qvariant.html#Type-enum">Type</a>.</p>
<h3 class="fn"><a name="QVariant-3" />QVariant.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs variant of type <i>typeOrUserType</i>, and initializes with <i>copy</i> if <i>copy</i> is not 0.</p>
<p>Note that you have to pass the address of the variable you want stored.</p>
<p>Usually, you never have to use this constructor, use <a href="qvariant.html#qVariantFromValue">qVariantFromValue</a>() instead to construct variants from the pointer types represented by <tt>QMetaType.VoidStar</tt>, <tt>QMetaType.QObjectStar</tt> and <tt>QMetaType.QWidgetStar</tt>.</p>
<p>See also <a href="qvariant.html#qVariantFromValue">qVariantFromValue</a>() and <a href="qvariant.html#Type-enum">Type</a>.</p>
<h3 class="fn"><a name="QVariant-4" />QVariant.__init__ (<i>self</i>, <a href="qvariant.html">QVariant</a>&#160;<i>other</i>)</h3><p>Constructs a copy of the variant, <i>p</i>, passed as the argument to this constructor.</p>
<h3 class="fn"><a name="QVariant-4" />QVariant.__init__ (<i>self</i>, <a href="qbrush.html">QBrush</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a copy of the variant, <i>p</i>, passed as the argument to this constructor.</p>
<h3 class="fn"><a name="QVariant-5" />QVariant.__init__ (<i>self</i>, <a href="qdatastream.html">QDataStream</a>&#160;<i>s</i>)</h3><p>Reads the variant from the data stream, <i>s</i>.</p>
<h3 class="fn"><a name="QVariant-5" />QVariant.__init__ (<i>self</i>, <a href="qcursor.html">QCursor</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Reads the variant from the data stream, <i>s</i>.</p>
<h3 class="fn"><a name="QVariant-6" />QVariant.__init__ (<i>self</i>, bool&#160;<i>b</i>)</h3><p>Constructs a new variant with an integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-6" />QVariant.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with an integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-7" />QVariant.__init__ (<i>self</i>, int&#160;<i>i</i>)</h3><p>Constructs a new variant with an unsigned integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-7" />QVariant.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with an unsigned integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-8" />QVariant.__init__ (<i>self</i>, float&#160;<i>d</i>)</h3><p>Constructs a new variant with a long long integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-8" />QVariant.__init__ (<i>self</i>, <a href="qimage.html">QImage</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a long long integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-9" />QVariant.__init__ (<i>self</i>, long&#160;<i>ll</i>)</h3><p>Constructs a new variant with an unsigned long long integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-9" />QVariant.__init__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with an unsigned long long integer value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-10" />QVariant.__init__ (<i>self</i>, unsigned long&#160;<i>ull</i>)</h3><p>Constructs a new variant with a boolean value, <i>val</i>. The integer argument is a dummy, necessary for compatibility with some compilers.</p>
<h3 class="fn"><a name="QVariant-10" />QVariant.__init__ (<i>self</i>, <a href="qpalette.html">QPalette</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a boolean value, <i>val</i>. The integer argument is a dummy, necessary for compatibility with some compilers.</p>
<h3 class="fn"><a name="QVariant-11" />QVariant.__init__ (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>string</i>)</h3><p>Constructs a new variant with a floating point value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-11" />QVariant.__init__ (<i>self</i>, <a href="qpen.html">QPen</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a floating point value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-12" />QVariant.__init__ (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>bytearray</i>)</h3><p>Constructs a new variant with a string value of <i>val</i>. The variant creates a deep copy of <i>val</i>, using the encoding set by <a href="qtextcodec.html#setCodecForCStrings">QTextCodec.setCodecForCStrings</a>().</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications.</p>
<p>See also <a href="qtextcodec.html#setCodecForCStrings">QTextCodec.setCodecForCStrings</a>().</p>
<h3 class="fn"><a name="QVariant-12" />QVariant.__init__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a string value of <i>val</i>. The variant creates a deep copy of <i>val</i>, using the encoding set by <a href="qtextcodec.html#setCodecForCStrings">QTextCodec.setCodecForCStrings</a>().</p>
<p>You can disable this operator by defining <tt>QT_NO_CAST_FROM_ASCII</tt> when you compile your applications.</p>
<p>See also <a href="qtextcodec.html#setCodecForCStrings">QTextCodec.setCodecForCStrings</a>().</p>
<h3 class="fn"><a name="QVariant-13" />QVariant.__init__ (<i>self</i>, <a href="qbitarray.html">QBitArray</a>&#160;<i>bitarray</i>)</h3><p>Constructs a new variant with a bytearray value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-13" />QVariant.__init__ (<i>self</i>, <a href="qregion.html">QRegion</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a bytearray value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-14" />QVariant.__init__ (<i>self</i>, <a href="qlatin1string.html">QLatin1String</a>&#160;<i>string</i>)</h3><p>Constructs a new variant with a bitarray value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-14" />QVariant.__init__ (<i>self</i>, <a href="qsizepolicy.html">QSizePolicy</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a bitarray value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-15" />QVariant.__init__ (<i>self</i>, <a href="qstringlist.html">QStringList</a>&#160;<i>stringlist</i>)</h3><p>Constructs a new variant with a string value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-15" />QVariant.__init__ (<i>self</i>, <a href="qtextlength.html">QTextLength</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a string value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-16" />QVariant.__init__ (<i>self</i>, <a href="qchar.html">QChar</a>&#160;<i>qchar</i>)</h3><p>Constructs a new variant with a string value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-16" />QVariant.__init__ (<i>self</i>, <a href="qtextformat.html">QTextFormat</a>)</h3><p>This method is only available if the QtGui module is imported.</p><p>Constructs a new variant with a string value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-17" />QVariant.__init__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>date</i>)</h3><p>Constructs a new variant with a string list value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-18" />QVariant.__init__ (<i>self</i>, <a href="qtime.html">QTime</a>&#160;<i>time</i>)</h3><p>Constructs a new variant with a char value, <i>c</i>.</p>
<h3 class="fn"><a name="QVariant-19" />QVariant.__init__ (<i>self</i>, <a href="qdatetime.html">QDateTime</a>&#160;<i>datetime</i>)</h3><p>Constructs a new variant with a date value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-20" />QVariant.__init__ (<i>self</i>, QVariant-list&#160;<i>list</i>)</h3><p>Constructs a new variant with a time value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-21" />QVariant.__init__ (<i>self</i>, QString-QVariant-dict&#160;<i>map</i>)</h3><p>Constructs a new variant with a date/time value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-22" />QVariant.__init__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>size</i>)</h3><p>Constructs a new variant with a list value, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-23" />QVariant.__init__ (<i>self</i>, <a href="qsizef.html">QSizeF</a>&#160;<i>size</i>)</h3><p>Constructs a new variant with a map of QVariants, <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-24" />QVariant.__init__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt</i>)</h3><p>Constructs a new variant with a size value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-25" />QVariant.__init__ (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>pt</i>)</h3><p>Constructs a new variant with a size value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-26" />QVariant.__init__ (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>line</i>)</h3><p>Constructs a new variant with a point value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-27" />QVariant.__init__ (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>line</i>)</h3><p>Constructs a new variant with a point value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-28" />QVariant.__init__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>Constructs a new variant with a line value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-29" />QVariant.__init__ (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>)</h3><p>Constructs a new variant with a line value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-30" />QVariant.__init__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</h3><p>Constructs a new variant with a rect value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-31" />QVariant.__init__ (<i>self</i>, <a href="qlocale.html">QLocale</a>&#160;<i>locale</i>)</h3><p>Constructs a new variant with a rect value of <i>val</i>.</p>
<h3 class="fn"><a name="QVariant-32" />QVariant.__init__ (<i>self</i>, <a href="qregexp.html">QRegExp</a>&#160;<i>regExp</i>)</h3><p>Constructs a new variant with a url value of <i>val</i>.</p>
<h3 class="fn"><a name="canConvert" />bool QVariant.canConvert (<i>self</i>, <a href="qvariant.html#Type-enum">Type</a>&#160;<i>t</i>)</h3><p>Returns true if the variant's type can be cast to the requested type, <i>t</i>. Such casting is done automatically when calling the <a href="qvariant.html#toInt">toInt</a>(), <a href="qvariant.html#toBool">toBool</a>(), ... methods.</p>
<p>The following casts are done automatically:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Type</th>
<th>Automatically Cast To</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Bool</a></td>
<td><a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">ByteArray</a></td>
<td><a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Char</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">Color</a></td>
<td><a href="qvariant.html#Type-enum">String</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Date</a></td>
<td><a href="qvariant.html#Type-enum">DateTime</a>, <a href="qvariant.html#Type-enum">String</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">DateTime</a></td>
<td><a href="qvariant.html#Type-enum">Date</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">Time</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Double</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">Font</a></td>
<td><a href="qvariant.html#Type-enum">String</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Int</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">KeySequence</a></td>
<td><a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">String</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">List</a></td>
<td><a href="qvariant.html#Type-enum">StringList</a> (if the list's items can be converted to strings)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">LongLong</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Point</a></td>
<td><a href="qvariant.html#Type-enum">PointF</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">Rect</a></td>
<td><a href="qvariant.html#Type-enum">RectF</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">String</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Color</a>, <a href="qvariant.html#Type-enum">Date</a>, <a href="qvariant.html#Type-enum">DateTime</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Font</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">KeySequence</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">StringList</a>, <a href="qvariant.html#Type-enum">Time</a>, <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">StringList</a></td>
<td><a href="qvariant.html#Type-enum">List</a>, <a href="qvariant.html#Type-enum">String</a> (if the list contains exactly one item)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">Time</a></td>
<td><a href="qvariant.html#Type-enum">DateTime</a>, <a href="qvariant.html#Type-enum">String</a></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td><a href="qvariant.html#Type-enum">UInt</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">ULongLong</a></td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td><a href="qvariant.html#Type-enum">ULongLong</a></td>
<td><a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a></td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="clear" />QVariant.clear (<i>self</i>)</h3><p>Convert this variant to type Invalid and free up any resources used.</p>
<h3 class="fn"><a name="convert" />bool QVariant.convert (<i>self</i>, <a href="qvariant.html#Type-enum">Type</a>&#160;<i>t</i>)</h3><p>Casts the variant to the requested type. If the cast cannot be done, the variant is set to the default value of the requested type (e.g. an empty string if the requested type <i>t</i> is <a href="qvariant.html#Type-enum">QVariant.String</a>, an empty point array if the requested type <i>t</i> is <a href="qvariant.html#Type-enum">QVariant.Polygon</a>, etc). Returns true if the current type of the variant was successfully cast; otherwise returns false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>().</p>
<h3 class="fn"><a name="data" />sip.voidptr QVariant.data (<i>self</i>)</h3><h3 class="fn"><a name="detach" />QVariant.detach (<i>self</i>)</h3><h3 class="fn"><a name="isDetached" />bool QVariant.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isNull" />bool QVariant.isNull (<i>self</i>)</h3><p>Returns true if this is a NULL variant, false otherwise.</p>
<h3 class="fn"><a name="isValid" />bool QVariant.isValid (<i>self</i>)</h3><p>Returns true if the storage type of this variant is not <a href="qvariant.html#Type-enum">QVariant.Invalid</a>; otherwise returns false.</p>
<h3 class="fn"><a name="load" />QVariant.load (<i>self</i>, <a href="qdatastream.html">QDataStream</a>&#160;<i>ds</i>)</h3><h3 class="fn"><a name="nameToType" /><a href="qvariant.html#Type-enum">Type</a> QVariant.nameToType (str&#160;<i>name</i>)</h3><p>Converts the string representation of the storage type given in <i>name</i>, to its enum representation.</p>
<p>If the string representation cannot be converted to any enum representation, the variant is set to <tt>Invalid</tt>.</p>
<h3 class="fn"><a name="save" />QVariant.save (<i>self</i>, <a href="qdatastream.html">QDataStream</a>&#160;<i>ds</i>)</h3><h3 class="fn"><a name="toBitArray" /><a href="qbitarray.html">QBitArray</a> QVariant.toBitArray (<i>self</i>)</h3><p>Returns the variant as a <a href="qbitarray.html">QBitArray</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">BitArray</a>; otherwise returns an empty bit array.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toBool" />bool QVariant.toBool (<i>self</i>)</h3><p>Returns the variant as a bool if the variant has <a href="qvariant.html#type">type</a>() Bool.</p>
<p>Returns true if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">UInt</a>, or <a href="qvariant.html#Type-enum">ULongLong</a> and the value is non-zero, or if the variant has type <a href="qvariant.html#Type-enum">String</a> and its lower-case content is not empty, "0" or "false"; otherwise returns false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toByteArray" /><a href="qbytearray.html">QByteArray</a> QVariant.toByteArray (<i>self</i>)</h3><p>Returns the variant as a <a href="qbytearray.html">QByteArray</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">ByteArray</a> or <a href="qvariant.html#Type-enum">String</a> (converted using <a href="qstring.html#fromAscii">QString.fromAscii</a>()); otherwise returns an empty byte array.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toChar" /><a href="qchar.html">QChar</a> QVariant.toChar (<i>self</i>)</h3><p>Returns the variant as a <a href="qchar.html">QChar</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Int</a>, or <a href="qvariant.html#Type-enum">UInt</a>; otherwise returns an invalid <a href="qchar.html">QChar</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toDate" /><a href="qdate.html">QDate</a> QVariant.toDate (<i>self</i>)</h3><p>Returns the variant as a <a href="qdate.html">QDate</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Date</a>, <a href="qvariant.html#Type-enum">DateTime</a>, or <a href="qvariant.html#Type-enum">String</a>; otherwise returns an invalid date.</p>
<p>If the <a href="qvariant.html#type">type</a>() is <a href="qvariant.html#Type-enum">String</a>, an invalid date will be returned if the string cannot be parsed as a <a href="qt.html#DateFormat-enum">Qt.ISODate</a> format date.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toDateTime" /><a href="qdatetime.html">QDateTime</a> QVariant.toDateTime (<i>self</i>)</h3><p>Returns the variant as a <a href="qdatetime.html">QDateTime</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">DateTime</a>, <a href="qvariant.html#Type-enum">Date</a>, or <a href="qvariant.html#Type-enum">String</a>; otherwise returns an invalid date/time.</p>
<p>If the <a href="qvariant.html#type">type</a>() is <a href="qvariant.html#Type-enum">String</a>, an invalid date/time will be returned if the string cannot be parsed as a <a href="qt.html#DateFormat-enum">Qt.ISODate</a> format date/time.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toDouble" />(float, bool&#160;<i>ok</i>) QVariant.toDouble (<i>self</i>)</h3><p>Returns the variant as a double if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, or <a href="qvariant.html#Type-enum">ULongLong</a>; otherwise returns 0.0.</p>
<p>If <i>ok</i> is non-null: <tt>*</tt><i>ok</i> is set to true if the value could be converted to a double; otherwise <tt>*</tt><i>ok</i> is set to false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toInt" />(int, bool&#160;<i>ok</i>) QVariant.toInt (<i>self</i>)</h3><p>Returns the variant as an int if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, or <a href="qvariant.html#Type-enum">ULongLong</a>; otherwise returns 0.</p>
<p>If <i>ok</i> is non-null: <tt>*</tt><i>ok</i> is set to true if the value could be converted to an int; otherwise <tt>*</tt><i>ok</i> is set to false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toLine" /><a href="qline.html">QLine</a> QVariant.toLine (<i>self</i>)</h3><p>Returns the variant as a <a href="qline.html">QLine</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Line</a>; otherwise returns an invalid <a href="qline.html">QLine</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toLineF" /><a href="qlinef.html">QLineF</a> QVariant.toLineF (<i>self</i>)</h3><p>Returns the variant as a <a href="qlinef.html">QLineF</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">LineF</a>; otherwise returns an invalid <a href="qlinef.html">QLineF</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toList" />QVariant-list QVariant.toList (<i>self</i>)</h3><p>Returns the variant as a <a href="qvariant.html#QVariantList-typedef">QVariantList</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">List</a> or <a href="qvariant.html#Type-enum">StringList</a>; otherwise returns an empty list.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toLocale" /><a href="qlocale.html">QLocale</a> QVariant.toLocale (<i>self</i>)</h3><p>Returns the variant as a <a href="qlocale.html">QLocale</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Locale</a>; otherwise returns an invalid <a href="qlocale.html">QLocale</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toLongLong" />(long, bool&#160;<i>ok</i>) QVariant.toLongLong (<i>self</i>)</h3><p>Returns the variant as a long long int if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">UInt</a>, or <a href="qvariant.html#Type-enum">ULongLong</a>; otherwise returns 0.</p>
<p>If <i>ok</i> is non-null: <tt>*</tt><tt>ok</tt> is set to true if the value could be converted to an int; otherwise <tt>*</tt><tt>ok</tt> is set to false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toMap" />QString-QVariant-dict QVariant.toMap (<i>self</i>)</h3><p>Returns the variant as a <a href="qmap.html">QMap</a>&lt;<a href="qstring.html">QString</a>, <a href="qvariant.html">QVariant</a>&gt; if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Map</a>; otherwise returns an empty map.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toPoint" /><a href="qpoint.html">QPoint</a> QVariant.toPoint (<i>self</i>)</h3><p>Returns the variant as a <a href="qpoint.html">QPoint</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Point</a> or <a href="qvariant.html#Type-enum">PointF</a>; otherwise returns a null <a href="qpoint.html">QPoint</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toPointF" /><a href="qpointf.html">QPointF</a> QVariant.toPointF (<i>self</i>)</h3><p>Returns the variant as a <a href="qpointf.html">QPointF</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Point</a> or <a href="qvariant.html#Type-enum">PointF</a>; otherwise returns a null <a href="qpointf.html">QPointF</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toRect" /><a href="qrect.html">QRect</a> QVariant.toRect (<i>self</i>)</h3><p>Returns the variant as a <a href="qrect.html">QRect</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Rect</a>; otherwise returns an invalid <a href="qrect.html">QRect</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toRectF" /><a href="qrectf.html">QRectF</a> QVariant.toRectF (<i>self</i>)</h3><p>Returns the variant as a <a href="qrectf.html">QRectF</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Rect</a> or <a href="qvariant.html#Type-enum">RectF</a>; otherwise returns an invalid <a href="qrectf.html">QRectF</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toRegExp" /><a href="qregexp.html">QRegExp</a> QVariant.toRegExp (<i>self</i>)</h3><p>Returns the variant as a <a href="qregexp.html">QRegExp</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">RegExp</a>; otherwise returns an empty <a href="qregexp.html">QRegExp</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toSize" /><a href="qsize.html">QSize</a> QVariant.toSize (<i>self</i>)</h3><p>Returns the variant as a <a href="qsize.html">QSize</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Size</a>; otherwise returns an invalid <a href="qsize.html">QSize</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toSizeF" /><a href="qsizef.html">QSizeF</a> QVariant.toSizeF (<i>self</i>)</h3><p>Returns the variant as a <a href="qsizef.html">QSizeF</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">SizeF</a>; otherwise returns an invalid <a href="qsizef.html">QSizeF</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toString" /><a href="qstring.html">QString</a> QVariant.toString (<i>self</i>)</h3><p>Returns the variant as a <a href="qstring.html">QString</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">String</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Date</a>, <a href="qvariant.html#Type-enum">DateTime</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">StringList</a>, <a href="qvariant.html#Type-enum">Time</a>, <a href="qvariant.html#Type-enum">UInt</a>, or <a href="qvariant.html#Type-enum">ULongLong</a>; otherwise returns an empty string.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toStringList" /><a href="qstringlist.html">QStringList</a> QVariant.toStringList (<i>self</i>)</h3><p>Returns the variant as a <a href="qstringlist.html">QStringList</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">StringList</a>, <a href="qvariant.html#Type-enum">String</a>, or <a href="qvariant.html#Type-enum">List</a> of a type that can be converted to <a href="qstring.html">QString</a>; otherwise returns an empty list.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toTime" /><a href="qtime.html">QTime</a> QVariant.toTime (<i>self</i>)</h3><p>Returns the variant as a <a href="qtime.html">QTime</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Time</a>, <a href="qvariant.html#Type-enum">DateTime</a>, or <a href="qvariant.html#Type-enum">String</a>; otherwise returns an invalid time.</p>
<p>If the <a href="qvariant.html#type">type</a>() is <a href="qvariant.html#Type-enum">String</a>, an invalid time will be returned if the string cannot be parsed as a <a href="qt.html#DateFormat-enum">Qt.ISODate</a> format time.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toUInt" />(unsigned long, bool&#160;<i>ok</i>) QVariant.toUInt (<i>self</i>)</h3><p>Returns the variant as an unsigned int if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">UInt</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, or <a href="qvariant.html#Type-enum">ULongLong</a>; otherwise returns 0.</p>
<p>If <i>ok</i> is non-null: <tt>*</tt><i>ok</i> is set to true if the value could be converted to an unsigned int; otherwise <tt>*</tt><i>ok</i> is set to false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toULongLong" />(unsigned long, bool&#160;<i>ok</i>) QVariant.toULongLong (<i>self</i>)</h3><p>Returns the variant as as an unsigned long long int if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">ULongLong</a>, <a href="qvariant.html#Type-enum">Bool</a>, <a href="qvariant.html#Type-enum">ByteArray</a>, <a href="qvariant.html#Type-enum">Char</a>, <a href="qvariant.html#Type-enum">Double</a>, <a href="qvariant.html#Type-enum">Int</a>, <a href="qvariant.html#Type-enum">LongLong</a>, <a href="qvariant.html#Type-enum">String</a>, or <a href="qvariant.html#Type-enum">UInt</a>; otherwise returns 0.</p>
<p>If <i>ok</i> is non-null: <tt>*</tt><i>ok</i> is set to true if the value could be converted to an int; otherwise <tt>*</tt><i>ok</i> is set to false.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="toUrl" /><a href="qurl.html">QUrl</a> QVariant.toUrl (<i>self</i>)</h3><p>Returns the variant as a <a href="qurl.html">QUrl</a> if the variant has <a href="qvariant.html#type">type</a>() <a href="qvariant.html#Type-enum">Url</a>; otherwise returns an invalid <a href="qurl.html">QUrl</a>.</p>
<p>See also <a href="qvariant.html#canConvert">canConvert</a>() and <a href="qvariant.html#convert">convert</a>().</p>
<h3 class="fn"><a name="type" /><a href="qvariant.html#Type-enum">Type</a> QVariant.type (<i>self</i>)</h3><p>Returns the storage type of the value stored in the variant. Usually it's best to test with <a href="qvariant.html#canConvert">canConvert</a>() whether the variant can deliver the data type you are interested in.</p>
<h3 class="fn"><a name="typeName" />str QVariant.typeName (<i>self</i>)</h3><p>Returns the name of the type stored in the variant. The returned strings describe the C++ datatype used to store the data: for example, "<a href="qfont.html">QFont</a>", "<a href="qstring.html">QString</a>", or "<a href="qvariant.html#QVariantList-typedef">QVariantList</a>". An Invalid variant returns 0.</p>
<h3 class="fn"><a name="typeToName" />str QVariant.typeToName (<a href="qvariant.html#Type-enum">Type</a>&#160;<i>type</i>)</h3><p>Converts the enum representation of the storage type, <i>typ</i>, to its string representation.</p>
<h3 class="fn"><a name="userType" />int QVariant.userType (<i>self</i>)</h3><p>Returns the storage type of the value stored in the variant. For non-user types, this is the same as <a href="qvariant.html#type">type</a>().</p>
<p>See also <a href="qvariant.html#type">type</a>().</p>
<h3 class="fn"><a name="__eq__" />bool QVariant.__eq__ (<i>self</i>, <a href="qvariant.html">QVariant</a>&#160;<i>v</i>)</h3><h3 class="fn"><a name="__ne__" />bool QVariant.__ne__ (<i>self</i>, <a href="qvariant.html">QVariant</a>&#160;<i>v</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.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.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>