- All Implemented Interfaces:
QtObjectInterface
,Cloneable
,Comparable<QVariant>
Acts like a union for the most common Qt data types
Java wrapper for Qt class QVariant
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionQVariant()
QVariant
(boolean b) QVariant
(byte [] bytearray) Overloaded constructor forQVariant(io.qt.core.QByteArray)
.QVariant
(char qchar) QVariant
(double d) QVariant
(float f) QVariant
(int i) QVariant
(long ll) QVariant
(QByteArray bytearray) QVariant
(QEasingCurve easing) QVariant
(QJsonArray jsonArray) QVariant
(QJsonDocument jsonDocument) QVariant
(QJsonObject jsonObject) QVariant
(QJsonValue jsonValue) QVariant
(QModelIndex modelIndex) QVariant
(QPersistentModelIndex modelIndex) QVariant
(QEasingCurve.Type easing) Overloaded constructor forQVariant(io.qt.core.QEasingCurve)
.QVariant
(QJsonValue.Type jsonValue) Overloaded constructor forQVariant(io.qt.core.QJsonValue)
.QVariant
(QLocale.Language locale) Overloaded constructor forQVariant(io.qt.core.QLocale)
.QVariant
(QMetaType.Type metaType) QVariant
(QVariant.Type type) QVariant
(Collection<? extends Object> list) QVariant
(NavigableMap<String, ? extends Object> map) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final boolean
canConvert
(int targetTypeId) final boolean
canConvert
(QMetaType.Type targetType) final boolean
canConvert
(QVariant.Type targetType) static boolean
canConvert
(Object obj, int targetType) Deprecated.static boolean
canConvert
(Object obj, QMetaType.Type type) Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
canConvertToChar
(Object obj) Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
canConvertToDate
(Object obj) Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
canConvertToDouble
(Object obj) Convenient static function for type conversion.static <E extends Enum<?>>
booleancanConvertToEnum
(Class<E> enumClass, Object obj) Convenient static function for type conversion.static boolean
canConvertToFlags
(Object obj) Convenient static function for type conversion.static boolean
canConvertToFloat
(Object obj) Convenient static function for type conversion.static boolean
canConvertToInt
(Object obj) Convenient static function for type conversion.static boolean
canConvertToLine
(Object obj) Convenient static function for type conversion.static boolean
canConvertToLineF
(Object obj) Convenient static function for type conversion.static boolean
canConvertToList
(Object obj) Convenient static function for type conversion.static boolean
canConvertToLocale
(Object obj) Convenient static function for type conversion.static boolean
canConvertToLong
(Object obj) Convenient static function for type conversion.static boolean
canConvertToMap
(Object obj) Convenient static function for type conversion.static boolean
canConvertToPoint
(Object obj) Convenient static function for type conversion.static boolean
canConvertToPointF
(Object obj) Convenient static function for type conversion.static boolean
canConvertToRect
(Object obj) Convenient static function for type conversion.static boolean
canConvertToRectF
(Object obj) Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
canConvertToSize
(Object obj) Convenient static function for type conversion.static boolean
canConvertToSizeF
(Object obj) Convenient static function for type conversion.static boolean
canConvertToString
(Object obj) Convenient static function for type conversion.static boolean
Convenient static function for type conversion.static boolean
canConvertToTime
(Object obj) Convenient static function for type conversion.final void
clear()
clone()
Creates and returns a copy of this object.protected final boolean
SeeQVariant::
cmp(QVariant)const protected final int
SeeQVariant::
compare(QVariant)const int
final boolean
convert
(int targetTypeId) static Object
Convenient static function for type conversion.static Object
Convenient static function for type conversion.static Object
Convenient static function for type conversion.static Object
Convenient static function for type conversion.static Object
convert
(Object obj, QMetaType.Type metaType) Convenient static function for type conversion.static Object
convert
(Object obj, QMetaType.Type metaType, boolean [] ok) Convenient static function for type conversion.static Object
convert
(Object obj, QVariant.Type metaType) Convenient static function for type conversion.static Object
convert
(Object obj, QVariant.Type metaType, boolean [] ok) Convenient static function for type conversion.static <T> T
Convenient static function for type conversion.final boolean
convertTo
(int t) protected final void
SeeQVariant::
create(int, const void*) final void
detach()
SeeQVariant::
detach() final boolean
boolean
static <T> QVariant
fromValue
(T value) int
hashCode()
Returns the objects's hash code computed byqHash(QVariant)
.final boolean
SeeQVariant::
isDetached()const final boolean
isNull()
final boolean
isValid()
static boolean
Deprecated.final void
load
(QDataStream ds) SeeQVariant::
load(QDataStream&) static Object
loadObject
(QDataStream stream) Deprecated.static Object
loadObject
(QDataStream stream, Boolean [] ok) Deprecated.UseQDataStream.readObject(Class, QMetaType...)
instead.static QVariant.Type
nameToType
(String name) static Object
Returns value if value is not null andNULL
otherwise.static QVariant
Deprecated.Use QVariant.NULL insteadstatic <T extends QtObjectInterface>
Tqvariant_cast
(Object object, Class<T> targetType, QMetaType ... instantiations) void
Seeoperator>>(QDataStream&,
QVariant&) final void
save
(QDataStream ds) SeeQVariant::
save(QDataStream&)const static void
saveObject
(QDataStream stream, Object object) Deprecated.UseQDataStream.writeObject(Object)
instead.static void
saveObject
(QDataStream stream, Object object, Boolean [] ok) Deprecated.UseQDataStream.writeObject(Object)
instead.final void
final void
Delegate forassign(java.lang.Object)
.final void
final QBitArray
static QBitArray
toBitArray
(Object obj) Convenient static function for type conversion.final boolean
static boolean
Convenient static function for type conversion.final QByteArray
static QByteArray
toByteArray
(Object obj) Convenient static function for type conversion.final char
toChar()
static char
Convenient static function for type conversion.static Collection<?>
toCollection
(Object obj) Convenient static function for type conversion.final QDate
toDate()
static QDate
Convenient static function for type conversion.final QDateTime
static QDateTime
toDateTime
(Object obj) Convenient static function for type conversion.final double
toDouble()
Overloaded function fortoDouble(boolean[])
withok = null
.final double
toDouble
(boolean[] ok) static double
Convenient static function for type conversion.static double
Convenient static function for type conversion.final QEasingCurve
static <E extends Enum<?>>
EConvenient static function for type conversion.static <E extends Enum<?>>
EConvenient static function for type conversion.static <F extends QFlags<?>>
FConvenient static function for type conversion.static <F extends QFlags<?>>
FConvenient static function for type conversion.final float
toFloat()
Overloaded function fortoFloat(boolean[])
withok = null
.final float
toFloat
(boolean[] ok) static float
Convenient static function for type conversion.static float
Convenient static function for type conversion.toHash()
Convenient static function for type conversion.final int
toInt()
Overloaded function fortoInt(boolean[])
withok = null
.final int
toInt
(boolean[] ok) static int
Convenient static function for type conversion.static int
Convenient static function for type conversion.final QJsonArray
final QJsonDocument
final QJsonObject
final QJsonValue
final QLine
toLine()
static QLine
Convenient static function for type conversion.final QLineF
toLineF()
static QLineF
Convenient static function for type conversion.toList()
Convenient static function for type conversion.final QLocale
toLocale()
static QLocale
Convenient static function for type conversion.final long
toLong()
Overloaded function fortoLong(boolean[])
withok = null
.final long
toLong
(boolean[] ok) static long
Convenient static function for type conversion.toMap()
Convenient static function for type conversion.final QModelIndex
final QPersistentModelIndex
final QPoint
toPoint()
static QPoint
Convenient static function for type conversion.final QPointF
toPointF()
static QPointF
Convenient static function for type conversion.final QRect
toRect()
static QRect
Convenient static function for type conversion.final QRectF
toRectF()
static QRectF
Convenient static function for type conversion.final QRegExp
toRegExp()
final QRegularExpression
static QRegularExpression
Convenient static function for type conversion.final QSize
toSize()
static QSize
Convenient static function for type conversion.final QSizeF
toSizeF()
static QSizeF
Convenient static function for type conversion.final String
toString()
static String
Convenient static function for type conversion.final QStringList
static QStringList
toStringList
(Object obj) Convenient static function for type conversion.final QTime
toTime()
static QTime
Convenient static function for type conversion.final QUrl
toUrl()
final QUuid
toUuid()
final QVariant.Type
type()
static int
Deprecated.static <T> Object
typedNullable
(T value, Class<T> type, QMetaType ... instantiations) Returns value if value is not null andNULL
otherwise.final String
typeName()
static String
typeToName
(int typeId) final int
userType()
final Object
value()
SeeQVariant::
data()const final <T> T
void
Seeoperator<<(QDataStream&,
QVariant) Methods inherited from class io.qt.QtObject
dispose, isDisposed
-
Field Details
-
NULL
Special value representing QVariant(null) -
INVALID
Special value representing invalid QVariant
-
-
Constructor Details
-
QVariant
public QVariant() -
QVariant
- Parameters:
bitarray
-
-
QVariant
- Parameters:
bytearray
-
-
QVariant
public QVariant(char qchar) - Parameters:
qchar
-
-
QVariant
- Parameters:
s
-
-
QVariant
- Parameters:
date
-
-
QVariant
- Parameters:
datetime
-
-
QVariant
- Parameters:
easing
-- Since:
- This function was introduced in Qt 4.7.
-
QVariant
- Parameters:
hash
-
-
QVariant
- Parameters:
jsonArray
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
jsonDocument
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
jsonObject
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
jsonValue
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
line
-
-
QVariant
- Parameters:
line
-
-
QVariant
- Parameters:
list
-
-
QVariant
- Parameters:
locale
-
-
QVariant
- Parameters:
modelIndex
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
modelIndex
-- Since:
- This function was introduced in Qt 5.5.
-
QVariant
- Parameters:
pt
-
-
QVariant
- Parameters:
pt
-
-
QVariant
- Parameters:
rect
-
-
QVariant
- Parameters:
rect
-
-
QVariant
- Parameters:
regExp
-
-
QVariant
- Parameters:
re
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
- Parameters:
size
-
-
QVariant
- Parameters:
size
-
-
QVariant
- Parameters:
string
-
-
QVariant
- Parameters:
time
-
-
QVariant
- Parameters:
url
-
-
QVariant
- Parameters:
uuid
-- Since:
- This function was introduced in Qt 5.0.
-
QVariant
See
QVariant::
QVariant(QVariant) CAUTION: argument
null
will convert toQVariant(nullptr)
.- Parameters:
other
-
-
QVariant
- Parameters:
type
-
-
QVariant
public QVariant(boolean b) - Parameters:
b
-
-
QVariant
public QVariant(double d) - Parameters:
d
-
-
QVariant
public QVariant(float f) - Parameters:
f
-- Since:
- This function was introduced in Qt 4.6.
-
QVariant
public QVariant(int i) - Parameters:
i
-
-
QVariant
- Parameters:
typeId
-copy
-
-
QVariant
public QVariant(long ll) - Parameters:
ll
-
-
QVariant
-
QVariant
public QVariant(byte [] bytearray) Overloaded constructor for
QVariant(io.qt.core.QByteArray)
. -
QVariant
Overloaded constructor for
QVariant(io.qt.core.QEasingCurve)
. -
QVariant
Overloaded constructor for
QVariant(io.qt.core.QJsonValue)
. -
QVariant
Overloaded constructor for
QVariant(io.qt.core.QLocale)
.
-
-
Method Details
-
canConvert
- Parameters:
targetTypeId
-- Returns:
-
clear
-
cmp
See
QVariant::
cmp(QVariant)const - Parameters:
other
-- Returns:
-
compare
See
QVariant::
compare(QVariant)const - Parameters:
other
-- Returns:
-
convert
- Parameters:
targetTypeId
-- Returns:
-
convertTo
- Parameters:
t
-- Returns:
-
create
See
QVariant::
create(int, const void*) - Parameters:
type
-copy
-
-
value
See
QVariant::
data()const CAUTION: This method returns
null
in case the variant stores a null pointer and in case it is invalid.- Returns:
-
detach
See
QVariant::
detach() -
isDetached
See
QVariant::
isDetached()const - Returns:
-
isNull
- Returns:
-
isValid
- Returns:
-
load
See
QVariant::
load(QDataStream&) - Parameters:
ds
-
-
writeTo
See
operator<<(QDataStream&,
QVariant) - Parameters:
s
-
-
assign
See
QVariant::
operator=(QVariant) CAUTION
null
will convert toQVariant(nullptr)
.- Parameters:
other
-
-
equals
- Parameters:
v
-- Returns:
-
readFrom
See
operator>>(QDataStream&,
QVariant&) - Parameters:
s
-
-
save
See
QVariant::
save(QDataStream&)const - Parameters:
ds
-
-
setValue
- Parameters:
avalue
-
-
swap
- Parameters:
other
-- Since:
- This function was introduced in Qt 4.8.
-
toBitArray
- Returns:
-
toBoolean
- Returns:
-
toByteArray
- Returns:
-
toChar
- Returns:
-
toDate
- Returns:
-
toDateTime
- Returns:
-
toDouble
- Parameters:
ok
-- Returns:
-
toEasingCurve
- Returns:
- Since:
- This function was introduced in Qt 4.7.
-
toFloat
- Parameters:
ok
-- Returns:
- Since:
- This function was introduced in Qt 4.6.
-
toHash
- Returns:
-
toInt
- Parameters:
ok
-- Returns:
-
toJsonArray
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toJsonDocument
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toJsonObject
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toJsonValue
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toLine
- Returns:
-
toLineF
- Returns:
-
toList
- Returns:
-
toLocale
- Returns:
-
toLong
- Parameters:
ok
-- Returns:
-
toMap
- Returns:
-
toModelIndex
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toPersistentModelIndex
- Returns:
- Since:
- This function was introduced in Qt 5.5.
-
toPoint
- Returns:
-
toPointF
- Returns:
-
toRect
- Returns:
-
toRectF
- Returns:
-
toRegExp
- Returns:
- Since:
- This function was introduced in Qt 4.1.
-
toRegularExpression
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
toSize
- Returns:
-
toSizeF
- Returns:
-
toString
-
toStringList
- Returns:
-
toTime
- Returns:
-
toUrl
- Returns:
-
toUuid
- Returns:
- Since:
- This function was introduced in Qt 5.0.
-
type
- Returns:
-
typeName
- Returns:
-
userType
- Returns:
-
value
- Parameters:
clazz
- target Java class the variant is converted intoinstantiations
- instantiations only required for generic container types- Returns:
-
fromValue
CAUTION: argument
null
will convert toQVariant(nullptr)
.- Parameters:
value
-- Returns:
-
nameToType
- Parameters:
name
-- Returns:
-
typeToName
- Parameters:
typeId
-- Returns:
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<QVariant>
-
hashCode
Returns the objects's hash code computed byqHash(QVariant)
. -
nullVariant
Deprecated.Use QVariant.NULL insteadCreate a variant for the native nullptr type. -
nullable
Returns value if value is not null andNULL
otherwise.- Parameters:
value
-- Returns:
- value or
NULL
-
typedNullable
Returns value if value is not null andNULL
otherwise.- Parameters:
value
-type
- Java type of the valueinstantiations
- only required for generic container types- Returns:
- value or
NULL
-
type
Deprecated.UseQMetaType.fromObject(Object)
instead. -
convert
Convenient static function for type conversion. -
isValid
Deprecated.UseisValid()
instead. -
canConvertToEnum
Convenient static function for type conversion. -
canConvertToFlags
Convenient static function for type conversion. -
toEnum
Convenient static function for type conversion. -
toEnum
Convenient static function for type conversion. -
toFlags
Convenient static function for type conversion. -
toFlags
Convenient static function for type conversion. -
canConvertToDouble
Convenient static function for type conversion. -
toDouble
Convenient static function for type conversion. -
toDouble
Convenient static function for type conversion. -
canConvertToFloat
Convenient static function for type conversion. -
toFloat
Convenient static function for type conversion. -
toFloat
Convenient static function for type conversion. -
canConvertToString
Convenient static function for type conversion. -
toString
Convenient static function for type conversion. -
canConvertToBoolean
Convenient static function for type conversion. -
toBoolean
Convenient static function for type conversion. -
canConvertToByteArray
Convenient static function for type conversion. -
toByteArray
Convenient static function for type conversion. -
canConvertToBitArray
Convenient static function for type conversion. -
toBitArray
Convenient static function for type conversion. -
canConvertToChar
Convenient static function for type conversion. -
toChar
Convenient static function for type conversion. -
canConvertToDate
Convenient static function for type conversion. -
toDate
Convenient static function for type conversion. -
canConvertToDateTime
Convenient static function for type conversion. -
toDateTime
Convenient static function for type conversion. -
canConvertToInt
Convenient static function for type conversion. -
toInt
Convenient static function for type conversion. -
toInt
Convenient static function for type conversion. -
canConvertToLine
Convenient static function for type conversion. -
toLine
Convenient static function for type conversion. -
canConvertToLineF
Convenient static function for type conversion. -
toLineF
Convenient static function for type conversion. -
canConvertToLocale
Convenient static function for type conversion. -
toLocale
Convenient static function for type conversion. -
canConvertToPoint
Convenient static function for type conversion. -
toPoint
Convenient static function for type conversion. -
canConvertToPointF
Convenient static function for type conversion. -
toPointF
Convenient static function for type conversion. -
canConvertToRect
Convenient static function for type conversion. -
toRect
Convenient static function for type conversion. -
canConvertToRectF
Convenient static function for type conversion. -
toRectF
Convenient static function for type conversion. -
canConvertToRegularExpression
Convenient static function for type conversion. -
toRegularExpression
Convenient static function for type conversion. -
canConvertToSize
Convenient static function for type conversion. -
toSize
Convenient static function for type conversion. -
canConvertToSizeF
Convenient static function for type conversion. -
toSizeF
Convenient static function for type conversion. -
canConvertToTime
Convenient static function for type conversion. -
toTime
Convenient static function for type conversion. -
canConvertToLong
Convenient static function for type conversion. -
toLong
Convenient static function for type conversion. -
canConvertToList
Convenient static function for type conversion. -
toList
Convenient static function for type conversion. -
canConvertToStringList
Convenient static function for type conversion. -
toStringList
Convenient static function for type conversion. -
canConvertToCollection
Convenient static function for type conversion. -
toCollection
Convenient static function for type conversion. -
canConvertToMap
Convenient static function for type conversion. -
toHash
Convenient static function for type conversion. -
toMap
Convenient static function for type conversion. -
qvariant_cast
@QtUninvokable public static <T extends QtObjectInterface> T qvariant_cast(Object object, Class<T> targetType, QMetaType ... instantiations) -
saveObject
Deprecated.UseQDataStream.writeObject(Object)
instead. -
saveObject
Deprecated.UseQDataStream.writeObject(Object)
instead. -
loadObject
Deprecated.UseQDataStream.readObject(Class, QMetaType...)
instead. -
loadObject
Deprecated.UseQDataStream.readObject(Class, QMetaType...)
instead. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
canConvert
-
canConvert
-
convert
-
canConvert
Deprecated.Convenient static function for type conversion. -
canConvert
Convenient static function for type conversion. -
clone
Creates and returns a copy of this object.
-
setValue
Delegate for
assign(java.lang.Object)
. -
toDouble
Overloaded function for
toDouble(boolean[])
withok = null
. -
toFloat
Overloaded function for
toFloat(boolean[])
withok = null
. -
toInt
Overloaded function for
toInt(boolean[])
withok = null
. -
toLong
Overloaded function for
toLong(boolean[])
withok = null
.
-
QDataStream.readObject(Class, QMetaType...)
instead.