You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1150 lines
63 KiB
1150 lines
63 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/tqvariant.cpp:353 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQVariant Class</title>
|
|
<style type="text/css"><!--
|
|
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 Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped 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>TQVariant Class Reference</h1>
|
|
|
|
<p>The TQVariant class acts like a union for the most common TQt data types.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="tqvariant-h.html">tqvariant.h</a>></tt>
|
|
<p><a href="tqvariant-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li 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, Pen, LongLong, ULongLong }</li>
|
|
<li class=fn><a href="#TQVariant"><b>TQVariant</b></a> ()</li>
|
|
<li class=fn><a href="#~TQVariant"><b>~TQVariant</b></a> ()</li>
|
|
<li class=fn><a href="#TQVariant-2"><b>TQVariant</b></a> ( const TQVariant & p )</li>
|
|
<li class=fn><a href="#TQVariant-3"><b>TQVariant</b></a> ( TQDataStream & s )</li>
|
|
<li class=fn><a href="#TQVariant-4"><b>TQVariant</b></a> ( const TQString & val )</li>
|
|
<li class=fn><a href="#TQVariant-5"><b>TQVariant</b></a> ( const TQCString & val )</li>
|
|
<li class=fn><a href="#TQVariant-6"><b>TQVariant</b></a> ( const char * val )</li>
|
|
<li class=fn><a href="#TQVariant-7"><b>TQVariant</b></a> ( const TQStringList & val )</li>
|
|
<li class=fn><a href="#TQVariant-8"><b>TQVariant</b></a> ( const TQFont & val )</li>
|
|
<li class=fn><a href="#TQVariant-9"><b>TQVariant</b></a> ( const TQPixmap & val )</li>
|
|
<li class=fn><a href="#TQVariant-a"><b>TQVariant</b></a> ( const TQImage & val )</li>
|
|
<li class=fn><a href="#TQVariant-b"><b>TQVariant</b></a> ( const TQBrush & val )</li>
|
|
<li class=fn><a href="#TQVariant-c"><b>TQVariant</b></a> ( const TQPoint & val )</li>
|
|
<li class=fn><a href="#TQVariant-d"><b>TQVariant</b></a> ( const TQRect & val )</li>
|
|
<li class=fn><a href="#TQVariant-e"><b>TQVariant</b></a> ( const TQSize & val )</li>
|
|
<li class=fn><a href="#TQVariant-f"><b>TQVariant</b></a> ( const TQColor & val )</li>
|
|
<li class=fn><a href="#TQVariant-g"><b>TQVariant</b></a> ( const TQPalette & val )</li>
|
|
<li class=fn><a href="#TQVariant-h"><b>TQVariant</b></a> ( const TQColorGroup & val )</li>
|
|
<li class=fn><a href="#TQVariant-i"><b>TQVariant</b></a> ( const TQIconSet & val )</li>
|
|
<li class=fn><a href="#TQVariant-j"><b>TQVariant</b></a> ( const TQPointArray & val )</li>
|
|
<li class=fn><a href="#TQVariant-k"><b>TQVariant</b></a> ( const TQRegion & val )</li>
|
|
<li class=fn><a href="#TQVariant-l"><b>TQVariant</b></a> ( const TQBitmap & val )</li>
|
|
<li class=fn><a href="#TQVariant-m"><b>TQVariant</b></a> ( const TQCursor & val )</li>
|
|
<li class=fn><a href="#TQVariant-n"><b>TQVariant</b></a> ( const TQDate & val )</li>
|
|
<li class=fn><a href="#TQVariant-o"><b>TQVariant</b></a> ( const TQTime & val )</li>
|
|
<li class=fn><a href="#TQVariant-p"><b>TQVariant</b></a> ( const TQDateTime & val )</li>
|
|
<li class=fn><a href="#TQVariant-q"><b>TQVariant</b></a> ( const TQByteArray & val )</li>
|
|
<li class=fn><a href="#TQVariant-r"><b>TQVariant</b></a> ( const TQBitArray & val )</li>
|
|
<li class=fn><a href="#TQVariant-s"><b>TQVariant</b></a> ( const TQKeySequence & val )</li>
|
|
<li class=fn><a href="#TQVariant-t"><b>TQVariant</b></a> ( const TQPen & val )</li>
|
|
<li class=fn><a href="#TQVariant-u"><b>TQVariant</b></a> ( const TQValueList<TQVariant> & val )</li>
|
|
<li class=fn><a href="#TQVariant-v"><b>TQVariant</b></a> ( const TQMap<TQString, TQVariant> & val )</li>
|
|
<li class=fn><a href="#TQVariant-w"><b>TQVariant</b></a> ( int val )</li>
|
|
<li class=fn><a href="#TQVariant-x"><b>TQVariant</b></a> ( uint val )</li>
|
|
<li class=fn><a href="#TQVariant-y"><b>TQVariant</b></a> ( TQ_LLONG val )</li>
|
|
<li class=fn><a href="#TQVariant-z"><b>TQVariant</b></a> ( TQ_ULLONG val )</li>
|
|
<li class=fn><a href="#TQVariant-10"><b>TQVariant</b></a> ( bool val, int )</li>
|
|
<li class=fn><a href="#TQVariant-11"><b>TQVariant</b></a> ( double val )</li>
|
|
<li class=fn><a href="#TQVariant-12"><b>TQVariant</b></a> ( TQSizePolicy val )</li>
|
|
<li class=fn>TQVariant & <a href="#operator-eq"><b>operator=</b></a> ( const TQVariant & variant )</li>
|
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQVariant & v ) const</li>
|
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQVariant & v ) const</li>
|
|
<li class=fn>Type <a href="#type"><b>type</b></a> () const</li>
|
|
<li class=fn>const char * <a href="#typeName"><b>typeName</b></a> () const</li>
|
|
<li class=fn>bool <a href="#canCast"><b>canCast</b></a> ( Type t ) const</li>
|
|
<li class=fn>bool <a href="#cast"><b>cast</b></a> ( Type t )</li>
|
|
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
|
<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
|
|
<li class=fn>const TQString <a href="#toString"><b>toString</b></a> () const</li>
|
|
<li class=fn>const TQCString <a href="#toCString"><b>toCString</b></a> () const</li>
|
|
<li class=fn>const TQStringList <a href="#toStringList"><b>toStringList</b></a> () const</li>
|
|
<li class=fn>const TQFont <a href="#toFont"><b>toFont</b></a> () const</li>
|
|
<li class=fn>const TQPixmap <a href="#toPixmap"><b>toPixmap</b></a> () const</li>
|
|
<li class=fn>const TQImage <a href="#toImage"><b>toImage</b></a> () const</li>
|
|
<li class=fn>const TQBrush <a href="#toBrush"><b>toBrush</b></a> () const</li>
|
|
<li class=fn>const TQPoint <a href="#toPoint"><b>toPoint</b></a> () const</li>
|
|
<li class=fn>const TQRect <a href="#toRect"><b>toRect</b></a> () const</li>
|
|
<li class=fn>const TQSize <a href="#toSize"><b>toSize</b></a> () const</li>
|
|
<li class=fn>const TQColor <a href="#toColor"><b>toColor</b></a> () const</li>
|
|
<li class=fn>const TQPalette <a href="#toPalette"><b>toPalette</b></a> () const</li>
|
|
<li class=fn>const TQColorGroup <a href="#toColorGroup"><b>toColorGroup</b></a> () const</li>
|
|
<li class=fn>const TQIconSet <a href="#toIconSet"><b>toIconSet</b></a> () const</li>
|
|
<li class=fn>const TQPointArray <a href="#toPointArray"><b>toPointArray</b></a> () const</li>
|
|
<li class=fn>const TQBitmap <a href="#toBitmap"><b>toBitmap</b></a> () const</li>
|
|
<li class=fn>const TQRegion <a href="#toRegion"><b>toRegion</b></a> () const</li>
|
|
<li class=fn>const TQCursor <a href="#toCursor"><b>toCursor</b></a> () const</li>
|
|
<li class=fn>const TQDate <a href="#toDate"><b>toDate</b></a> () const</li>
|
|
<li class=fn>const TQTime <a href="#toTime"><b>toTime</b></a> () const</li>
|
|
<li class=fn>const TQDateTime <a href="#toDateTime"><b>toDateTime</b></a> () const</li>
|
|
<li class=fn>const TQByteArray <a href="#toByteArray"><b>toByteArray</b></a> () const</li>
|
|
<li class=fn>const TQBitArray <a href="#toBitArray"><b>toBitArray</b></a> () const</li>
|
|
<li class=fn>const TQKeySequence <a href="#toKeySequence"><b>toKeySequence</b></a> () const</li>
|
|
<li class=fn>const TQPen <a href="#toPen"><b>toPen</b></a> () const</li>
|
|
<li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool * ok = 0 ) const</li>
|
|
<li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool * ok = 0 ) const</li>
|
|
<li class=fn>TQ_LLONG <a href="#toLongLong"><b>toLongLong</b></a> ( bool * ok = 0 ) const</li>
|
|
<li class=fn>TQ_ULLONG <a href="#toULongLong"><b>toULongLong</b></a> ( bool * ok = 0 ) const</li>
|
|
<li class=fn>bool <a href="#toBool"><b>toBool</b></a> () const</li>
|
|
<li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool * ok = 0 ) const</li>
|
|
<li class=fn>const TQValueList<TQVariant> <a href="#toList"><b>toList</b></a> () const</li>
|
|
<li class=fn>const TQMap<TQString, TQVariant> <a href="#toMap"><b>toMap</b></a> () const</li>
|
|
<li class=fn>TQSizePolicy <a href="#toSizePolicy"><b>toSizePolicy</b></a> () const</li>
|
|
<li class=fn>TQValueListConstIterator<TQString> stringListBegin () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQValueListConstIterator<TQString> stringListEnd () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQValueListConstIterator<TQVariant> listBegin () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQValueListConstIterator<TQVariant> listEnd () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQMapConstIterator<TQString, TQVariant> mapBegin () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQMapConstIterator<TQString, TQVariant> mapEnd () const <em>(obsolete)</em></li>
|
|
<li class=fn>TQMapConstIterator<TQString, TQVariant> mapFind ( const TQString & key ) const <em>(obsolete)</em></li>
|
|
<li class=fn>TQString & <a href="#asString"><b>asString</b></a> ()</li>
|
|
<li class=fn>TQCString & <a href="#asCString"><b>asCString</b></a> ()</li>
|
|
<li class=fn>TQStringList & <a href="#asStringList"><b>asStringList</b></a> ()</li>
|
|
<li class=fn>TQFont & <a href="#asFont"><b>asFont</b></a> ()</li>
|
|
<li class=fn>TQPixmap & <a href="#asPixmap"><b>asPixmap</b></a> ()</li>
|
|
<li class=fn>TQImage & <a href="#asImage"><b>asImage</b></a> ()</li>
|
|
<li class=fn>TQBrush & <a href="#asBrush"><b>asBrush</b></a> ()</li>
|
|
<li class=fn>TQPoint & <a href="#asPoint"><b>asPoint</b></a> ()</li>
|
|
<li class=fn>TQRect & <a href="#asRect"><b>asRect</b></a> ()</li>
|
|
<li class=fn>TQSize & <a href="#asSize"><b>asSize</b></a> ()</li>
|
|
<li class=fn>TQColor & <a href="#asColor"><b>asColor</b></a> ()</li>
|
|
<li class=fn>TQPalette & <a href="#asPalette"><b>asPalette</b></a> ()</li>
|
|
<li class=fn>TQColorGroup & <a href="#asColorGroup"><b>asColorGroup</b></a> ()</li>
|
|
<li class=fn>TQIconSet & <a href="#asIconSet"><b>asIconSet</b></a> ()</li>
|
|
<li class=fn>TQPointArray & <a href="#asPointArray"><b>asPointArray</b></a> ()</li>
|
|
<li class=fn>TQBitmap & <a href="#asBitmap"><b>asBitmap</b></a> ()</li>
|
|
<li class=fn>TQRegion & <a href="#asRegion"><b>asRegion</b></a> ()</li>
|
|
<li class=fn>TQCursor & <a href="#asCursor"><b>asCursor</b></a> ()</li>
|
|
<li class=fn>TQDate & <a href="#asDate"><b>asDate</b></a> ()</li>
|
|
<li class=fn>TQTime & <a href="#asTime"><b>asTime</b></a> ()</li>
|
|
<li class=fn>TQDateTime & <a href="#asDateTime"><b>asDateTime</b></a> ()</li>
|
|
<li class=fn>TQByteArray & <a href="#asByteArray"><b>asByteArray</b></a> ()</li>
|
|
<li class=fn>TQBitArray & <a href="#asBitArray"><b>asBitArray</b></a> ()</li>
|
|
<li class=fn>TQKeySequence & <a href="#asKeySequence"><b>asKeySequence</b></a> ()</li>
|
|
<li class=fn>TQPen & <a href="#asPen"><b>asPen</b></a> ()</li>
|
|
<li class=fn>int & <a href="#asInt"><b>asInt</b></a> ()</li>
|
|
<li class=fn>uint & <a href="#asUInt"><b>asUInt</b></a> ()</li>
|
|
<li class=fn>TQ_LLONG & <a href="#asLongLong"><b>asLongLong</b></a> ()</li>
|
|
<li class=fn>TQ_ULLONG & <a href="#asULongLong"><b>asULongLong</b></a> ()</li>
|
|
<li class=fn>bool & <a href="#asBool"><b>asBool</b></a> ()</li>
|
|
<li class=fn>double & <a href="#asDouble"><b>asDouble</b></a> ()</li>
|
|
<li class=fn>TQValueList<TQVariant> & <a href="#asList"><b>asList</b></a> ()</li>
|
|
<li class=fn>TQMap<TQString, TQVariant> & <a href="#asMap"><b>asMap</b></a> ()</li>
|
|
<li class=fn>TQSizePolicy & <a href="#asSizePolicy"><b>asSizePolicy</b></a> ()</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>const char * <a href="#typeToName"><b>typeToName</b></a> ( Type typ )</li>
|
|
<li class=fn>Type <a href="#nameToType"><b>nameToType</b></a> ( const char * name )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQVariant class acts like a union for the most common TQt data types.
|
|
<p>
|
|
|
|
|
|
<p> Because C++ forbids unions from including types that have
|
|
non-default constructors or destructors, most interesting TQt
|
|
classes cannot be used in unions. Without TQVariant, this would be
|
|
a problem for <a href="tqobject.html#property">TQObject::property</a>() and for database work, etc.
|
|
<p> A TQVariant object holds a single value of a single <a href="#type">type</a>() at a
|
|
time. (Some type()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 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 <a href="#Type-enum">Type</a>
|
|
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 TQVariant are <a href="shclass.html#explicitly-shared">explicitly shared</a>, namely <a href="tqimage.html">TQImage</a>, <a href="tqpointarray.html">TQPointArray</a>, and <a href="tqcstring.html">TQCString</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 some example code to demonstrate the use of TQVariant:
|
|
<p> <pre>
|
|
<a href="tqdatastream.html">TQDataStream</a> out(...);
|
|
TQVariant v(123); // The variant now contains an int
|
|
int x = v.<a href="#toInt">toInt</a>(); // x = 123
|
|
out << v; // Writes a type tag and an int to out
|
|
v = <a href="#TQVariant">TQVariant</a>("hello"); // The variant now contains a TQCString
|
|
v = <a href="#TQVariant">TQVariant</a>(tr("hello"));// The variant now contains a TQString
|
|
int y = v.<a href="#toInt">toInt</a>(); // y = 0 since v cannot be converted to an int
|
|
<a href="tqstring.html">TQString</a> s = v.<a href="#toString">toString</a>(); // s = tr("hello") (see TQObject::tr())
|
|
out << v; // Writes a type tag and a TQString to out
|
|
...
|
|
<a href="tqdatastream.html">TQDataStream</a> in(...); // (opening the previously written stream)
|
|
in >> v; // Reads an Int variant
|
|
int z = v.<a href="#toInt">toInt</a>(); // z = 123
|
|
<a href="ntqapplication.html#qDebug">tqDebug</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="#TQVariant">TQVariant</a>( TQStringList() );
|
|
v.<a href="#asStringList">asStringList</a>().append( "Hello" );
|
|
</pre>
|
|
|
|
<p> You can even store <a href="tqvaluelist.html">TQValueList</a><TQVariant>s and
|
|
<a href="tqmap.html">TQMap</a><TQString,TQVariant>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.
|
|
<p> TQVariant also supports the notion of NULL values, where you have a
|
|
defined type with no value set.
|
|
<pre>
|
|
TQVariant x, y( TQString() ), z( TQString("") );
|
|
x.<a href="#asInt">asInt</a>();
|
|
// x.<a href="#isNull">isNull</a>() == TRUE, y.isNull() == TRUE, z.isNull() == FALSE
|
|
</pre>
|
|
|
|
<p> 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>TQVariant::Type</h3>
|
|
|
|
<p> This enum type defines the types of variable that a TQVariant can
|
|
contain.
|
|
<ul>
|
|
<li><tt>TQVariant::Invalid</tt> - no type
|
|
<li><tt>TQVariant::BitArray</tt> - a <a href="tqbitarray.html">TQBitArray</a>
|
|
<li><tt>TQVariant::ByteArray</tt> - a <a href="tqbytearray.html">TQByteArray</a>
|
|
<li><tt>TQVariant::Bitmap</tt> - a <a href="tqbitmap.html">TQBitmap</a>
|
|
<li><tt>TQVariant::Bool</tt> - a bool
|
|
<li><tt>TQVariant::Brush</tt> - a <a href="tqbrush.html">TQBrush</a>
|
|
<li><tt>TQVariant::Color</tt> - a <a href="tqcolor.html">TQColor</a>
|
|
<li><tt>TQVariant::ColorGroup</tt> - a <a href="tqcolorgroup.html">TQColorGroup</a>
|
|
<li><tt>TQVariant::Cursor</tt> - a <a href="tqcursor.html">TQCursor</a>
|
|
<li><tt>TQVariant::Date</tt> - a <a href="tqdate.html">TQDate</a>
|
|
<li><tt>TQVariant::DateTime</tt> - a <a href="tqdatetime.html">TQDateTime</a>
|
|
<li><tt>TQVariant::Double</tt> - a double
|
|
<li><tt>TQVariant::Font</tt> - a <a href="tqfont.html">TQFont</a>
|
|
<li><tt>TQVariant::IconSet</tt> - a <a href="tqiconset.html">TQIconSet</a>
|
|
<li><tt>TQVariant::Image</tt> - a <a href="tqimage.html">TQImage</a>
|
|
<li><tt>TQVariant::Int</tt> - an int
|
|
<li><tt>TQVariant::KeySequence</tt> - a <a href="tqkeysequence.html">TQKeySequence</a>
|
|
<li><tt>TQVariant::List</tt> - a <a href="tqvaluelist.html">TQValueList</a><TQVariant>
|
|
<li><tt>TQVariant::LongLong</tt> - a long long
|
|
<li><tt>TQVariant::ULongLong</tt> - an unsigned long long
|
|
<li><tt>TQVariant::Map</tt> - a <a href="tqmap.html">TQMap</a><TQString,TQVariant>
|
|
<li><tt>TQVariant::Palette</tt> - a <a href="tqpalette.html">TQPalette</a>
|
|
<li><tt>TQVariant::Pen</tt> - a <a href="tqpen.html">TQPen</a>
|
|
<li><tt>TQVariant::Pixmap</tt> - a <a href="tqpixmap.html">TQPixmap</a>
|
|
<li><tt>TQVariant::Point</tt> - a <a href="tqpoint.html">TQPoint</a>
|
|
<li><tt>TQVariant::PointArray</tt> - a <a href="tqpointarray.html">TQPointArray</a>
|
|
<li><tt>TQVariant::Rect</tt> - a <a href="tqrect.html">TQRect</a>
|
|
<li><tt>TQVariant::Region</tt> - a <a href="tqregion.html">TQRegion</a>
|
|
<li><tt>TQVariant::Size</tt> - a <a href="tqsize.html">TQSize</a>
|
|
<li><tt>TQVariant::SizePolicy</tt> - a <a href="tqsizepolicy.html">TQSizePolicy</a>
|
|
<li><tt>TQVariant::String</tt> - a <a href="tqstring.html">TQString</a>
|
|
<li><tt>TQVariant::CString</tt> - a <a href="tqcstring.html">TQCString</a>
|
|
<li><tt>TQVariant::StringList</tt> - a <a href="tqstringlist.html">TQStringList</a>
|
|
<li><tt>TQVariant::Time</tt> - a <a href="tqtime.html">TQTime</a>
|
|
<li><tt>TQVariant::UInt</tt> - an unsigned int
|
|
</ul><p> Note that TQt's definition of bool depends on the compiler.
|
|
<a href="tqglobal-h.html">tqglobal.h</a> has the system-dependent definition of bool.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQVariant"></a>TQVariant::TQVariant ()
|
|
</h3>
|
|
Constructs an invalid variant.
|
|
|
|
<h3 class=fn><a name="TQVariant-10"></a>TQVariant::TQVariant ( bool 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="TQVariant-11"></a>TQVariant::TQVariant ( double val )
|
|
</h3>
|
|
Constructs a new variant with a floating point value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-12"></a>TQVariant::TQVariant ( <a href="tqsizepolicy.html">TQSizePolicy</a> val )
|
|
</h3>
|
|
Constructs a new variant with a size policy value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-2"></a>TQVariant::TQVariant ( const <a href="tqvariant.html">TQVariant</a> & 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="tqimage.html">TQImage</a> is.
|
|
|
|
<h3 class=fn><a name="TQVariant-3"></a>TQVariant::TQVariant ( <a href="tqdatastream.html">TQDataStream</a> & s )
|
|
</h3>
|
|
Reads the variant from the data stream, <em>s</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-4"></a>TQVariant::TQVariant ( const <a href="tqstring.html">TQString</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a string value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-5"></a>TQVariant::TQVariant ( const <a href="tqcstring.html">TQCString</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a C-string value, <em>val</em>.
|
|
<p> If you want to modify the <a href="tqcstring.html">TQCString</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="tqcstring.html#copy">TQCString::copy</a>()).
|
|
|
|
<h3 class=fn><a name="TQVariant-6"></a>TQVariant::TQVariant ( const char * 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="TQVariant-7"></a>TQVariant::TQVariant ( const <a href="tqstringlist.html">TQStringList</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a string list value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-8"></a>TQVariant::TQVariant ( const <a href="tqfont.html">TQFont</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a font value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-9"></a>TQVariant::TQVariant ( const <a href="tqpixmap.html">TQPixmap</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a pixmap value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-a"></a>TQVariant::TQVariant ( const <a href="tqimage.html">TQImage</a> & val )
|
|
</h3>
|
|
Constructs a new variant with an image value, <em>val</em>.
|
|
<p> Because <a href="tqimage.html">TQImage</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="tqimage.html#copy">TQImage::copy</a>(), e.g. if you intend
|
|
changing the image you've passed later on.
|
|
|
|
<h3 class=fn><a name="TQVariant-b"></a>TQVariant::TQVariant ( const <a href="tqbrush.html">TQBrush</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a brush value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-c"></a>TQVariant::TQVariant ( const <a href="tqpoint.html">TQPoint</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a point value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-d"></a>TQVariant::TQVariant ( const <a href="tqrect.html">TQRect</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a rect value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-e"></a>TQVariant::TQVariant ( const <a href="tqsize.html">TQSize</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a size value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-f"></a>TQVariant::TQVariant ( const <a href="tqcolor.html">TQColor</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a color value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-g"></a>TQVariant::TQVariant ( const <a href="tqpalette.html">TQPalette</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a color palette value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-h"></a>TQVariant::TQVariant ( const <a href="tqcolorgroup.html">TQColorGroup</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a color group value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-i"></a>TQVariant::TQVariant ( const <a href="tqiconset.html">TQIconSet</a> & val )
|
|
</h3>
|
|
Constructs a new variant with an icon set value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-j"></a>TQVariant::TQVariant ( const <a href="tqpointarray.html">TQPointArray</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a point array value, <em>val</em>.
|
|
<p> Because <a href="tqpointarray.html">TQPointArray</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="tqpointarray.html#copy">TQPointArray::copy</a>(), e.g. if you
|
|
intend changing the point array you've passed later on.
|
|
|
|
<h3 class=fn><a name="TQVariant-k"></a>TQVariant::TQVariant ( const <a href="tqregion.html">TQRegion</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a region value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-l"></a>TQVariant::TQVariant ( const <a href="tqbitmap.html">TQBitmap</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a bitmap value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-m"></a>TQVariant::TQVariant ( const <a href="tqcursor.html">TQCursor</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a cursor value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-n"></a>TQVariant::TQVariant ( const <a href="tqdate.html">TQDate</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a date value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-o"></a>TQVariant::TQVariant ( const <a href="tqtime.html">TQTime</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a time value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-p"></a>TQVariant::TQVariant ( const <a href="tqdatetime.html">TQDateTime</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a date/time value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-q"></a>TQVariant::TQVariant ( const <a href="tqbytearray.html">TQByteArray</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a bytearray value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-r"></a>TQVariant::TQVariant ( const <a href="tqbitarray.html">TQBitArray</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a bitarray value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-s"></a>TQVariant::TQVariant ( const <a href="tqkeysequence.html">TQKeySequence</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a key sequence value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-t"></a>TQVariant::TQVariant ( const <a href="tqpen.html">TQPen</a> & val )
|
|
</h3>
|
|
Constructs a new variant with a pen value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-u"></a>TQVariant::TQVariant ( const <a href="tqvaluelist.html">TQValueList</a><TQVariant> & val )
|
|
</h3>
|
|
Constructs a new variant with a list value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-v"></a>TQVariant::TQVariant ( const <a href="tqmap.html">TQMap</a><TQString, TQVariant> & val )
|
|
</h3>
|
|
Constructs a new variant with a map of TQVariants, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-w"></a>TQVariant::TQVariant ( int val )
|
|
</h3>
|
|
Constructs a new variant with an integer value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-x"></a>TQVariant::TQVariant ( uint val )
|
|
</h3>
|
|
Constructs a new variant with an unsigned integer value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-y"></a>TQVariant::TQVariant ( TQ_LLONG val )
|
|
</h3>
|
|
Constructs a new variant with a long long integer value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="TQVariant-z"></a>TQVariant::TQVariant ( TQ_ULLONG val )
|
|
</h3>
|
|
Constructs a new variant with an unsigned long long integer value, <em>val</em>.
|
|
|
|
<h3 class=fn><a name="~TQVariant"></a>TQVariant::~TQVariant ()
|
|
</h3>
|
|
Destroys the TQVariant 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">TQVariant::clear</a>() is called rather
|
|
than a subclass's clear().
|
|
|
|
<h3 class=fn><a href="tqbitarray.html">TQBitArray</a> & <a name="asBitArray"></a>TQVariant::asBitArray ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqbitarray.html">TQBitArray</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="tqbitmap.html">TQBitmap</a> & <a name="asBitmap"></a>TQVariant::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 & <a name="asBool"></a>TQVariant::asBool ()
|
|
</h3>
|
|
Returns the variant's value as bool reference.
|
|
|
|
<h3 class=fn><a href="tqbrush.html">TQBrush</a> & <a name="asBrush"></a>TQVariant::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="tqbytearray.html">TQByteArray</a> & <a name="asByteArray"></a>TQVariant::asByteArray ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqbytearray.html">TQByteArray</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="tqcstring.html">TQCString</a> & <a name="asCString"></a>TQVariant::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="tqcolor.html">TQColor</a> & <a name="asColor"></a>TQVariant::asColor ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqcolor.html">TQColor</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="tqcolor.html#isValid">TQColor::isValid</a>().
|
|
|
|
<h3 class=fn><a href="tqcolorgroup.html">TQColorGroup</a> & <a name="asColorGroup"></a>TQVariant::asColorGroup ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqcolorgroup.html">TQColorGroup</a> value. If that
|
|
is not possible the variant is set to a color group of all black
|
|
colors.
|
|
<p> Returns a reference to the stored color group.
|
|
<p> <p>See also <a href="#toColorGroup">toColorGroup</a>().
|
|
|
|
<h3 class=fn><a href="tqcursor.html">TQCursor</a> & <a name="asCursor"></a>TQVariant::asCursor ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqcursor.html">TQCursor</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="tqdate.html">TQDate</a> & <a name="asDate"></a>TQVariant::asDate ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqdate.html">TQDate</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="tqdatetime.html">TQDateTime</a> & <a name="asDateTime"></a>TQVariant::asDateTime ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqdatetime.html">TQDateTime</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 & <a name="asDouble"></a>TQVariant::asDouble ()
|
|
</h3>
|
|
Returns the variant's value as double reference.
|
|
|
|
<h3 class=fn><a href="tqfont.html">TQFont</a> & <a name="asFont"></a>TQVariant::asFont ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqfont.html">TQFont</a>. If that is not
|
|
possible the variant is set to the application's default font.
|
|
<p> Returns a reference to the stored font.
|
|
<p> <p>See also <a href="#toFont">toFont</a>().
|
|
|
|
<h3 class=fn><a href="tqiconset.html">TQIconSet</a> & <a name="asIconSet"></a>TQVariant::asIconSet ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqiconset.html">TQIconSet</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="tqimage.html">TQImage</a> & <a name="asImage"></a>TQVariant::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 & <a name="asInt"></a>TQVariant::asInt ()
|
|
</h3>
|
|
Returns the variant's value as int reference.
|
|
|
|
<h3 class=fn><a href="tqkeysequence.html">TQKeySequence</a> & <a name="asKeySequence"></a>TQVariant::asKeySequence ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqkeysequence.html">TQKeySequence</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="tqvaluelist.html">TQValueList</a><TQVariant> & <a name="asList"></a>TQVariant::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="tqvaluelist.html">TQValueList</a><TQVariant> list = myVariant.asList();
|
|
TQValueList<TQVariant>::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
|
|
while( it != list.<a href="tqvaluelist.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
|
|
<h3 class=fn>TQ_LLONG & <a name="asLongLong"></a>TQVariant::asLongLong ()
|
|
</h3>
|
|
Returns the variant's value as long long reference.
|
|
|
|
<h3 class=fn><a href="tqmap.html">TQMap</a><TQString, TQVariant> & <a name="asMap"></a>TQVariant::asMap ()
|
|
</h3>
|
|
Returns the variant's value as variant map reference.
|
|
<p> Note that if you want to iterate over the map, you should iterate
|
|
over a copy, e.g.
|
|
<pre>
|
|
<a href="tqmap.html">TQMap</a><TQString, TQVariant> map = myVariant.asMap();
|
|
TQMap<TQString, TQVariant>::Iterator it = map.<a href="tqmap.html#begin">begin</a>();
|
|
while( it != map.<a href="tqmap.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
|
|
<h3 class=fn><a href="tqpalette.html">TQPalette</a> & <a name="asPalette"></a>TQVariant::asPalette ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqpalette.html">TQPalette</a> value. If that is
|
|
not possible the variant is set to a palette of black colors.
|
|
<p> Returns a reference to the stored palette.
|
|
<p> <p>See also <a href="#toString">toString</a>().
|
|
|
|
<h3 class=fn><a href="tqpen.html">TQPen</a> & <a name="asPen"></a>TQVariant::asPen ()
|
|
</h3>
|
|
<p> Tries to convert the variant to hold a <a href="tqpen.html">TQPen</a> value. If that
|
|
is not possible then the variant is set to an empty pen.
|
|
<p> Returns a reference to the stored pen.
|
|
<p> <p>See also <a href="#toPen">toPen</a>().
|
|
|
|
<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> & <a name="asPixmap"></a>TQVariant::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="tqpoint.html">TQPoint</a> & <a name="asPoint"></a>TQVariant::asPoint ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a point value. If that is not
|
|
possible the variant is set to a (0, 0) point.
|
|
<p> Returns a reference to the stored point.
|
|
<p> <p>See also <a href="#toPoint">toPoint</a>().
|
|
|
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> & <a name="asPointArray"></a>TQVariant::asPointArray ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqpointarray.html">TQPointArray</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="tqrect.html">TQRect</a> & <a name="asRect"></a>TQVariant::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="tqregion.html">TQRegion</a> & <a name="asRegion"></a>TQVariant::asRegion ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqregion.html">TQRegion</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="tqsize.html">TQSize</a> & <a name="asSize"></a>TQVariant::asSize ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqsize.html">TQSize</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="tqsize.html#isValid">TQSize::isValid</a>().
|
|
|
|
<h3 class=fn><a href="tqsizepolicy.html">TQSizePolicy</a> & <a name="asSizePolicy"></a>TQVariant::asSizePolicy ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqsizepolicy.html">TQSizePolicy</a> value. If that
|
|
fails, the variant is set to an arbitrary (valid) size policy.
|
|
|
|
<h3 class=fn><a href="tqstring.html">TQString</a> & <a name="asString"></a>TQVariant::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="tqstringlist.html">TQStringList</a> & <a name="asStringList"></a>TQVariant::asStringList ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqstringlist.html">TQStringList</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="tqstringlist.html">TQStringList</a> list = myVariant.asStringList();
|
|
TQStringList::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
|
|
while( it != list.<a href="tqvaluelist.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#toStringList">toStringList</a>().
|
|
|
|
<h3 class=fn><a href="tqtime.html">TQTime</a> & <a name="asTime"></a>TQVariant::asTime ()
|
|
</h3>
|
|
|
|
<p> Tries to convert the variant to hold a <a href="tqtime.html">TQTime</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 & <a name="asUInt"></a>TQVariant::asUInt ()
|
|
</h3>
|
|
Returns the variant's value as unsigned int reference.
|
|
|
|
<h3 class=fn>TQ_ULLONG & <a name="asULongLong"></a>TQVariant::asULongLong ()
|
|
</h3>
|
|
Returns the variant's value as unsigned long long reference.
|
|
|
|
<h3 class=fn>bool <a name="canCast"></a>TQVariant::canCast ( <a href="tqvariant.html#Type-enum">Type</a> 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:
|
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Type <th valign="top">Automatically Cast To
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Bool <td valign="top">Double, Int, UInt, LongLong, ULongLong, String, CString, ByteArray
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">Color <td valign="top">String. CString. ByteArray
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Date <td valign="top">String, CString, ByteArray, DateTime
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">DateTime <td valign="top">String, CString, ByteArray, Date, Time
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Double <td valign="top">String, CString, ByteArray, Int, Bool, UInt, LongLong, ULongLong
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">Font <td valign="top">String, CString, ByteArray
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Int <td valign="top">String, CString, ByteArray, Double, Bool, UInt, LongLong, ULongLong, KeySequence
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">LongLong <td valign="top">String, CString, ByteArray, Double, Bool, UInt, LongLong, ULongLong, KeySequence
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">ULongLong <td valign="top">String, CString, ByteArray, Double, Bool, UInt, LongLong, ULongLong, KeySequence
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">List <td valign="top">StringList (if the list contains only strings or
|
|
something that can be cast to a string)
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">String <td valign="top">CString, ByteArray, CString, Int, UInt, Bool, Double, Date,
|
|
Time, DateTime, KeySequence, Font, Color
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">CString <td valign="top">String, ByteArray, Int, UInt, Bool, Double, Date, ULongLong, LongLong
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">ByteArray <td valign="top">String, CString, Int, UInt, Bool, Double, Date, ULongLong, LongLong
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">StringList <td valign="top">List
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Time <td valign="top">String
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">Int <td valign="top">String, CString, ByteArray, Double, Bool, UInt, LongLong, ULongLong, KeySequence
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">KeySequence <td valign="top">String, CString, ByteArray, Int, UInt, LongLong, ULongLong
|
|
</table></center>
|
|
|
|
<h3 class=fn>bool <a name="cast"></a>TQVariant::cast ( <a href="tqvariant.html#Type-enum">Type</a> 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
|
|
TQVariant::String, an empty point array if the requested type <em>t</em>
|
|
is TQVariant::PointArray, etc). Returns TRUE if the current type of
|
|
the variant was successfully cast; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>void <a name="clear"></a>TQVariant::clear ()
|
|
</h3>
|
|
Convert this variant to type Invalid and free up any resources
|
|
used.
|
|
|
|
<h3 class=fn>bool <a name="isNull"></a>TQVariant::isNull () const
|
|
</h3>
|
|
Returns TRUE if this is a NULL variant, FALSE otherwise.
|
|
|
|
<h3 class=fn>bool <a name="isValid"></a>TQVariant::isValid () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the storage type of this variant is not
|
|
TQVariant::Invalid; otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="tqvaluelistconstiterator.html">TQValueListConstIterator</a><TQVariant> <a name="listBegin"></a>TQVariant::listBegin () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns an iterator to the first item in the list if the variant's
|
|
type is appropriate; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqvaluelistconstiterator.html">TQValueListConstIterator</a><TQVariant> <a name="listEnd"></a>TQVariant::listEnd () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns the end iterator for the list if the variant's type is
|
|
appropriate; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqmapconstiterator.html">TQMapConstIterator</a><TQString, TQVariant> <a name="mapBegin"></a>TQVariant::mapBegin () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns an iterator to the first item in the map, if the variant's
|
|
type is appropriate; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqmapconstiterator.html">TQMapConstIterator</a><TQString, TQVariant> <a name="mapEnd"></a>TQVariant::mapEnd () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns the end iterator for the map, if the variant's type is
|
|
appropriate; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqmapconstiterator.html">TQMapConstIterator</a><TQString, TQVariant> <a name="mapFind"></a>TQVariant::mapFind ( const <a href="tqstring.html">TQString</a> & key ) const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<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;
|
|
otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqvariant.html#Type-enum">Type</a> <a name="nameToType"></a>TQVariant::nameToType ( const char * name )<tt> [static]</tt>
|
|
</h3>
|
|
Converts the string representation of the storage type given 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>TQVariant::operator!= ( const <a href="tqvariant.html">TQVariant</a> & v ) const
|
|
</h3>
|
|
Compares this TQVariant with <em>v</em> and returns TRUE if they are not
|
|
equal; otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="tqvariant.html">TQVariant</a> & <a name="operator-eq"></a>TQVariant::operator= ( const <a href="tqvariant.html">TQVariant</a> & 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="tqimage.html">TQImage</a>, a <a href="shclass.html#shallow-copy">shallow copy</a> is
|
|
performed.
|
|
|
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQVariant::operator== ( const <a href="tqvariant.html">TQVariant</a> & v ) const
|
|
</h3>
|
|
Compares this TQVariant with <em>v</em> and returns TRUE if they are
|
|
equal; otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="tqvaluelistconstiterator.html">TQValueListConstIterator</a><TQString> <a name="stringListBegin"></a>TQVariant::stringListBegin () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns an iterator to the first string in the list if the
|
|
variant's type is StringList; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn><a href="tqvaluelistconstiterator.html">TQValueListConstIterator</a><TQString> <a name="stringListEnd"></a>TQVariant::stringListEnd () const
|
|
</h3>
|
|
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns the end iterator for the list if the variant's type is
|
|
StringList; otherwise returns a null iterator.
|
|
|
|
<h3 class=fn>const <a href="tqbitarray.html">TQBitArray</a> <a name="toBitArray"></a>TQVariant::toBitArray () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqbitarray.html">TQBitArray</a> if the variant has <a href="#type">type</a>()
|
|
BitArray; otherwise returns an empty bitarray.
|
|
<p> <p>See also <a href="#asBitArray">asBitArray</a>().
|
|
|
|
<h3 class=fn>const <a href="tqbitmap.html">TQBitmap</a> <a name="toBitmap"></a>TQVariant::toBitmap () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqbitmap.html">TQBitmap</a> if the variant has <a href="#type">type</a>() Bitmap;
|
|
otherwise returns a null TQBitmap.
|
|
<p> <p>See also <a href="#asBitmap">asBitmap</a>().
|
|
|
|
<h3 class=fn>bool <a name="toBool"></a>TQVariant::toBool () const
|
|
</h3>
|
|
Returns the variant as a bool if the variant can be cast to Bool;
|
|
otherWise returns FALSE.
|
|
<p> Returns TRUE if the variant has a numeric type and its value is
|
|
non-zero, or if the variant has type String, ByteArray or CString
|
|
and its lower-case content is not empty, "0" or "false"; otherwise
|
|
returns FALSE.
|
|
<p> <p>See also <a href="#asBool">asBool</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqbrush.html">TQBrush</a> <a name="toBrush"></a>TQVariant::toBrush () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqbrush.html">TQBrush</a> if the variant has <a href="#type">type</a>() Brush;
|
|
otherwise returns a default brush (with all black colors).
|
|
<p> <p>See also <a href="#asBrush">asBrush</a>().
|
|
|
|
<h3 class=fn>const <a href="tqbytearray.html">TQByteArray</a> <a name="toByteArray"></a>TQVariant::toByteArray () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqbytearray.html">TQByteArray</a> if the variant can be cast to
|
|
a ByteArray; otherwise returns an empty bytearray.
|
|
<p> <p>See also <a href="#asByteArray">asByteArray</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqcstring.html">TQCString</a> <a name="toCString"></a>TQVariant::toCString () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqcstring.html">TQCString</a> if the variant can be cast to a
|
|
CString; otherwise returns 0.
|
|
<p> <p>See also <a href="#asCString">asCString</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqcolor.html">TQColor</a> <a name="toColor"></a>TQVariant::toColor () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqcolor.html">TQColor</a> if the variant can be cast to Color;
|
|
otherwise returns an invalid color.
|
|
<p> <p>See also <a href="#asColor">asColor</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqcolorgroup.html">TQColorGroup</a> <a name="toColorGroup"></a>TQVariant::toColorGroup () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqcolorgroup.html">TQColorGroup</a> if the variant has <a href="#type">type</a>()
|
|
ColorGroup; otherwise returns a completely black color group.
|
|
<p> <p>See also <a href="#asColorGroup">asColorGroup</a>().
|
|
|
|
<h3 class=fn>const <a href="tqcursor.html">TQCursor</a> <a name="toCursor"></a>TQVariant::toCursor () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqcursor.html">TQCursor</a> if the variant has <a href="#type">type</a>() Cursor;
|
|
otherwise returns the default arrow cursor.
|
|
<p> <p>See also <a href="#asCursor">asCursor</a>().
|
|
|
|
<h3 class=fn>const <a href="tqdate.html">TQDate</a> <a name="toDate"></a>TQVariant::toDate () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqdate.html">TQDate</a> if the variant can be cast to Date;
|
|
otherwise returns an invalid date.
|
|
<p> Note that if the <a href="#type">type</a>() is String, CString or ByteArray an invalid
|
|
date will be returned if the string cannot be parsed as a
|
|
TQt::ISODate format date.
|
|
<p> <p>See also <a href="#asDate">asDate</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqdatetime.html">TQDateTime</a> <a name="toDateTime"></a>TQVariant::toDateTime () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqdatetime.html">TQDateTime</a> if the variant can be cast to
|
|
DateTime; otherwise returns an invalid TQDateTime.
|
|
<p> Note that if the <a href="#type">type</a>() is String, CString or ByteArray an invalid
|
|
TQDateTime will be returned if the string cannot be parsed as a
|
|
TQt::ISODate format date/time.
|
|
<p> <p>See also <a href="#asDateTime">asDateTime</a>().
|
|
|
|
<h3 class=fn>double <a name="toDouble"></a>TQVariant::toDouble ( bool * ok = 0 ) const
|
|
</h3>
|
|
Returns the variant as a double if the variant can be cast to
|
|
Double; otherwise returns 0.0.
|
|
<p> If <em>ok</em> is non-null: <em>*ok</em> is set to TRUE if the value could be
|
|
converted to a double; otherwise <em>*ok</em> is set to FALSE.
|
|
<p> <p>See also <a href="#asDouble">asDouble</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqfont.html">TQFont</a> <a name="toFont"></a>TQVariant::toFont () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqfont.html">TQFont</a> if the variant can be cast to Font;
|
|
otherwise returns the application's default font.
|
|
<p> <p>See also <a href="#asFont">asFont</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqiconset.html">TQIconSet</a> <a name="toIconSet"></a>TQVariant::toIconSet () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqiconset.html">TQIconSet</a> if the variant has <a href="#type">type</a>()
|
|
IconSet; otherwise returns an icon set of null pixmaps.
|
|
<p> <p>See also <a href="#asIconSet">asIconSet</a>().
|
|
|
|
<h3 class=fn>const <a href="tqimage.html">TQImage</a> <a name="toImage"></a>TQVariant::toImage () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqimage.html">TQImage</a> if the variant has <a href="#type">type</a>() Image;
|
|
otherwise returns a null image.
|
|
<p> <p>See also <a href="#asImage">asImage</a>().
|
|
|
|
<h3 class=fn>int <a name="toInt"></a>TQVariant::toInt ( bool * ok = 0 ) const
|
|
</h3>
|
|
Returns the variant as an int if the variant can be cast to Int;
|
|
otherwise returns 0.
|
|
<p> If <em>ok</em> is non-null: <em>*ok</em> is set to TRUE if the value could be
|
|
converted to an int; otherwise <em>*ok</em> is set to FALSE.
|
|
<p> <p>See also <a href="#asInt">asInt</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqkeysequence.html">TQKeySequence</a> <a name="toKeySequence"></a>TQVariant::toKeySequence () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqkeysequence.html">TQKeySequence</a> if the variant can be cast
|
|
to a KeySequence; otherwise returns an empty key sequence.
|
|
<p> <p>See also <a href="#asKeySequence">asKeySequence</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqvaluelist.html">TQValueList</a><TQVariant> <a name="toList"></a>TQVariant::toList () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqvaluelist.html">TQValueList</a><TQVariant> if the variant has
|
|
<a href="#type">type</a>() List or StringList; otherwise returns an empty list.
|
|
<p> Note that if you want to iterate over the list, you should iterate
|
|
over a copy, e.g.
|
|
<pre>
|
|
<a href="tqvaluelist.html">TQValueList</a><TQVariant> list = myVariant.toList();
|
|
TQValueList<TQVariant>::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
|
|
while( it != list.<a href="tqvaluelist.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#asList">asList</a>().
|
|
|
|
<h3 class=fn>TQ_LLONG <a name="toLongLong"></a>TQVariant::toLongLong ( bool * ok = 0 ) const
|
|
</h3>
|
|
Returns the variant as a long long int if the variant can be cast
|
|
to LongLong; otherwise returns 0.
|
|
<p> If <em>ok</em> is non-null: <em>*ok</em> is set to TRUE if the value could be
|
|
converted to an int; otherwise <em>*ok</em> is set to FALSE.
|
|
<p> <p>See also <a href="#asLongLong">asLongLong</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqmap.html">TQMap</a><TQString, TQVariant> <a name="toMap"></a>TQVariant::toMap () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqmap.html">TQMap</a><TQString,TQVariant> if the variant has
|
|
<a href="#type">type</a>() Map; otherwise returns an empty map.
|
|
<p> Note that if you want to iterate over the map, you should iterate
|
|
over a copy, e.g.
|
|
<pre>
|
|
<a href="tqmap.html">TQMap</a><TQString, TQVariant> map = myVariant.toMap();
|
|
TQMap<TQString, TQVariant>::Iterator it = map.<a href="tqmap.html#begin">begin</a>();
|
|
while( it != map.<a href="tqmap.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#asMap">asMap</a>().
|
|
|
|
<h3 class=fn>const <a href="tqpalette.html">TQPalette</a> <a name="toPalette"></a>TQVariant::toPalette () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqpalette.html">TQPalette</a> if the variant has <a href="#type">type</a>()
|
|
Palette; otherwise returns a completely black palette.
|
|
<p> <p>See also <a href="#asPalette">asPalette</a>().
|
|
|
|
<h3 class=fn>const <a href="tqpen.html">TQPen</a> <a name="toPen"></a>TQVariant::toPen () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqpen.html">TQPen</a> if the variant has <a href="#type">type</a>()
|
|
Pen; otherwise returns an empty TQPen.
|
|
<p> <p>See also <a href="#asPen">asPen</a>().
|
|
|
|
<h3 class=fn>const <a href="tqpixmap.html">TQPixmap</a> <a name="toPixmap"></a>TQVariant::toPixmap () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqpixmap.html">TQPixmap</a> if the variant has <a href="#type">type</a>() Pixmap;
|
|
otherwise returns a null pixmap.
|
|
<p> <p>See also <a href="#asPixmap">asPixmap</a>().
|
|
|
|
<h3 class=fn>const <a href="tqpoint.html">TQPoint</a> <a name="toPoint"></a>TQVariant::toPoint () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqpoint.html">TQPoint</a> if the variant has <a href="#type">type</a>() Point;
|
|
otherwise returns a point (0, 0).
|
|
<p> <p>See also <a href="#asPoint">asPoint</a>().
|
|
|
|
<h3 class=fn>const <a href="tqpointarray.html">TQPointArray</a> <a name="toPointArray"></a>TQVariant::toPointArray () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqpointarray.html">TQPointArray</a> if the variant has <a href="#type">type</a>()
|
|
PointArray; otherwise returns an empty TQPointArray.
|
|
<p> <p>See also <a href="#asPointArray">asPointArray</a>().
|
|
|
|
<h3 class=fn>const <a href="tqrect.html">TQRect</a> <a name="toRect"></a>TQVariant::toRect () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqrect.html">TQRect</a> if the variant has <a href="#type">type</a>() Rect;
|
|
otherwise returns an empty rectangle.
|
|
<p> <p>See also <a href="#asRect">asRect</a>().
|
|
|
|
<h3 class=fn>const <a href="tqregion.html">TQRegion</a> <a name="toRegion"></a>TQVariant::toRegion () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqregion.html">TQRegion</a> if the variant has <a href="#type">type</a>() Region;
|
|
otherwise returns an empty TQRegion.
|
|
<p> <p>See also <a href="#asRegion">asRegion</a>().
|
|
|
|
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="toSize"></a>TQVariant::toSize () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqsize.html">TQSize</a> if the variant has <a href="#type">type</a>() Size;
|
|
otherwise returns an invalid size.
|
|
<p> <p>See also <a href="#asSize">asSize</a>().
|
|
|
|
<h3 class=fn><a href="tqsizepolicy.html">TQSizePolicy</a> <a name="toSizePolicy"></a>TQVariant::toSizePolicy () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqsizepolicy.html">TQSizePolicy</a> if the variant has <a href="#type">type</a>()
|
|
SizePolicy; otherwise returns an undefined (but legal) size
|
|
policy.
|
|
|
|
<h3 class=fn>const <a href="tqstring.html">TQString</a> <a name="toString"></a>TQVariant::toString () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqstring.html">TQString</a> if the variant can be cast to
|
|
String, otherwise returns <a href="tqstring.html#TQString-null">TQString::null</a>.
|
|
<p> <p>See also <a href="#asString">asString</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>const <a href="tqstringlist.html">TQStringList</a> <a name="toStringList"></a>TQVariant::toStringList () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqstringlist.html">TQStringList</a> if the variant has <a href="#type">type</a>()
|
|
StringList or List of a type that can be converted to <a href="tqstring.html">TQString</a>;
|
|
otherwise returns an empty list.
|
|
<p> Note that if you want to iterate over the list, you should iterate
|
|
over a copy, e.g.
|
|
<pre>
|
|
<a href="tqstringlist.html">TQStringList</a> list = myVariant.toStringList();
|
|
TQStringList::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
|
|
while( it != list.<a href="tqvaluelist.html#end">end</a>() ) {
|
|
myProcessing( *it );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#asStringList">asStringList</a>().
|
|
|
|
<h3 class=fn>const <a href="tqtime.html">TQTime</a> <a name="toTime"></a>TQVariant::toTime () const
|
|
</h3>
|
|
Returns the variant as a <a href="tqtime.html">TQTime</a> if the variant can be cast to Time;
|
|
otherwise returns an invalid date.
|
|
<p> Note that if the <a href="#type">type</a>() is String, CString or ByteArray an invalid
|
|
time will be returned if the string cannot be parsed as a
|
|
TQt::ISODate format time.
|
|
<p> <p>See also <a href="#asTime">asTime</a>().
|
|
|
|
<h3 class=fn>uint <a name="toUInt"></a>TQVariant::toUInt ( bool * ok = 0 ) const
|
|
</h3>
|
|
Returns the variant as an unsigned int if the variant can be cast
|
|
to UInt; otherwise returns 0.
|
|
<p> If <em>ok</em> is non-null: <em>*ok</em> is set to TRUE if the value could be
|
|
converted to an unsigned int; otherwise <em>*ok</em> is set to FALSE.
|
|
<p> <p>See also <a href="#asUInt">asUInt</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn>TQ_ULLONG <a name="toULongLong"></a>TQVariant::toULongLong ( bool * ok = 0 ) const
|
|
</h3>
|
|
Returns the variant as as an unsigned long long int if the variant
|
|
can be cast to ULongLong; otherwise returns 0.
|
|
<p> If <em>ok</em> is non-null: <em>*ok</em> is set to TRUE if the value could be
|
|
converted to an int; otherwise <em>*ok</em> is set to FALSE.
|
|
<p> <p>See also <a href="#asULongLong">asULongLong</a>() and <a href="#canCast">canCast</a>().
|
|
|
|
<h3 class=fn><a href="tqvariant.html#Type-enum">Type</a> <a name="type"></a>TQVariant::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>TQVariant::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, "TQFont", "TQString", or "TQValueList<TQVariant>". An Invalid
|
|
variant returns 0.
|
|
|
|
<h3 class=fn>const char * <a name="typeToName"></a>TQVariant::typeToName ( <a href="tqvariant.html#Type-enum">Type</a> 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">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<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 © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|