- All Implemented Interfaces:
QtObjectInterface
,Cloneable
Acts like a union for the most common Qt data types
Java wrapper for Qt class QVariant
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Deprecated.Use QMetaType::Type instead. -
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) Overloaded constructor forQVariant(io.qt.core.QMetaType, java.lang.Object)
withcopy = null
.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
(QMetaType.Type type, Object copy) QVariant
(QVariant.Type type) Deprecated.Use the constructor taking a QMetaType instead.@param typeQVariant
(Collection<? extends Object> list) QVariant
(NavigableMap<String, ? extends Object> map) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Overloaded function forassign(java.lang.Object)
.final void
final boolean
canConvert
(int targetTypeId) Deprecated.final boolean
canConvert
(QMetaType targetType) final boolean
canConvert
(QMetaType.Type targetType) final boolean
canConvert
(QVariant.Type targetType) Deprecated.static boolean
canConvert
(Object obj, int targetType) Deprecated.static boolean
canConvert
(Object obj, QMetaType type) Convenient static function for type conversion.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.static int
final boolean
convert
(int targetTypeId) Deprecated.final boolean
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 type) Convenient static function for type conversion.static Object
convert
(Object obj, QMetaType.Type type, boolean [] ok) Convenient static function for type conversion.static <T> T
Convenient static function for type conversion.final boolean
convertTo
(int type) protected final void
SeeQVariant::
create(int, const void*) protected final void
SeeQVariant::
create(QMetaType, const void*) final void
detach()
SeeQVariant::
detach() final boolean
boolean
static QVariant
fromMetaType
(QMetaType type) Overloaded function forfromMetaType(io.qt.core.QMetaType, java.lang.Object)
withcopy = null
.static QVariant
fromMetaType
(QMetaType type, Object copy) static QVariant
fromMetaType
(QMetaType.Type type) Overloaded function forfromMetaType(io.qt.core.QMetaType.Type, java.lang.Object)
withcopy = null
.static QVariant
fromMetaType
(QMetaType.Type type, Object copy) Overloaded function forfromMetaType(io.qt.core.QMetaType, java.lang.Object)
.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.UseQDataStream.readObject(Class, QMetaType...)
instead.static Object
loadObject
(QDataStream stream, Boolean [] ok) Deprecated.UseQDataStream.readObject(Class, QMetaType...)
instead.final QMetaType
metaType()
static QVariant.Type
nameToType
(String name) Deprecated.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
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 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()
Deprecated.Use typeId() or metaType().@returnstatic int
Deprecated.static <T> Object
typedNullable
(T value, Class<T> type, QMetaType ... instantiations) Returns value if value is not null andNULL
otherwise.final int
typeId()
final String
typeName()
static String
typeToName
(int typeId) Deprecated.final int
userType()
final Object
value()
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:
date
-
-
QVariant
- Parameters:
datetime
-
-
QVariant
- Parameters:
easing
-
-
QVariant
- Parameters:
hash
-
-
QVariant
- Parameters:
jsonArray
-
-
QVariant
- Parameters:
jsonDocument
-
-
QVariant
- Parameters:
jsonObject
-
-
QVariant
- Parameters:
jsonValue
-
-
QVariant
- Parameters:
line
-
-
QVariant
- Parameters:
line
-
-
QVariant
- Parameters:
list
-
-
QVariant
- Parameters:
locale
-
-
QVariant
- Parameters:
type
-copy
-
-
QVariant
- Parameters:
modelIndex
-
-
QVariant
- Parameters:
modelIndex
-
-
QVariant
- Parameters:
pt
-
-
QVariant
- Parameters:
pt
-
-
QVariant
- Parameters:
rect
-
-
QVariant
- Parameters:
rect
-
-
QVariant
- Parameters:
re
-
-
QVariant
- Parameters:
size
-
-
QVariant
- Parameters:
size
-
-
QVariant
- Parameters:
string
-
-
QVariant
- Parameters:
time
-
-
QVariant
- Parameters:
url
-
-
QVariant
- Parameters:
uuid
-
-
QVariant
See
QVariant::
QVariant(QVariant) CAUTION: argument
null
will convert toQVariant(nullptr)
.- Parameters:
other
-
-
QVariant
Deprecated.Use the constructor taking a QMetaType instead.@param typeSee
QVariant::
QVariant(QVariant::Type) -
QVariant
public QVariant(boolean b) - Parameters:
b
-
-
QVariant
public QVariant(double d) - Parameters:
d
-
-
QVariant
public QVariant(float f) - Parameters:
f
-
-
QVariant
public QVariant(int i) - Parameters:
i
-
-
QVariant
public QVariant(long ll) - Parameters:
ll
-
-
QVariant
-
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)
. -
QVariant
Overloaded constructor for
QVariant(io.qt.core.QMetaType, java.lang.Object)
withcopy = null
.
-
-
Method Details
-
canConvert
- Parameters:
targetType
-- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
canConvert
Deprecated.See
QVariant::
canConvert(int)const - Parameters:
targetTypeId
-- Returns:
-
clear
-
convert
- Parameters:
type
-- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
convert
Deprecated.- Parameters:
targetTypeId
-- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
convertTo
- Parameters:
type
-- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
create
See
QVariant::
create(QMetaType, const void*) - Parameters:
type
-copy
-
-
create
See
QVariant::
create(int, const void*) - Parameters:
type
-copy
-
-
value
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
-
-
metaType
- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
writeTo
See
operator<<(QDataStream&,
QVariant) - Parameters:
s
-
-
assign
See
QVariant::
operator=(QVariant) CAUTION
null
will convert toQVariant(nullptr)
.- Parameters:
other
-
-
equals
- Parameters:
b
-- Returns:
-
readFrom
See
operator>>(QDataStream&,
QVariant&) - Parameters:
s
-
-
save
See
QVariant::
save(QDataStream&)const - Parameters:
ds
-
-
setValue
See
QVariant::
setValue(QVariant) CAUTION: argument
null
will convert toQVariant(nullptr)
.- Parameters:
avalue
-
-
swap
- Parameters:
other
-
-
toBitArray
- Returns:
-
toBoolean
- Returns:
-
toByteArray
- Returns:
-
toChar
- Returns:
-
toDate
- Returns:
-
toDateTime
- Returns:
-
toDouble
- Parameters:
ok
-- Returns:
-
toEasingCurve
- Returns:
-
toFloat
- Parameters:
ok
-- Returns:
-
toHash
- Returns:
-
toInt
- Parameters:
ok
-- Returns:
-
toJsonArray
- Returns:
-
toJsonDocument
- Returns:
-
toJsonObject
- Returns:
-
toJsonValue
- Returns:
-
toLine
- Returns:
-
toLineF
- Returns:
-
toList
- Returns:
-
toLocale
- Returns:
-
toLong
- Parameters:
ok
-- Returns:
-
toMap
- Returns:
-
toModelIndex
- Returns:
-
toPersistentModelIndex
- Returns:
-
toPoint
- Returns:
-
toPointF
- Returns:
-
toRect
- Returns:
-
toRectF
- Returns:
-
toRegularExpression
- Returns:
-
toSize
- Returns:
-
toSizeF
- Returns:
-
toString
-
toStringList
- Returns:
-
toTime
- Returns:
-
toUrl
- Returns:
-
toUuid
- Returns:
-
type
Deprecated.Use typeId() or metaType().@returnSee
QVariant::
type()const -
typeId
- Returns:
-
typeName
- Returns:
-
userType
- Returns:
-
value
- Parameters:
clazz
- target Java class the variant is converted intoinstantiations
- instantiations only required for generic container types- Returns:
-
compare
- Parameters:
lhs
-rhs
-- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
fromMetaType
- Parameters:
type
-copy
-- Returns:
- Since:
- This function was introduced in Qt 6.7.
-
fromValue
CAUTION: argument
null
will convert toQVariant(nullptr)
.- Parameters:
value
-- Returns:
-
nameToType
Deprecated.See
QVariant::
nameToType(const char*) - Parameters:
name
-- Returns:
-
typeToName
Deprecated.See
QVariant::
typeToName(int) - Parameters:
typeId
-- Returns:
-
equals
-
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. -
canConvert
-
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
canConvert
Deprecated. -
canConvert
Convenient static function for type conversion. -
convert
-
canConvert
Convenient static function for type conversion. -
canConvert
Deprecated.Convenient static function for type conversion. -
clone
Creates and returns a copy of this object.
-
assign
Overloaded function 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
. -
fromMetaType
Overloaded function for
fromMetaType(io.qt.core.QMetaType, java.lang.Object)
withcopy = null
. -
fromMetaType
Overloaded function for
fromMetaType(io.qt.core.QMetaType.Type, java.lang.Object)
withcopy = null
. -
fromMetaType
Overloaded function for
fromMetaType(io.qt.core.QMetaType, java.lang.Object)
.
-