Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 2018

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qvariant.cpp:320 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QVariant Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QVariant Class Reference</h1>

<p>The QVariant class acts like a union for the most common Qt data types.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qvariant-h.html">qvariant.h</a>&gt;</tt>
<p><a href="qvariant-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn>enum <a href="#Type-enum"><b>Type</b></a> { Invalid, Map, List, String, StringList, Font, Pixmap, Brush, Rect, Size, Color, Palette, ColorGroup, IconSet, Point, Image, Int, UInt, Bool, Double, CString, PointArray, Region, Bitmap, Cursor, SizePolicy, Date, Time, DateTime, ByteArray, BitArray, KeySequence }</div></li>
<li><div class=fn><a href="#QVariant"><b>QVariant</b></a> ()</div></li>
<li><div class=fn><a href="#~QVariant"><b>~QVariant</b></a> ()</div></li>
<li><div class=fn><a href="#QVariant-2"><b>QVariant</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;p )</div></li>
<li><div class=fn><a href="#QVariant-3"><b>QVariant</b></a> ( QDataStream&nbsp;&amp;&nbsp;s )</div></li>
<li><div class=fn><a href="#QVariant-4"><b>QVariant</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-5"><b>QVariant</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-6"><b>QVariant</b></a> ( const&nbsp;char&nbsp;*&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-7"><b>QVariant</b></a> ( const&nbsp;QStringList&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-8"><b>QVariant</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-9"><b>QVariant</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-a"><b>QVariant</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-b"><b>QVariant</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-c"><b>QVariant</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-d"><b>QVariant</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-e"><b>QVariant</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-f"><b>QVariant</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-g"><b>QVariant</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-h"><b>QVariant</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-i"><b>QVariant</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-j"><b>QVariant</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-k"><b>QVariant</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-l"><b>QVariant</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-m"><b>QVariant</b></a> ( const&nbsp;QCursor&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-n"><b>QVariant</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-o"><b>QVariant</b></a> ( const&nbsp;QTime&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-p"><b>QVariant</b></a> ( const&nbsp;QDateTime&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-q"><b>QVariant</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-r"><b>QVariant</b></a> ( const&nbsp;QBitArray&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-s"><b>QVariant</b></a> ( const&nbsp;QKeySequence&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-t"><b>QVariant</b></a> ( const&nbsp;QValueList&lt;QVariant&gt;&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-u"><b>QVariant</b></a> ( const&nbsp;QMap&lt;QString,&nbsp;QVariant&gt;&nbsp;&amp;&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-v"><b>QVariant</b></a> ( int&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-w"><b>QVariant</b></a> ( uint&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-x"><b>QVariant</b></a> ( bool&nbsp;val, int )</div></li>
<li><div class=fn><a href="#QVariant-y"><b>QVariant</b></a> ( double&nbsp;val )</div></li>
<li><div class=fn><a href="#QVariant-z"><b>QVariant</b></a> ( QSizePolicy&nbsp;val )</div></li>
<li><div class=fn>QVariant &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;variant )</div></li>
<li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;v ) const</div></li>
<li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;v ) const</div></li>
<li><div class=fn>Type <a href="#type"><b>type</b></a> () const</div></li>
<li><div class=fn>const char * <a href="#typeName"><b>typeName</b></a> () const</div></li>
<li><div class=fn>bool <a href="#canCast"><b>canCast</b></a> ( Type&nbsp;t ) const</div></li>
<li><div class=fn>bool <a href="#cast"><b>cast</b></a> ( Type&nbsp;t )</div></li>
<li><div class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</div></li>
<li><div class=fn>void <a href="#clear"><b>clear</b></a> ()</div></li>
<li><div class=fn>const QString <a href="#toString"><b>toString</b></a> () const</div></li>
<li><div class=fn>const QCString <a href="#toCString"><b>toCString</b></a> () const</div></li>
<li><div class=fn>const QStringList <a href="#toStringList"><b>toStringList</b></a> () const</div></li>
<li><div class=fn>const QFont <a href="#toFont"><b>toFont</b></a> () const</div></li>
<li><div class=fn>const QPixmap <a href="#toPixmap"><b>toPixmap</b></a> () const</div></li>
<li><div class=fn>const QImage <a href="#toImage"><b>toImage</b></a> () const</div></li>
<li><div class=fn>const QBrush <a href="#toBrush"><b>toBrush</b></a> () const</div></li>
<li><div class=fn>const QPoint <a href="#toPoint"><b>toPoint</b></a> () const</div></li>
<li><div class=fn>const QRect <a href="#toRect"><b>toRect</b></a> () const</div></li>
<li><div class=fn>const QSize <a href="#toSize"><b>toSize</b></a> () const</div></li>
<li><div class=fn>const QColor <a href="#toColor"><b>toColor</b></a> () const</div></li>
<li><div class=fn>const QPalette <a href="#toPalette"><b>toPalette</b></a> () const</div></li>
<li><div class=fn>const QColorGroup <a href="#toColorGroup"><b>toColorGroup</b></a> () const</div></li>
<li><div class=fn>const QIconSet <a href="#toIconSet"><b>toIconSet</b></a> () const</div></li>
<li><div class=fn>const QPointArray <a href="#toPointArray"><b>toPointArray</b></a> () const</div></li>
<li><div class=fn>const QBitmap <a href="#toBitmap"><b>toBitmap</b></a> () const</div></li>
<li><div class=fn>const QRegion <a href="#toRegion"><b>toRegion</b></a> () const</div></li>
<li><div class=fn>const QCursor <a href="#toCursor"><b>toCursor</b></a> () const</div></li>
<li><div class=fn>const QDate <a href="#toDate"><b>toDate</b></a> () const</div></li>
<li><div class=fn>const QTime <a href="#toTime"><b>toTime</b></a> () const</div></li>
<li><div class=fn>const QDateTime <a href="#toDateTime"><b>toDateTime</b></a> () const</div></li>
<li><div class=fn>const QByteArray <a href="#toByteArray"><b>toByteArray</b></a> () const</div></li>
<li><div class=fn>const QBitArray <a href="#toBitArray"><b>toBitArray</b></a> () const</div></li>
<li><div class=fn>const QKeySequence <a href="#toKeySequence"><b>toKeySequence</b></a> () const</div></li>
<li><div class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</div></li>
<li><div class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</div></li>
<li><div class=fn>bool <a href="#toBool"><b>toBool</b></a> () const</div></li>
<li><div class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool&nbsp;*&nbsp;ok = 0 ) const</div></li>
<li><div class=fn>const QValueList&lt;QVariant&gt; <a href="#toList"><b>toList</b></a> () const</div></li>
<li><div class=fn>const QMap&lt;QString, QVariant&gt; <a href="#toMap"><b>toMap</b></a> () const</div></li>
<li><div class=fn>QSizePolicy <a href="#toSizePolicy"><b>toSizePolicy</b></a> () const</div></li>
<li><div class=fn>QValueListConstIterator&lt;QString&gt; <a href="#stringListBegin"><b>stringListBegin</b></a> () const</div></li>
<li><div class=fn>QValueListConstIterator&lt;QString&gt; <a href="#stringListEnd"><b>stringListEnd</b></a> () const</div></li>
<li><div class=fn>QValueListConstIterator&lt;QVariant&gt; <a href="#listBegin"><b>listBegin</b></a> () const</div></li>
<li><div class=fn>QValueListConstIterator&lt;QVariant&gt; <a href="#listEnd"><b>listEnd</b></a> () const</div></li>
<li><div class=fn>QMapConstIterator&lt;QString, QVariant&gt; <a href="#mapBegin"><b>mapBegin</b></a> () const</div></li>
<li><div class=fn>QMapConstIterator&lt;QString, QVariant&gt; <a href="#mapEnd"><b>mapEnd</b></a> () const</div></li>
<li><div class=fn>QMapConstIterator&lt;QString, QVariant&gt; <a href="#mapFind"><b>mapFind</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key ) const</div></li>
<li><div class=fn>QString &amp; <a href="#asString"><b>asString</b></a> ()</div></li>
<li><div class=fn>QCString &amp; <a href="#asCString"><b>asCString</b></a> ()</div></li>
<li><div class=fn>QStringList &amp; <a href="#asStringList"><b>asStringList</b></a> ()</div></li>
<li><div class=fn>QFont &amp; <a href="#asFont"><b>asFont</b></a> ()</div></li>
<li><div class=fn>QPixmap &amp; <a href="#asPixmap"><b>asPixmap</b></a> ()</div></li>
<li><div class=fn>QImage &amp; <a href="#asImage"><b>asImage</b></a> ()</div></li>
<li><div class=fn>QBrush &amp; <a href="#asBrush"><b>asBrush</b></a> ()</div></li>
<li><div class=fn>QPoint &amp; <a href="#asPoint"><b>asPoint</b></a> ()</div></li>
<li><div class=fn>QRect &amp; <a href="#asRect"><b>asRect</b></a> ()</div></li>
<li><div class=fn>QSize &amp; <a href="#asSize"><b>asSize</b></a> ()</div></li>
<li><div class=fn>QColor &amp; <a href="#asColor"><b>asColor</b></a> ()</div></li>
<li><div class=fn>QPalette &amp; <a href="#asPalette"><b>asPalette</b></a> ()</div></li>
<li><div class=fn>QColorGroup &amp; <a href="#asColorGroup"><b>asColorGroup</b></a> ()</div></li>
<li><div class=fn>QIconSet &amp; <a href="#asIconSet"><b>asIconSet</b></a> ()</div></li>
<li><div class=fn>QPointArray &amp; <a href="#asPointArray"><b>asPointArray</b></a> ()</div></li>
<li><div class=fn>QBitmap &amp; <a href="#asBitmap"><b>asBitmap</b></a> ()</div></li>
<li><div class=fn>QRegion &amp; <a href="#asRegion"><b>asRegion</b></a> ()</div></li>
<li><div class=fn>QCursor &amp; <a href="#asCursor"><b>asCursor</b></a> ()</div></li>
<li><div class=fn>QDate &amp; <a href="#asDate"><b>asDate</b></a> ()</div></li>
<li><div class=fn>QTime &amp; <a href="#asTime"><b>asTime</b></a> ()</div></li>
<li><div class=fn>QDateTime &amp; <a href="#asDateTime"><b>asDateTime</b></a> ()</div></li>
<li><div class=fn>QByteArray &amp; <a href="#asByteArray"><b>asByteArray</b></a> ()</div></li>
<li><div class=fn>QBitArray &amp; <a href="#asBitArray"><b>asBitArray</b></a> ()</div></li>
<li><div class=fn>QKeySequence &amp; <a href="#asKeySequence"><b>asKeySequence</b></a> ()</div></li>
<li><div class=fn>int &amp; <a href="#asInt"><b>asInt</b></a> ()</div></li>
<li><div class=fn>uint &amp; <a href="#asUInt"><b>asUInt</b></a> ()</div></li>
<li><div class=fn>bool &amp; <a href="#asBool"><b>asBool</b></a> ()</div></li>
<li><div class=fn>double &amp; <a href="#asDouble"><b>asDouble</b></a> ()</div></li>
<li><div class=fn>QValueList&lt;QVariant&gt; &amp; <a href="#asList"><b>asList</b></a> ()</div></li>
<li><div class=fn>QMap&lt;QString, QVariant&gt; &amp; <a href="#asMap"><b>asMap</b></a> ()</div></li>
<li><div class=fn>QSizePolicy &amp; <a href="#asSizePolicy"><b>asSizePolicy</b></a> ()</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>const char * <a href="#typeToName"><b>typeToName</b></a> ( Type&nbsp;typ )</div></li>
<li><div class=fn>Type <a href="#nameToType"><b>nameToType</b></a> ( const&nbsp;char&nbsp;*&nbsp;name )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


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.  This is a problem when using <a href="qobject.html#property">QObject::property</a>(), among
other things.
<p> This class provides union functionality for property() and most
other needs that might be solved by a union including e.g. <a href="qwidget.html">QWidget</a>.
<p> A QVariant object can hold any one <a href="#type">type</a>() at a time. For example, you can
find out what type, T, it holds, convert it to a different type
using one of the asT() functions, e.g. <a href="#asSize">asSize</a>(), get its value using
one of the toT() functions, e.g. <a href="#toSize">toSize</a>(), and check whether the type
can be converted to a particular type using <a href="#canCast">canCast</a>().
<p> The methods named toT() (for any supported T, see the Type
documentation for a list) 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> Note that three data types supported by QVariant are <a href="shclass.html#explicitly-shared">explicitly shared</a>, namely <a href="qimage.html">QImage</a>, <a href="qpointarray.html">QPointArray</a>, and <a href="qcstring.html">QCString</a>, and in these cases
the toT() methods return a <a href="shclass.html#shallow-copy">shallow copy</a>.  In almost all cases you
must make a <a href="shclass.html#deep-copy">deep copy</a> of the returned values before modifying them.
<p> The asT() functions are not const. They do conversion like the toT()
methods, set the variant to hold the converted value, and return a
reference to the new contents of the variant.
<p> Here is example code to demonstrate the use of QVariant:
<p> <pre>
    <a href="qdatastream.html">QDataStream</a> out(...);
    QVariant v(123);          // The variant now contains an int
    int x = v.<a href="#toInt">toInt</a>();        // x = 123
    out &lt;&lt; v;                 // Writes a type tag and an int to out
    v = <a href="#QVariant">QVariant</a>("hello");    // The variant now contains a QCString
    v = <a href="#QVariant">QVariant</a>(tr("hello"));// The variant now contains a QString
    int y = v.<a href="#toInt">toInt</a>();        // y = 0 since v cannot be converted to an int
    <a href="qstring.html">QString</a> s = v.<a href="#toString">toString</a>(); // s = tr("hello")  (see QObject::tr())
    out &lt;&lt; v;                 // Writes a type tag and a QString to out
    ...
    <a href="qdatastream.html">QDataStream</a> in(...);      // (opening the previously written stream)
    in &gt;&gt; v;                  // Reads an Int variant
    int z = v.<a href="#toInt">toInt</a>();        // z = 123
    <a href="qapplication.html#qDebug">qDebug</a>("Type is %s",      // prints "Type is int"
           v.<a href="#typeName">typeName</a>());
    v.<a href="#asInt">asInt</a>() += 100;         // The variant now hold the value 223.
    v = <a href="#QVariant">QVariant</a>( QStringList() );
    v.<a href="#asStringList">asStringList</a>().append( "Hello" );
  </pre>
 
<p> You can even have store <a href="qvaluelist.html">QValueList</a><QVariant>s and
<a href="qmap.html">QMap</a><QString,QVariant>s 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.
(See the <a href="collection.html">Collection Classes</a>.)
<p>See also <a href="misc.html">Miscellaneous Classes</a> and <a href="objectmodel.html">Object Model</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Type-enum"></a>QVariant::Type</h3> 
<p> This enum type defines the types of variable that a QVariant can
contain.  The supported enum values and the associated types are
<ul>
<li><tt>QVariant::Invalid</tt> - no type
<li><tt>QVariant::List</tt> - a <a href="qvaluelist.html">QValueList</a><QVariant>
<li><tt>QVariant::Map</tt> - a <a href="qmap.html">QMap</a><QString,QVariant>
<li><tt>QVariant::String</tt> - a <a href="qstring.html">QString</a>
<li><tt>QVariant::StringList</tt> - a <a href="qstringlist.html">QStringList</a>
<li><tt>QVariant::Font</tt> - a <a href="qfont.html">QFont</a>
<li><tt>QVariant::Pixmap</tt> - a <a href="qpixmap.html">QPixmap</a>
<li><tt>QVariant::Brush</tt> - a <a href="qbrush.html">QBrush</a>
<li><tt>QVariant::Rect</tt> - a <a href="qrect.html">QRect</a>
<li><tt>QVariant::Size</tt> - a <a href="qsize.html">QSize</a>
<li><tt>QVariant::Color</tt> - a <a href="qcolor.html">QColor</a>
<li><tt>QVariant::Palette</tt> - a <a href="qpalette.html">QPalette</a>
<li><tt>QVariant::ColorGroup</tt> - a <a href="qcolorgroup.html">QColorGroup</a>
<li><tt>QVariant::IconSet</tt> - a <a href="qiconset.html">QIconSet</a>
<li><tt>QVariant::Point</tt> - a <a href="qpoint.html">QPoint</a>
<li><tt>QVariant::Image</tt> - a <a href="qimage.html">QImage</a>
<li><tt>QVariant::Int</tt> - an int
<li><tt>QVariant::UInt</tt> - an unsigned int
<li><tt>QVariant::Bool</tt> - a bool
<li><tt>QVariant::Double</tt> - a double
<li><tt>QVariant::CString</tt> - a <a href="qcstring.html">QCString</a>
<li><tt>QVariant::PointArray</tt> - a <a href="qpointarray.html">QPointArray</a>
<li><tt>QVariant::Region</tt> - a <a href="qregion.html">QRegion</a>
<li><tt>QVariant::Bitmap</tt> - a <a href="qbitmap.html">QBitmap</a>
<li><tt>QVariant::Cursor</tt> - a <a href="qcursor.html">QCursor</a>
<li><tt>QVariant::Date</tt> - a <a href="qdate.html">QDate</a>
<li><tt>QVariant::Time</tt> - a <a href="qtime.html">QTime</a>
<li><tt>QVariant::DateTime</tt> - a <a href="qdatetime.html">QDateTime</a>
<li><tt>QVariant::ByteArray</tt> - a <a href="qbytearray.html">QByteArray</a>
<li><tt>QVariant::BitArray</tt> - a <a href="qbitarray.html">QBitArray</a>
<li><tt>QVariant::SizePolicy</tt> - a <a href="qsizepolicy.html">QSizePolicy</a>
<li><tt>QVariant::KeySequence</tt> - a <a href="qkeysequence.html">QKeySequence</a>
</ul><p> Note that Qt's definition of bool depends on the compiler.
qglobal.h has the system-dependent definition of bool.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QVariant"></a>QVariant::QVariant ()
</h3>
Constructs an invalid variant.

<h3 class=fn><a name="QVariant-2"></a>QVariant::QVariant ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;p )
</h3>
Constructs a copy of the variant, <em>p</em>, passed as the argument to this
constructor. Usually this is a <a href="shclass.html#deep-copy">deep copy</a>, but a <a href="shclass.html#shallow-copy">shallow copy</a> is made
if the stored data type is <a href="shclass.html#explicitly-shared">explicitly shared</a>, as e.g. <a href="qimage.html">QImage</a> is.

<h3 class=fn><a name="QVariant-3"></a>QVariant::QVariant ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s )
</h3>
Reads the variant from the data stream, <em>s</em>.

<h3 class=fn><a name="QVariant-4"></a>QVariant::QVariant ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a string value, <em>val</em>.

<h3 class=fn><a name="QVariant-5"></a>QVariant::QVariant ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a C-string value, <em>val</em>.
<p> If you want to modify the <a href="qcstring.html">QCString</a> after you've passed it to this
constructor, we recommend passing a <a href="shclass.html#deep-copy">deep copy</a> (see
<a href="qcstring.html#copy">QCString::copy</a>()).

<h3 class=fn><a name="QVariant-6"></a>QVariant::QVariant ( const&nbsp;char&nbsp;*&nbsp;val )
</h3>
Constructs a new variant with a C-string value of <em>val</em> if <em>val</em>
is non-null.  The variant creates a <a href="shclass.html#deep-copy">deep copy</a> of <em>val</em>.
<p> If <em>val</em> is null, the resulting variant has type Invalid.

<h3 class=fn><a name="QVariant-7"></a>QVariant::QVariant ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a string list value, <em>val</em>.

<h3 class=fn><a name="QVariant-8"></a>QVariant::QVariant ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a font value, <em>val</em>.

<h3 class=fn><a name="QVariant-9"></a>QVariant::QVariant ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a pixmap value, <em>val</em>.

<h3 class=fn><a name="QVariant-a"></a>QVariant::QVariant ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with an image value, <em>val</em>.
<p> Because <a href="qimage.html">QImage</a> is <a href="shclass.html#explicitly-shared">explicitly shared</a>, you may need to pass a <a href="shclass.html#deep-copy">deep copy</a>
to the variant using <a href="qimage.html#copy">QImage::copy</a>(), e.g. if you intend changing the
image you've passed later on.

<h3 class=fn><a name="QVariant-b"></a>QVariant::QVariant ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a brush value, <em>val</em>.

<h3 class=fn><a name="QVariant-c"></a>QVariant::QVariant ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a point value, <em>val</em>.

<h3 class=fn><a name="QVariant-d"></a>QVariant::QVariant ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a rect value, <em>val</em>.

<h3 class=fn><a name="QVariant-e"></a>QVariant::QVariant ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a size value, <em>val</em>.

<h3 class=fn><a name="QVariant-f"></a>QVariant::QVariant ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a color value, <em>val</em>.

<h3 class=fn><a name="QVariant-g"></a>QVariant::QVariant ( const&nbsp;<a href="qpalette.html">QPalette</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a color palette value, <em>val</em>.

<h3 class=fn><a name="QVariant-h"></a>QVariant::QVariant ( const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a color group value, <em>val</em>.

<h3 class=fn><a name="QVariant-i"></a>QVariant::QVariant ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with an icon set value, <em>val</em>.

<h3 class=fn><a name="QVariant-j"></a>QVariant::QVariant ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a point array value, <em>val</em>.
<p> Because <a href="qpointarray.html">QPointArray</a> is <a href="shclass.html#explicitly-shared">explicitly shared</a>, you may need to pass a
<a href="shclass.html#deep-copy">deep copy</a> to the variant using <a href="qpointarray.html#copy">QPointArray::copy</a>(), e.g. if you
intend changing the point array you've passed later on.

<h3 class=fn><a name="QVariant-k"></a>QVariant::QVariant ( const&nbsp;<a href="qregion.html">QRegion</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a region value, <em>val</em>.

<h3 class=fn><a name="QVariant-l"></a>QVariant::QVariant ( const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a bitmap value, <em>val</em>.

<h3 class=fn><a name="QVariant-m"></a>QVariant::QVariant ( const&nbsp;<a href="qcursor.html">QCursor</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a cursor value, <em>val</em>.

<h3 class=fn><a name="QVariant-n"></a>QVariant::QVariant ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a date value, <em>val</em>.

<h3 class=fn><a name="QVariant-o"></a>QVariant::QVariant ( const&nbsp;<a href="qtime.html">QTime</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a time value, <em>val</em>.

<h3 class=fn><a name="QVariant-p"></a>QVariant::QVariant ( const&nbsp;<a href="qdatetime.html">QDateTime</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a date/time value, <em>val</em>.

<h3 class=fn><a name="QVariant-q"></a>QVariant::QVariant ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a bytearray value, <em>val</em>.

<h3 class=fn><a name="QVariant-r"></a>QVariant::QVariant ( const&nbsp;<a href="qbitarray.html">QBitArray</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a bitarray value, <em>val</em>.

<h3 class=fn><a name="QVariant-s"></a>QVariant::QVariant ( const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a key sequence value, <em>val</em>.

<h3 class=fn><a name="QVariant-t"></a>QVariant::QVariant ( const&nbsp;<a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a list value, <em>val</em>.

<h3 class=fn><a name="QVariant-u"></a>QVariant::QVariant ( const&nbsp;<a href="qmap.html">QMap</a>&lt;QString,&nbsp;QVariant&gt;&nbsp;&amp;&nbsp;val )
</h3>
Constructs a new variant with a map of QVariants, <em>val</em>.

<h3 class=fn><a name="QVariant-v"></a>QVariant::QVariant ( int&nbsp;val )
</h3>
Constructs a new variant with an integer value, <em>val</em>.

<h3 class=fn><a name="QVariant-w"></a>QVariant::QVariant ( uint&nbsp;val )
</h3>
Constructs a new variant with an unsigned integer value, <em>val</em>.

<h3 class=fn><a name="QVariant-x"></a>QVariant::QVariant ( bool&nbsp;val, int )
</h3>
Constructs a new variant with a boolean value, <em>val</em>. The integer argument
is a dummy, necessary for compatibility with some compilers.

<h3 class=fn><a name="QVariant-y"></a>QVariant::QVariant ( double&nbsp;val )
</h3>
Constructs a new variant with a floating point value, <em>val</em>.

<h3 class=fn><a name="QVariant-z"></a>QVariant::QVariant ( <a href="qsizepolicy.html">QSizePolicy</a>&nbsp;val )
</h3>
Constructs a new variant with a size policy value, <em>val</em>.

<h3 class=fn><a name="~QVariant"></a>QVariant::~QVariant ()
</h3>
Destroys the QVariant and the contained object.
<p> Note that subclasses that reimplement <a href="#clear">clear</a>() should reimplement
the destructor to call clear().  This destructor calls clear(), but
because it is the destructor, <a href="#clear">QVariant::clear</a>() is called rather than
a subclass's clear().

<h3 class=fn><a href="qbitarray.html">QBitArray</a>&nbsp;&amp; <a name="asBitArray"></a>QVariant::asBitArray ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qbitarray.html">QBitArray</a> value. If that
is not possible then the variant is set to an empty bitarray.
<p> Returns a reference to the stored bitarray.
<p> <p>See also <a href="#toBitArray">toBitArray</a>().

<h3 class=fn><a href="qbitmap.html">QBitmap</a>&nbsp;&amp; <a name="asBitmap"></a>QVariant::asBitmap ()
</h3> 
<p> Tries to convert the variant to hold a bitmap value. If that
is not possible the variant is set to a null bitmap.
<p> Returns a reference to the stored bitmap.
<p> <p>See also <a href="#toBitmap">toBitmap</a>().

<h3 class=fn>bool &amp; <a name="asBool"></a>QVariant::asBool ()
</h3>
Returns the variant's value as bool reference.

<h3 class=fn><a href="qbrush.html">QBrush</a>&nbsp;&amp; <a name="asBrush"></a>QVariant::asBrush ()
</h3> 
<p> Tries to convert the variant to hold a brush value. If that
is not possible the variant is set to a default black brush.
<p> Returns a reference to the stored brush.
<p> <p>See also <a href="#toBrush">toBrush</a>().

<h3 class=fn><a href="qbytearray.html">QByteArray</a>&nbsp;&amp; <a name="asByteArray"></a>QVariant::asByteArray ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qbytearray.html">QByteArray</a> value. If that
is not possible then the variant is set to an empty bytearray.
<p> Returns a reference to the stored bytearray.
<p> <p>See also <a href="#toByteArray">toByteArray</a>().

<h3 class=fn><a href="qcstring.html">QCString</a>&nbsp;&amp; <a name="asCString"></a>QVariant::asCString ()
</h3> 
<p> Tries to convert the variant to hold a string value. If that
is not possible the variant is set to an empty string.
<p> Returns a reference to the stored string.
<p> <p>See also <a href="#toCString">toCString</a>().

<h3 class=fn><a href="qcolor.html">QColor</a>&nbsp;&amp; <a name="asColor"></a>QVariant::asColor ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qcolor.html">QColor</a> value. If that
is not possible the variant is set to an invalid color.
<p> Returns a reference to the stored color.
<p> <p>See also <a href="#toColor">toColor</a>() and <a href="qcolor.html#isValid">QColor::isValid</a>().

<h3 class=fn><a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp; <a name="asColorGroup"></a>QVariant::asColorGroup ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qcolorgroup.html">QColorGroup</a> value. If that
is not possible the variant is set to a color group with all colors
set to black.
<p> Returns a reference to the stored color group.
<p> <p>See also <a href="#toColorGroup">toColorGroup</a>().

<h3 class=fn><a href="qcursor.html">QCursor</a>&nbsp;&amp; <a name="asCursor"></a>QVariant::asCursor ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qcursor.html">QCursor</a> value. If that
is not possible the variant is set to a default arrow cursor.
<p> Returns a reference to the stored cursor.
<p> <p>See also <a href="#toCursor">toCursor</a>().

<h3 class=fn><a href="qdate.html">QDate</a>&nbsp;&amp; <a name="asDate"></a>QVariant::asDate ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qdate.html">QDate</a> value. If that
is not possible then the variant is set to an invalid date.
<p> Returns a reference to the stored date.
<p> <p>See also <a href="#toDate">toDate</a>().

<h3 class=fn><a href="qdatetime.html">QDateTime</a>&nbsp;&amp; <a name="asDateTime"></a>QVariant::asDateTime ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qdatetime.html">QDateTime</a> value. If that
is not possible then the variant is set to an invalid date/time.
<p> Returns a reference to the stored date/time.
<p> <p>See also <a href="#toDateTime">toDateTime</a>().

<h3 class=fn>double &amp; <a name="asDouble"></a>QVariant::asDouble ()
</h3>
Returns the variant's value as double reference.

<h3 class=fn><a href="qfont.html">QFont</a>&nbsp;&amp; <a name="asFont"></a>QVariant::asFont ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qfont.html">QFont</a>. If that
is not possible the variant is set to a default font.
<p> Returns a reference to the stored font.
<p> <p>See also <a href="#toFont">toFont</a>().

<h3 class=fn><a href="qiconset.html">QIconSet</a>&nbsp;&amp; <a name="asIconSet"></a>QVariant::asIconSet ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qiconset.html">QIconSet</a> value. If that
is not possible the variant is set to an empty iconset.
<p> Returns a reference to the stored iconset.
<p> <p>See also <a href="#toIconSet">toIconSet</a>().

<h3 class=fn><a href="qimage.html">QImage</a>&nbsp;&amp; <a name="asImage"></a>QVariant::asImage ()
</h3> 
<p> Tries to convert the variant to hold an image value. If that
is not possible the variant is set to a null image.
<p> Returns a reference to the stored image.
<p> <p>See also <a href="#toImage">toImage</a>().

<h3 class=fn>int &amp; <a name="asInt"></a>QVariant::asInt ()
</h3>
Returns the variant's value as int reference.

<h3 class=fn><a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp; <a name="asKeySequence"></a>QVariant::asKeySequence ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qkeysequence.html">QKeySequence</a> value. If that
is not possible then the variant is set to an empty key sequence.
<p> Returns a reference to the stored key sequence.
<p> <p>See also <a href="#toKeySequence">toKeySequence</a>().

<h3 class=fn><a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&nbsp;&amp; <a name="asList"></a>QVariant::asList ()
</h3>
Returns the variant's value as variant list reference.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt; list = myVariant.asList();
    QValueList&lt;QVariant&gt;::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 

<h3 class=fn><a href="qmap.html">QMap</a>&lt;QString,&nbsp;QVariant&gt;&nbsp;&amp; <a name="asMap"></a>QVariant::asMap ()
</h3>
Returns the variant's value as variant map reference.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qmap.html">QMap</a>&lt;QString, QVariant&gt; list = myVariant.asMap();
    QMap&lt;QString, QVariant&gt;::Iterator it = list.<a href="qmap.html#begin">begin</a>();
    while( it != list.<a href="qmap.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 

<h3 class=fn><a href="qpalette.html">QPalette</a>&nbsp;&amp; <a name="asPalette"></a>QVariant::asPalette ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qpalette.html">QPalette</a> value. If that
is not possible the variant is set to a palette with black colors only.
<p> Returns a reference to the stored palette.
<p> <p>See also <a href="#toString">toString</a>().

<h3 class=fn><a href="qpixmap.html">QPixmap</a>&nbsp;&amp; <a name="asPixmap"></a>QVariant::asPixmap ()
</h3> 
<p> Tries to convert the variant to hold a pixmap value. If that
is not possible the variant is set to a null pixmap.
<p> Returns a reference to the stored pixmap.
<p> <p>See also <a href="#toPixmap">toPixmap</a>().

<h3 class=fn><a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="asPoint"></a>QVariant::asPoint ()
</h3> 
<p> Tries to convert the variant to hold a point value. If that
is not possible the variant is set to a null point.
<p> Returns a reference to the stored point.
<p> <p>See also <a href="#toPoint">toPoint</a>().

<h3 class=fn><a href="qpointarray.html">QPointArray</a>&nbsp;&amp; <a name="asPointArray"></a>QVariant::asPointArray ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qpointarray.html">QPointArray</a> value. If that
is not possible the variant is set to an empty point array.
<p> Returns a reference to the stored point array.
<p> <p>See also <a href="#toPointArray">toPointArray</a>().

<h3 class=fn><a href="qrect.html">QRect</a>&nbsp;&amp; <a name="asRect"></a>QVariant::asRect ()
</h3> 
<p> Tries to convert the variant to hold a rectangle value. If that
is not possible the variant is set to an empty rectangle.
<p> Returns a reference to the stored rectangle.
<p> <p>See also <a href="#toRect">toRect</a>().

<h3 class=fn><a href="qregion.html">QRegion</a>&nbsp;&amp; <a name="asRegion"></a>QVariant::asRegion ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qregion.html">QRegion</a> value. If that
is not possible the variant is set to a null region.
<p> Returns a reference to the stored region.
<p> <p>See also <a href="#toRegion">toRegion</a>().

<h3 class=fn><a href="qsize.html">QSize</a>&nbsp;&amp; <a name="asSize"></a>QVariant::asSize ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qsize.html">QSize</a> value. If that
is not possible the variant is set to an invalid size.
<p> Returns a reference to the stored size.
<p> <p>See also <a href="#toSize">toSize</a>() and <a href="qsize.html#isValid">QSize::isValid</a>().

<h3 class=fn><a href="qsizepolicy.html">QSizePolicy</a>&nbsp;&amp; <a name="asSizePolicy"></a>QVariant::asSizePolicy ()
</h3>  
<p> Tries to convert the variant to hold a <a href="qsizepolicy.html">QSizePolicy</a> value.  If that
fails, the variant is set to an arbitrary size policy.

<h3 class=fn><a href="qstring.html">QString</a>&nbsp;&amp; <a name="asString"></a>QVariant::asString ()
</h3> 
<p> Tries to convert the variant to hold a string value. If that
is not possible the variant is set to an empty string.
<p> Returns a reference to the stored string.
<p> <p>See also <a href="#toString">toString</a>().

<h3 class=fn><a href="qstringlist.html">QStringList</a>&nbsp;&amp; <a name="asStringList"></a>QVariant::asStringList ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qstringlist.html">QStringList</a> value. If that
is not possible the variant is set to an empty string list.
<p> Returns a reference to the stored string list.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qstringlist.html">QStringList</a> list = myVariant.asStringList();
    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#toStringList">toStringList</a>().

<h3 class=fn><a href="qtime.html">QTime</a>&nbsp;&amp; <a name="asTime"></a>QVariant::asTime ()
</h3> 
<p> Tries to convert the variant to hold a <a href="qtime.html">QTime</a> value. If that
is not possible then the variant is set to an invalid time.
<p> Returns a reference to the stored time.
<p> <p>See also <a href="#toTime">toTime</a>().

<h3 class=fn>uint &amp; <a name="asUInt"></a>QVariant::asUInt ()
</h3>
Returns the variant's value as unsigned int reference.

<h3 class=fn>bool <a name="canCast"></a>QVariant::canCast ( <a href="qvariant.html#Type-enum">Type</a>&nbsp;t ) const
</h3>
Returns TRUE if the variant's type can be cast to the requested
type, <em>t</em>. Such casting is done automatically when calling the
<a href="#toInt">toInt</a>(), <a href="#toBool">toBool</a>(), ... or <a href="#asInt">asInt</a>(), <a href="#asBool">asBool</a>(), ... methods.
<p> The following casts are done automatically:
<ul>
<li> Bool => Double, Int, UInt
<li> CString => String
<li> Date => String
<li> DateTime => String, Date, Time
<li> Double => String, Int, Bool, UInt
<li> Int => String, Double, Bool, UInt
<li> List => StringList (if the list contains strings or something
that can be cast to a string)
<li> String => CString, Int, Uint, Double, Date, Time, DateTime
<li> StringList => List
<li> Time => String
<li> UInt => String, Double, Bool, Int
</ul>

<h3 class=fn>bool <a name="cast"></a>QVariant::cast ( <a href="qvariant.html#Type-enum">Type</a>&nbsp;t )
</h3>
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 <em>t</em> is
QVariant::String, an empty point array if the requested type <em>t</em> is
QVariant::PointArray, etc).  Returns TRUE if the current type of the
variant was successfully casted; otherwise returns FALSE.
<p> <p>See also <a href="#canCast">canCast</a>().

<h3 class=fn>void <a name="clear"></a>QVariant::clear ()
</h3> Convert this variant to type Invalid and free up any resources
used.

<h3 class=fn>bool <a name="isValid"></a>QVariant::isValid () const
</h3> 
<p> Returns TRUE if the storage type of this variant is not
QVariant::Invalid; otherwise returns FALSE.

<h3 class=fn><a href="qvaluelistconstiterator.html">QValueListConstIterator</a>&lt;QVariant&gt; <a name="listBegin"></a>QVariant::listBegin () const
</h3> 
<p> Returns an iterator to the first item in the list if the
variant's type is appropriate, or else a null iterator.

<h3 class=fn><a href="qvaluelistconstiterator.html">QValueListConstIterator</a>&lt;QVariant&gt; <a name="listEnd"></a>QVariant::listEnd () const
</h3> 
<p> Returns the end iterator for the list if the variant's type is
appropriate, or else a null iterator.

<h3 class=fn><a href="qmapconstiterator.html">QMapConstIterator</a>&lt;QString,&nbsp;QVariant&gt; <a name="mapBegin"></a>QVariant::mapBegin () const
</h3> 
<p> Returns an iterator to the first item in the map, if the
variant's type is appropriate, or else a null iterator.

<h3 class=fn><a href="qmapconstiterator.html">QMapConstIterator</a>&lt;QString,&nbsp;QVariant&gt; <a name="mapEnd"></a>QVariant::mapEnd () const
</h3> 
<p> Returns the end iterator for the map, if the variant's type is
appropriate, or else a null iterator.

<h3 class=fn><a href="qmapconstiterator.html">QMapConstIterator</a>&lt;QString,&nbsp;QVariant&gt; <a name="mapFind"></a>QVariant::mapFind ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;key ) const
</h3> 
<p> Returns an iterator to the item in the map with <em>key</em> as key, if the
variant's type is appropriate and <em>key</em> is a valid key, or else a
null iterator.

<h3 class=fn><a href="qvariant.html#Type-enum">Type</a> <a name="nameToType"></a>QVariant::nameToType ( const&nbsp;char&nbsp;*&nbsp;name )<tt> [static]</tt>
</h3>
Converts the string representation of the storage type gven in <em>name</em>, to its enum representation.
<p> If the string representation cannot be converted to any enum
representation, the variant is set to <a href="#Type-enum">Invalid</a>.

<h3 class=fn>bool <a name="operator!-eq"></a>QVariant::operator!= ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;v ) const
</h3>  Compares this QVariant with <em>v</em> and returns TRUE if they are
not equal; otherwise returns FALSE.

<h3 class=fn><a href="qvariant.html">QVariant</a>&nbsp;&amp; <a name="operator-eq"></a>QVariant::operator= ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;variant )
</h3>
Assigns the value of the variant <em>variant</em> to this variant.
<p> This is a <a href="shclass.html#deep-copy">deep copy</a> of the variant, but note that if the variant
holds an <a href="shclass.html#explicitly-shared">explicitly shared</a> type such as <a href="qimage.html">QImage</a>, a <a href="shclass.html#shallow-copy">shallow copy</a>
is performed.

<h3 class=fn>bool <a name="operator-eq-eq"></a>QVariant::operator== ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;v ) const
</h3>  Compares this QVariant with <em>v</em> and returns TRUE if they are
equal; otherwise returns FALSE.

<h3 class=fn><a href="qvaluelistconstiterator.html">QValueListConstIterator</a>&lt;QString&gt; <a name="stringListBegin"></a>QVariant::stringListBegin () const
</h3> 
<p> Returns an iterator to the first string in the list if the
variant's type is StringList, or else a null iterator.

<h3 class=fn><a href="qvaluelistconstiterator.html">QValueListConstIterator</a>&lt;QString&gt; <a name="stringListEnd"></a>QVariant::stringListEnd () const
</h3> 
<p> Returns the end iterator for the list if the variant's type is
StringList, or else a null iterator.

<h3 class=fn>const&nbsp;<a href="qbitarray.html">QBitArray</a> <a name="toBitArray"></a>QVariant::toBitArray () const
</h3>
Returns the variant as a <a href="qbitarray.html">QBitArray</a> if the variant has <a href="#type">type</a>()
BitArray, or an empty bitarray otherwise.
<p> <p>See also <a href="#asBitArray">asBitArray</a>().

<h3 class=fn>const&nbsp;<a href="qbitmap.html">QBitmap</a> <a name="toBitmap"></a>QVariant::toBitmap () const
</h3>
Returns the variant as a <a href="qbitmap.html">QBitmap</a> if the variant has <a href="#type">type</a>()
Bitmap, or a null QBitmap otherwise.
<p> <p>See also <a href="#asBitmap">asBitmap</a>().

<h3 class=fn>bool <a name="toBool"></a>QVariant::toBool () const
</h3>  Returns the variant as a bool if the variant has <a href="#type">type</a>() Bool.
<p> Returns TRUE if the variant has type Int, UInt or Double and its value
is non-zero; otherwise returns FALSE.
<p> <p>See also <a href="#asBool">asBool</a>().

<h3 class=fn>const&nbsp;<a href="qbrush.html">QBrush</a> <a name="toBrush"></a>QVariant::toBrush () const
</h3>
Returns the variant as a <a href="qbrush.html">QBrush</a> if the variant has <a href="#type">type</a>()
Brush, or a default brush (with all black colors) otherwise.
<p> <p>See also <a href="#asBrush">asBrush</a>().

<h3 class=fn>const&nbsp;<a href="qbytearray.html">QByteArray</a> <a name="toByteArray"></a>QVariant::toByteArray () const
</h3>
Returns the variant as a <a href="qbytearray.html">QByteArray</a> if the variant has <a href="#type">type</a>()
ByteArray, or an empty bytearray otherwise.
<p> <p>See also <a href="#asByteArray">asByteArray</a>().

<h3 class=fn>const&nbsp;<a href="qcstring.html">QCString</a> <a name="toCString"></a>QVariant::toCString () const
</h3>
Returns the variant as a <a href="qcstring.html">QCString</a> if the variant has <a href="#type">type</a>()
CString or String, or a 0 otherwise.
<p> <p>See also <a href="#asCString">asCString</a>().

<h3 class=fn>const&nbsp;<a href="qcolor.html">QColor</a> <a name="toColor"></a>QVariant::toColor () const
</h3>
Returns the variant as a <a href="qcolor.html">QColor</a> if the variant has <a href="#type">type</a>()
Color, or an invalid color otherwise.
<p> <p>See also <a href="#asColor">asColor</a>().

<h3 class=fn>const&nbsp;<a href="qcolorgroup.html">QColorGroup</a> <a name="toColorGroup"></a>QVariant::toColorGroup () const
</h3>
Returns the variant as a <a href="qcolorgroup.html">QColorGroup</a> if the variant has <a href="#type">type</a>()
ColorGroup, or a completely black color group otherwise.
<p> <p>See also <a href="#asColorGroup">asColorGroup</a>().

<h3 class=fn>const&nbsp;<a href="qcursor.html">QCursor</a> <a name="toCursor"></a>QVariant::toCursor () const
</h3>
Returns the variant as a <a href="qcursor.html">QCursor</a> if the variant has <a href="#type">type</a>()
Cursor, or the default arrow cursor otherwise.
<p> <p>See also <a href="#asCursor">asCursor</a>().

<h3 class=fn>const&nbsp;<a href="qdate.html">QDate</a> <a name="toDate"></a>QVariant::toDate () const
</h3>
Returns the variant as a <a href="qdate.html">QDate</a> if the variant has <a href="#type">type</a>()
Date, DateTime or String, or an invalid date otherwise.
<p> Note that if the type() is String an invalid date will be returned
if the string cannot be parsed as an Qt::ISODate format date.
<p> <p>See also <a href="#asDate">asDate</a>().

<h3 class=fn>const&nbsp;<a href="qdatetime.html">QDateTime</a> <a name="toDateTime"></a>QVariant::toDateTime () const
</h3>
Returns the variant as a <a href="qdatetime.html">QDateTime</a> if the variant has <a href="#type">type</a>()
DateTime or String, or an invalid date/time otherwise.
<p> Note that if the type() is String an invalid date/time will be
returned if the string cannot be parsed as an Qt::ISODate format
date/time.
<p> <p>See also <a href="#asDateTime">asDateTime</a>().

<h3 class=fn>double <a name="toDouble"></a>QVariant::toDouble ( bool&nbsp;*&nbsp;ok = 0 ) const
</h3>
Returns the variant as a double if the variant has <a href="#type">type</a>()
String, CString, Double, Int, UInt, or Bool; or 0.0 otherwise.
<p> If <em>ok</em> is non-null, <em>*ok</em> is set to TRUE if the value could be
converted to a double and FALSE otherwise.
<p> <p>See also <a href="#asDouble">asDouble</a>().

<h3 class=fn>const&nbsp;<a href="qfont.html">QFont</a> <a name="toFont"></a>QVariant::toFont () const
</h3>
Returns the variant as a <a href="qfont.html">QFont</a> if the variant has <a href="#type">type</a>()
Font, or the default font otherwise.
<p> <p>See also <a href="#asFont">asFont</a>().

<h3 class=fn>const&nbsp;<a href="qiconset.html">QIconSet</a> <a name="toIconSet"></a>QVariant::toIconSet () const
</h3>
Returns the variant as a <a href="qiconset.html">QIconSet</a> if the variant has <a href="#type">type</a>()
IconSet, or an icon set of null pixmaps otherwise.
<p> <p>See also <a href="#asIconSet">asIconSet</a>().

<h3 class=fn>const&nbsp;<a href="qimage.html">QImage</a> <a name="toImage"></a>QVariant::toImage () const
</h3>
Returns the variant as a <a href="qimage.html">QImage</a> if the variant has <a href="#type">type</a>()
Image, or a null image otherwise.
<p> <p>See also <a href="#asImage">asImage</a>().

<h3 class=fn>int <a name="toInt"></a>QVariant::toInt ( bool&nbsp;*&nbsp;ok = 0 ) const
</h3>
Returns the variant as an int if the variant has <a href="#type">type</a>()
String, CString, Int, UInt, Double, Bool or KeySequence; or 0 otherwise.
<p> If <em>ok</em> is non-null, <em>*ok</em> is set to TRUE if the value could be
converted to an int and FALSE otherwise.
<p> <p>See also <a href="#asInt">asInt</a>() and <a href="#canCast">canCast</a>().

<h3 class=fn>const&nbsp;<a href="qkeysequence.html">QKeySequence</a> <a name="toKeySequence"></a>QVariant::toKeySequence () const
</h3>
Returns the variant as a <a href="qkeysequence.html">QKeySequence</a> if the variant has <a href="#type">type</a>()
KeySequence, Int or String, or an empty key sequence otherwise.
<p> Note that not all Ints and Strings are valid key sequences and in
such cases an empty key sequence will be returned.
<p> <p>See also <a href="#asKeySequence">asKeySequence</a>().

<h3 class=fn>const&nbsp;<a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt; <a name="toList"></a>QVariant::toList () const
</h3>
Returns the variant as a <a href="qvaluelist.html">QValueList</a><QVariant> if the variant has <a href="#type">type</a>()
List or StringList, or an empty list otherwise.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt; list = myVariant.toList();
    QValueList&lt;QVariant&gt;::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#asList">asList</a>().

<h3 class=fn>const&nbsp;<a href="qmap.html">QMap</a>&lt;QString,&nbsp;QVariant&gt; <a name="toMap"></a>QVariant::toMap () const
</h3>
Returns the variant as a <a href="qmap.html">QMap</a><QString,QVariant> if the variant has <a href="#type">type</a>()
Map, or an empty map otherwise.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qmap.html">QMap</a>&lt;QString, QVariant&gt; list = myVariant.toMap();
    QMap&lt;QString, QVariant&gt;::Iterator it = list.<a href="qmap.html#begin">begin</a>();
    while( it != list.<a href="qmap.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#asMap">asMap</a>().

<h3 class=fn>const&nbsp;<a href="qpalette.html">QPalette</a> <a name="toPalette"></a>QVariant::toPalette () const
</h3>
Returns the variant as a <a href="qpalette.html">QPalette</a> if the variant has <a href="#type">type</a>()
Palette, or a completely black palette otherwise.
<p> <p>See also <a href="#asPalette">asPalette</a>().

<h3 class=fn>const&nbsp;<a href="qpixmap.html">QPixmap</a> <a name="toPixmap"></a>QVariant::toPixmap () const
</h3>
Returns the variant as a <a href="qpixmap.html">QPixmap</a> if the variant has <a href="#type">type</a>()
Pixmap, or a null pixmap otherwise.
<p> <p>See also <a href="#asPixmap">asPixmap</a>().

<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a> <a name="toPoint"></a>QVariant::toPoint () const
</h3>
Returns the variant as a <a href="qpoint.html">QPoint</a> if the variant has <a href="#type">type</a>()
Point, or a point (0, 0) otherwise.
<p> <p>See also <a href="#asPoint">asPoint</a>().

<h3 class=fn>const&nbsp;<a href="qpointarray.html">QPointArray</a> <a name="toPointArray"></a>QVariant::toPointArray () const
</h3>
Returns the variant as a <a href="qpointarray.html">QPointArray</a> if the variant has <a href="#type">type</a>()
PointArray, or an empty QPointArray otherwise.
<p> <p>See also <a href="#asPointArray">asPointArray</a>().

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a> <a name="toRect"></a>QVariant::toRect () const
</h3>
Returns the variant as a <a href="qrect.html">QRect</a> if the variant has <a href="#type">type</a>()
Rect, or an empty rectangle otherwise.
<p> <p>See also <a href="#asRect">asRect</a>().

<h3 class=fn>const&nbsp;<a href="qregion.html">QRegion</a> <a name="toRegion"></a>QVariant::toRegion () const
</h3>
Returns the variant as a <a href="qregion.html">QRegion</a> if the variant has <a href="#type">type</a>()
Region, or an empty QRegion otherwise.
<p> <p>See also <a href="#asRegion">asRegion</a>().

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="toSize"></a>QVariant::toSize () const
</h3>
Returns the variant as a <a href="qsize.html">QSize</a> if the variant has <a href="#type">type</a>()
Size, or an invalid size otherwise.
<p> <p>See also <a href="#asSize">asSize</a>().

<h3 class=fn><a href="qsizepolicy.html">QSizePolicy</a> <a name="toSizePolicy"></a>QVariant::toSizePolicy () const
</h3> Returns the variant as a <a href="qsizepolicy.html">QSizePolicy</a> if the variant has <a href="#type">type</a>()
SizePolicy, or an undefined (but legal) size policy otherwise.

<h3 class=fn>const&nbsp;<a href="qstring.html">QString</a> <a name="toString"></a>QVariant::toString () const
</h3>
Returns the variant as a <a href="qstring.html">QString</a> if the variant has <a href="#type">type</a>()
String, CString, ByteArray, Int, Uint, Bool, Double, Date, Time, or DateTime,
or <a href="qstring.html#QString-null">QString::null</a> otherwise.
<p> <p>See also <a href="#asString">asString</a>().

<h3 class=fn>const&nbsp;<a href="qstringlist.html">QStringList</a> <a name="toStringList"></a>QVariant::toStringList () const
</h3>
Returns the variant as a <a href="qstringlist.html">QStringList</a> if the variant has <a href="#type">type</a>()
StringList or List of a type that can be converted to <a href="qstring.html">QString</a>, or an
empty list otherwise.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qstringlist.html">QStringList</a> list = myVariant.toStringList();
    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#asStringList">asStringList</a>().

<h3 class=fn>const&nbsp;<a href="qtime.html">QTime</a> <a name="toTime"></a>QVariant::toTime () const
</h3>
Returns the variant as a <a href="qtime.html">QTime</a> if the variant has <a href="#type">type</a>()
Time, DateTime or String, or an invalid time otherwise.
<p> Note that if the type() is String an invalid time will be returned
if the string cannot be parsed as an Qt::ISODate format time.
<p> <p>See also <a href="#asTime">asTime</a>().

<h3 class=fn>uint <a name="toUInt"></a>QVariant::toUInt ( bool&nbsp;*&nbsp;ok = 0 ) const
</h3>
Returns the variant as an unsigned int if the variant has <a href="#type">type</a>()
String, CString, UInt, Int, Double, or Bool; or 0 otherwise.
<p> If <em>ok</em> is non-null, <em>*ok</em> is set to TRUE if the value could be
converted to a uint and FALSE otherwise.
<p> <p>See also <a href="#asUInt">asUInt</a>().

<h3 class=fn><a href="qvariant.html#Type-enum">Type</a> <a name="type"></a>QVariant::type () const
</h3> 
<p> Returns the storage type of the value stored in the variant. Usually
it's best to test with <a href="#canCast">canCast</a>() whether the variant can deliver the
data type you are interested in.

<h3 class=fn>const char * <a name="typeName"></a>QVariant::typeName () const
</h3>
Returns the name of the type stored in the variant.
The returned strings describe the C++ datatype used to store the
data: for example, "QFont", "QString", or "QValueList<QVariant>".
An Invalid variant returns 0.

<h3 class=fn>const char * <a name="typeToName"></a>QVariant::typeToName ( <a href="qvariant.html#Type-enum">Type</a>&nbsp;typ )<tt> [static]</tt>
</h3>
Converts the enum representation of the storage type, <em>typ</em>, to its
string representation.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>