Make QVariant docs refer to QMetaType::Type.
Task-number: QTBUG-30014 Change-Id: Ie4c0df92345bcb79ef44fb6f345cba9fc934d32f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
parent
d76b0d9c6f
commit
f523883c2f
@ -1938,9 +1938,10 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han
|
||||
/*!
|
||||
\fn QStringList QVariant::toStringList() const
|
||||
|
||||
Returns the variant as a QStringList if the variant has type()
|
||||
StringList, \l String, or \l List of a type that can be converted
|
||||
to QString; otherwise returns an empty list.
|
||||
Returns the variant as a QStringList if the variant has userType()
|
||||
\l QMetaType::QStringList, \l QMetaType::QString, or
|
||||
\l QMetaType::QVariantList of a type that can be converted to QString;
|
||||
otherwise returns an empty list.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -1950,10 +1951,12 @@ QStringList QVariant::toStringList() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a QString if the variant has type() \l
|
||||
String, \l Bool, \l ByteArray, \l Char, \l Date, \l DateTime, \l
|
||||
Double, \l Int, \l LongLong, \l StringList, \l Time, \l UInt, or
|
||||
\l ULongLong; otherwise returns an empty string.
|
||||
Returns the variant as a QString if the variant has userType() \l
|
||||
QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray,
|
||||
\l QMetaType::QChar, \l QMetaType::QDate, \l QMetaType::QDateTime,
|
||||
\l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong,
|
||||
\l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or
|
||||
\l QMetaType::ULongLong; otherwise returns an empty string.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -1964,7 +1967,7 @@ QString QVariant::toString() const
|
||||
|
||||
/*!
|
||||
Returns the variant as a QMap<QString, QVariant> if the variant
|
||||
has type() \l Map; otherwise returns an empty map.
|
||||
has type() \l QMetaType::QVariantMap; otherwise returns an empty map.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -1975,7 +1978,7 @@ QVariantMap QVariant::toMap() const
|
||||
|
||||
/*!
|
||||
Returns the variant as a QHash<QString, QVariant> if the variant
|
||||
has type() \l Hash; otherwise returns an empty map.
|
||||
has type() \l QMetaType::QVariantHash; otherwise returns an empty map.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -1987,11 +1990,12 @@ QVariantHash QVariant::toHash() const
|
||||
/*!
|
||||
\fn QDate QVariant::toDate() const
|
||||
|
||||
Returns the variant as a QDate if the variant has type() \l Date,
|
||||
\l DateTime, or \l String; otherwise returns an invalid date.
|
||||
Returns the variant as a QDate if the variant has userType()
|
||||
\l QMetaType::QDate, \l QMetaType::QDateTime, or \l QMetaType::QString;
|
||||
otherwise returns an invalid date.
|
||||
|
||||
If the type() is \l String, an invalid date will be returned if the
|
||||
string cannot be parsed as a Qt::ISODate format date.
|
||||
If the type() is \l QMetaType::QString, an invalid date will be returned if
|
||||
the string cannot be parsed as a Qt::ISODate format date.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2003,10 +2007,11 @@ QDate QVariant::toDate() const
|
||||
/*!
|
||||
\fn QTime QVariant::toTime() const
|
||||
|
||||
Returns the variant as a QTime if the variant has type() \l Time,
|
||||
\l DateTime, or \l String; otherwise returns an invalid time.
|
||||
Returns the variant as a QTime if the variant has userType()
|
||||
\l QMetaType::QTime, \l QMetaType::QDateTime, or \l QMetaType::QString;
|
||||
otherwise returns an invalid time.
|
||||
|
||||
If the type() is \l String, an invalid time will be returned if
|
||||
If the type() is \l QMetaType::QString, an invalid time will be returned if
|
||||
the string cannot be parsed as a Qt::ISODate format time.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2019,12 +2024,12 @@ QTime QVariant::toTime() const
|
||||
/*!
|
||||
\fn QDateTime QVariant::toDateTime() const
|
||||
|
||||
Returns the variant as a QDateTime if the variant has type() \l
|
||||
DateTime, \l Date, or \l String; otherwise returns an invalid
|
||||
date/time.
|
||||
Returns the variant as a QDateTime if the variant has userType()
|
||||
\l QMetaType::QDateTime, \l QMetaType::QDate, or \l QMetaType::QString;
|
||||
otherwise returns an invalid date/time.
|
||||
|
||||
If the type() is \l String, an invalid date/time will be returned
|
||||
if the string cannot be parsed as a Qt::ISODate format date/time.
|
||||
If the type() is \l QMetaType::QString, an invalid date/time will be
|
||||
returned if the string cannot be parsed as a Qt::ISODate format date/time.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2037,8 +2042,8 @@ QDateTime QVariant::toDateTime() const
|
||||
\since 4.7
|
||||
\fn QEasingCurve QVariant::toEasingCurve() const
|
||||
|
||||
Returns the variant as a QEasingCurve if the variant has type() \l
|
||||
EasingCurve; otherwise returns a default easing curve.
|
||||
Returns the variant as a QEasingCurve if the variant has userType()
|
||||
\l QMetaType::QEasingCurve; otherwise returns a default easing curve.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2052,9 +2057,9 @@ QEasingCurve QVariant::toEasingCurve() const
|
||||
/*!
|
||||
\fn QByteArray QVariant::toByteArray() const
|
||||
|
||||
Returns the variant as a QByteArray if the variant has type() \l
|
||||
ByteArray or \l String (converted using QString::fromUtf8());
|
||||
otherwise returns an empty byte array.
|
||||
Returns the variant as a QByteArray if the variant has userType()
|
||||
\l QMetaType::QByteArray or \l QMetaType::QString (converted using
|
||||
QString::fromUtf8()); otherwise returns an empty byte array.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2067,8 +2072,9 @@ QByteArray QVariant::toByteArray() const
|
||||
/*!
|
||||
\fn QPoint QVariant::toPoint() const
|
||||
|
||||
Returns the variant as a QPoint if the variant has type()
|
||||
\l Point or \l PointF; otherwise returns a null QPoint.
|
||||
Returns the variant as a QPoint if the variant has userType()
|
||||
\l QMetaType::QPointF or \l QMetaType::QPointF; otherwise returns a null
|
||||
QPoint.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2080,8 +2086,8 @@ QPoint QVariant::toPoint() const
|
||||
/*!
|
||||
\fn QRect QVariant::toRect() const
|
||||
|
||||
Returns the variant as a QRect if the variant has type() \l Rect;
|
||||
otherwise returns an invalid QRect.
|
||||
Returns the variant as a QRect if the variant has userType()
|
||||
\l QMetaType::QRect; otherwise returns an invalid QRect.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2093,8 +2099,8 @@ QRect QVariant::toRect() const
|
||||
/*!
|
||||
\fn QSize QVariant::toSize() const
|
||||
|
||||
Returns the variant as a QSize if the variant has type() \l Size;
|
||||
otherwise returns an invalid QSize.
|
||||
Returns the variant as a QSize if the variant has userType()
|
||||
\l QMetaType::QSize; otherwise returns an invalid QSize.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2106,8 +2112,8 @@ QSize QVariant::toSize() const
|
||||
/*!
|
||||
\fn QSizeF QVariant::toSizeF() const
|
||||
|
||||
Returns the variant as a QSizeF if the variant has type() \l
|
||||
SizeF; otherwise returns an invalid QSizeF.
|
||||
Returns the variant as a QSizeF if the variant has userType() \l
|
||||
QMetaType::QSizeF; otherwise returns an invalid QSizeF.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2119,8 +2125,9 @@ QSizeF QVariant::toSizeF() const
|
||||
/*!
|
||||
\fn QRectF QVariant::toRectF() const
|
||||
|
||||
Returns the variant as a QRectF if the variant has type() \l Rect
|
||||
or \l RectF; otherwise returns an invalid QRectF.
|
||||
Returns the variant as a QRectF if the variant has userType()
|
||||
\l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid
|
||||
QRectF.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2132,8 +2139,8 @@ QRectF QVariant::toRectF() const
|
||||
/*!
|
||||
\fn QLineF QVariant::toLineF() const
|
||||
|
||||
Returns the variant as a QLineF if the variant has type() \l
|
||||
LineF; otherwise returns an invalid QLineF.
|
||||
Returns the variant as a QLineF if the variant has userType()
|
||||
\l QMetaType::QLineF; otherwise returns an invalid QLineF.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2145,8 +2152,8 @@ QLineF QVariant::toLineF() const
|
||||
/*!
|
||||
\fn QLine QVariant::toLine() const
|
||||
|
||||
Returns the variant as a QLine if the variant has type() \l Line;
|
||||
otherwise returns an invalid QLine.
|
||||
Returns the variant as a QLine if the variant has userType()
|
||||
\l QMetaType::QLine; otherwise returns an invalid QLine.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2158,8 +2165,9 @@ QLine QVariant::toLine() const
|
||||
/*!
|
||||
\fn QPointF QVariant::toPointF() const
|
||||
|
||||
Returns the variant as a QPointF if the variant has type() \l
|
||||
Point or \l PointF; otherwise returns a null QPointF.
|
||||
Returns the variant as a QPointF if the variant has userType() \l
|
||||
QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null
|
||||
QPointF.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2174,8 +2182,8 @@ QPointF QVariant::toPointF() const
|
||||
/*!
|
||||
\fn QUrl QVariant::toUrl() const
|
||||
|
||||
Returns the variant as a QUrl if the variant has type()
|
||||
\l Url; otherwise returns an invalid QUrl.
|
||||
Returns the variant as a QUrl if the variant has userType()
|
||||
\l QMetaType::QUrl; otherwise returns an invalid QUrl.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2188,8 +2196,8 @@ QUrl QVariant::toUrl() const
|
||||
/*!
|
||||
\fn QLocale QVariant::toLocale() const
|
||||
|
||||
Returns the variant as a QLocale if the variant has type()
|
||||
\l Locale; otherwise returns an invalid QLocale.
|
||||
Returns the variant as a QLocale if the variant has userType()
|
||||
\l QMetaType::QLocale; otherwise returns an invalid QLocale.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2202,8 +2210,8 @@ QLocale QVariant::toLocale() const
|
||||
\fn QRegExp QVariant::toRegExp() const
|
||||
\since 4.1
|
||||
|
||||
Returns the variant as a QRegExp if the variant has type() \l
|
||||
RegExp; otherwise returns an empty QRegExp.
|
||||
Returns the variant as a QRegExp if the variant has userType()
|
||||
\l QMetaType::QRegExp; otherwise returns an empty QRegExp.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2218,7 +2226,7 @@ QRegExp QVariant::toRegExp() const
|
||||
\fn QRegularExpression QVariant::toRegularExpression() const
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QRegularExpression if the variant has type() \l
|
||||
Returns the variant as a QRegularExpression if the variant has userType() \l
|
||||
QRegularExpression; otherwise returns an empty QRegularExpression.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2234,7 +2242,7 @@ QRegularExpression QVariant::toRegularExpression() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QUuid if the variant has type() \l
|
||||
Returns the variant as a QUuid if the variant has userType() \l
|
||||
QUuid; otherwise returns a default constructed QUuid.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2247,7 +2255,7 @@ QUuid QVariant::toUuid() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QModelIndex if the variant has type() \l
|
||||
Returns the variant as a QModelIndex if the variant has userType() \l
|
||||
QModelIndex; otherwise returns a default constructed QModelIndex.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2260,7 +2268,7 @@ QModelIndex QVariant::toModelIndex() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QJsonValue if the variant has type() \l
|
||||
Returns the variant as a QJsonValue if the variant has userType() \l
|
||||
QJsonValue; otherwise returns a default constructed QJsonValue.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2273,7 +2281,7 @@ QJsonValue QVariant::toJsonValue() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QJsonObject if the variant has type() \l
|
||||
Returns the variant as a QJsonObject if the variant has userType() \l
|
||||
QJsonObject; otherwise returns a default constructed QJsonObject.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2286,7 +2294,7 @@ QJsonObject QVariant::toJsonObject() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QJsonArray if the variant has type() \l
|
||||
Returns the variant as a QJsonArray if the variant has userType() \l
|
||||
QJsonArray; otherwise returns a default constructed QJsonArray.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2299,7 +2307,7 @@ QJsonArray QVariant::toJsonArray() const
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
Returns the variant as a QJsonDocument if the variant has type() \l
|
||||
Returns the variant as a QJsonDocument if the variant has userType() \l
|
||||
QJsonDocument; otherwise returns a default constructed QJsonDocument.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
@ -2313,8 +2321,9 @@ QJsonDocument QVariant::toJsonDocument() const
|
||||
/*!
|
||||
\fn QChar QVariant::toChar() const
|
||||
|
||||
Returns the variant as a QChar if the variant has type() \l Char,
|
||||
\l Int, or \l UInt; otherwise returns an invalid QChar.
|
||||
Returns the variant as a QChar if the variant has userType()
|
||||
\l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise
|
||||
returns an invalid QChar.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2324,8 +2333,8 @@ QChar QVariant::toChar() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a QBitArray if the variant has type()
|
||||
\l BitArray; otherwise returns an empty bit array.
|
||||
Returns the variant as a QBitArray if the variant has userType()
|
||||
\l QMetaType::QBitArray; otherwise returns an empty bit array.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2351,16 +2360,19 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as an int if the variant has type() \l Int,
|
||||
\l Bool, \l ByteArray, \l Char, \l Double, \l LongLong, \l
|
||||
String, \l UInt, or \l ULongLong; otherwise returns 0.
|
||||
Returns the variant as an int if the variant has userType()
|
||||
\l QMetaType::Int, \l QMetaType::Bool, \l QMetaType::QByteArray,
|
||||
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::LongLong,
|
||||
\l QMetaType::QString, \l QMetaType::UInt, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.
|
||||
|
||||
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
|
||||
converted to an int; otherwise \c{*}\a{ok} is set to false.
|
||||
|
||||
\b{Warning:} If the value is convertible to a \l LongLong but is too
|
||||
large to be represented in an int, the resulting arithmetic overflow will
|
||||
not be reflected in \a ok. A simple workaround is to use QString::toInt().
|
||||
\b{Warning:} If the value is convertible to a \l QMetaType::LongLong but is
|
||||
too large to be represented in an int, the resulting arithmetic overflow
|
||||
will not be reflected in \a ok. A simple workaround is to use
|
||||
QString::toInt().
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2370,16 +2382,19 @@ int QVariant::toInt(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as an unsigned int if the variant has type()
|
||||
\l UInt, \l Bool, \l ByteArray, \l Char, \l Double, \l Int, \l
|
||||
LongLong, \l String, or \l ULongLong; otherwise returns 0.
|
||||
Returns the variant as an unsigned int if the variant has userType()
|
||||
\l QMetaType::UInt, \l QMetaType::Bool, \l QMetaType::QByteArray,
|
||||
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int,
|
||||
\l QMetaType::LongLong, \l QMetaType::QString, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.
|
||||
|
||||
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
|
||||
converted to an unsigned int; otherwise \c{*}\a{ok} is set to false.
|
||||
|
||||
\b{Warning:} If the value is convertible to a \l ULongLong but is too
|
||||
large to be represented in an unsigned int, the resulting arithmetic overflow will
|
||||
not be reflected in \a ok. A simple workaround is to use QString::toUInt().
|
||||
\b{Warning:} If the value is convertible to a \l QMetaType::ULongLong but is
|
||||
too large to be represented in an unsigned int, the resulting arithmetic
|
||||
overflow will not be reflected in \a ok. A simple workaround is to use
|
||||
QString::toUInt().
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2389,9 +2404,11 @@ uint QVariant::toUInt(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a long long int if the variant has type()
|
||||
\l LongLong, \l Bool, \l ByteArray, \l Char, \l Double, \l Int,
|
||||
\l String, \l UInt, or \l ULongLong; otherwise returns 0.
|
||||
Returns the variant as a long long int if the variant has userType()
|
||||
\l QMetaType::LongLong, \l QMetaType::Bool, \l QMetaType::QByteArray,
|
||||
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int,
|
||||
\l QMetaType::QString, \l QMetaType::UInt, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.
|
||||
|
||||
If \a ok is non-null: \c{*}\c{ok} is set to true if the value could be
|
||||
converted to an int; otherwise \c{*}\c{ok} is set to false.
|
||||
@ -2405,9 +2422,10 @@ qlonglong QVariant::toLongLong(bool *ok) const
|
||||
|
||||
/*!
|
||||
Returns the variant as as an unsigned long long int if the
|
||||
variant has type() \l ULongLong, \l Bool, \l ByteArray, \l Char,
|
||||
\l Double, \l Int, \l LongLong, \l String, or \l UInt; otherwise
|
||||
returns 0.
|
||||
variant has type() \l QMetaType::ULongLong, \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::Double,
|
||||
\l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString, or
|
||||
\l QMetaType::UInt; otherwise returns 0.
|
||||
|
||||
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
|
||||
converted to an int; otherwise \c{*}\a{ok} is set to false.
|
||||
@ -2420,13 +2438,14 @@ qulonglong QVariant::toULongLong(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a bool if the variant has type() Bool.
|
||||
Returns the variant as a bool if the variant has userType() Bool.
|
||||
|
||||
Returns true if the variant has type() \l Bool, \l Char, \l Double,
|
||||
\l Int, \l LongLong, \l UInt, or \l ULongLong and the value is
|
||||
non-zero, or if the variant has type \l String or \l ByteArray and
|
||||
its lower-case content is not one of the following: empty, "0"
|
||||
or "false"; otherwise returns false.
|
||||
Returns true if the variant has userType() \l QMetaType::Bool,
|
||||
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int,
|
||||
\l QMetaType::LongLong, \l QMetaType::UInt, or \l QMetaType::ULongLong and
|
||||
the value is non-zero, or if the variant has type \l QMetaType::QString or
|
||||
\l QMetaType::QByteArray and its lower-case content is not one of the
|
||||
following: empty, "0" or "false"; otherwise returns false.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2442,9 +2461,11 @@ bool QVariant::toBool() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a double if the variant has type() \l
|
||||
Double, \l QMetaType::Float, \l Bool, \l ByteArray, \l Int, \l LongLong, \l String, \l
|
||||
UInt, or \l ULongLong; otherwise returns 0.0.
|
||||
Returns the variant as a double if the variant has userType()
|
||||
\l QMetaType::Double, \l QMetaType::Float, \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::Int, \l QMetaType::LongLong,
|
||||
\l QMetaType::QString, \l QMetaType::UInt, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.0.
|
||||
|
||||
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
|
||||
converted to a double; otherwise \c{*}\a{ok} is set to false.
|
||||
@ -2457,9 +2478,11 @@ double QVariant::toDouble(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a float if the variant has type() \l
|
||||
Double, \l QMetaType::Float, \l Bool, \l ByteArray, \l Int, \l LongLong, \l String, \l
|
||||
UInt, or \l ULongLong; otherwise returns 0.0.
|
||||
Returns the variant as a float if the variant has userType()
|
||||
\l QMetaType::Double, \l QMetaType::Float, \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::Int, \l QMetaType::LongLong,
|
||||
\l QMetaType::QString, \l QMetaType::UInt, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.0.
|
||||
|
||||
\since 4.6
|
||||
|
||||
@ -2474,9 +2497,11 @@ float QVariant::toFloat(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a qreal if the variant has type() \l
|
||||
Double, \l QMetaType::Float, \l Bool, \l ByteArray, \l Int, \l LongLong, \l String, \l
|
||||
UInt, or \l ULongLong; otherwise returns 0.0.
|
||||
Returns the variant as a qreal if the variant has userType()
|
||||
\l QMetaType::Double, \l QMetaType::Float, \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::Int, \l QMetaType::LongLong,
|
||||
\l QMetaType::QString, \l QMetaType::UInt, or \l QMetaType::ULongLong;
|
||||
otherwise returns 0.0.
|
||||
|
||||
\since 4.6
|
||||
|
||||
@ -2491,8 +2516,9 @@ qreal QVariant::toReal(bool *ok) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the variant as a QVariantList if the variant has type()
|
||||
\l List or \l StringList; otherwise returns an empty list.
|
||||
Returns the variant as a QVariantList if the variant has userType()
|
||||
\l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns
|
||||
an empty list.
|
||||
|
||||
\sa canConvert(), convert()
|
||||
*/
|
||||
@ -2631,27 +2657,51 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
|
||||
|
||||
\table
|
||||
\header \li Type \li Automatically Cast To
|
||||
\row \li \l Bool \li \l Char, \l Double, \l Int, \l LongLong, \l String, \l UInt, \l ULongLong
|
||||
\row \li \l ByteArray \li \l Double, \l Int, \l LongLong, \l String, \l UInt, \l ULongLong
|
||||
\row \li \l Char \li \l Bool, \l Int, \l UInt, \l LongLong, \l ULongLong
|
||||
\row \li \l Color \li \l String
|
||||
\row \li \l Date \li \l DateTime, \l String
|
||||
\row \li \l DateTime \li \l Date, \l String, \l Time
|
||||
\row \li \l Double \li \l Bool, \l Int, \l LongLong, \l String, \l UInt, \l ULongLong
|
||||
\row \li \l Font \li \l String
|
||||
\row \li \l Int \li \l Bool, \l Char, \l Double, \l LongLong, \l String, \l UInt, \l ULongLong
|
||||
\row \li \l KeySequence \li \l Int, \l String
|
||||
\row \li \l List \li \l StringList (if the list's items can be converted to strings)
|
||||
\row \li \l LongLong \li \l Bool, \l ByteArray, \l Char, \l Double, \l Int, \l String, \l UInt, \l ULongLong
|
||||
\row \li \l Point \li PointF
|
||||
\row \li \l Rect \li RectF
|
||||
\row \li \l String \li \l Bool, \l ByteArray, \l Char, \l Color, \l Date, \l DateTime, \l Double,
|
||||
\l Font, \l Int, \l KeySequence, \l LongLong, \l StringList, \l Time, \l UInt,
|
||||
\l ULongLong
|
||||
\row \li \l StringList \li \l List, \l String (if the list contains exactly one item)
|
||||
\row \li \l Time \li \l String
|
||||
\row \li \l UInt \li \l Bool, \l Char, \l Double, \l Int, \l LongLong, \l String, \l ULongLong
|
||||
\row \li \l ULongLong \li \l Bool, \l Char, \l Double, \l Int, \l LongLong, \l String, \l UInt
|
||||
\row \li \l QMetaType::Bool \li \l QMetaType::QChar, \l QMetaType::Double,
|
||||
\l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString,
|
||||
\l QMetaType::UInt, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QByteArray \li \l QMetaType::Double,
|
||||
\l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString,
|
||||
\l QMetaType::UInt, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QChar \li \l QMetaType::Bool, \l QMetaType::Int,
|
||||
\l QMetaType::UInt, \l QMetaType::LongLong, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QColor \li \l QMetaType::QString
|
||||
\row \li \l QMetaType::QDate \li \l QMetaType::QDateTime,
|
||||
\l QMetaType::QString
|
||||
\row \li \l QMetaType::QDateTime \li \l QMetaType::QDate,
|
||||
\l QMetaType::QString, \l QMetaType::QTime
|
||||
\row \li \l QMetaType::Double \li \l QMetaType::Bool, \l QMetaType::Int,
|
||||
\l QMetaType::LongLong, \l QMetaType::QString, \l QMetaType::UInt,
|
||||
\l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QFont \li \l QMetaType::QString
|
||||
\row \li \l QMetaType::Int \li \l QMetaType::Bool, \l QMetaType::QChar,
|
||||
\l QMetaType::Double, \l QMetaType::LongLong, \l QMetaType::QString,
|
||||
\l QMetaType::UInt, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QKeySequence \li \l QMetaType::Int,
|
||||
\l QMetaType::QString
|
||||
\row \li \l QMetaType::QVariantList \li \l QMetaType::QStringList (if the
|
||||
list's items can be converted to QStrings)
|
||||
\row \li \l QMetaType::LongLong \li \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::Double,
|
||||
\l QMetaType::Int, \l QMetaType::QString, \l QMetaType::UInt,
|
||||
\l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QPoint \li QMetaType::QPointF
|
||||
\row \li \l QMetaType::QRect \li QMetaType::QRectF
|
||||
\row \li \l QMetaType::QString \li \l QMetaType::Bool,
|
||||
\l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::QColor,
|
||||
\l QMetaType::QDate, \l QMetaType::QDateTime, \l QMetaType::Double,
|
||||
\l QMetaType::QFont, \l QMetaType::Int, \l QMetaType::QKeySequence,
|
||||
\l QMetaType::LongLong, \l QMetaType::QStringList, \l QMetaType::QTime,
|
||||
\l QMetaType::UInt, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::QStringList \li \l QMetaType::QVariantList,
|
||||
\l QMetaType::QString (if the list contains exactly one item)
|
||||
\row \li \l QMetaType::QTime \li \l QMetaType::QString
|
||||
\row \li \l QMetaType::UInt \li \l QMetaType::Bool, \l QMetaType::QChar,
|
||||
\l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong,
|
||||
\l QMetaType::QString, \l QMetaType::ULongLong
|
||||
\row \li \l QMetaType::ULongLong \li \l QMetaType::Bool,
|
||||
\l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int,
|
||||
\l QMetaType::LongLong, \l QMetaType::QString, \l QMetaType::UInt
|
||||
\endtable
|
||||
|
||||
A QVariant containing a pointer to a type derived from QObject will also return true for this
|
||||
|
Loading…
Reference in New Issue
Block a user