- 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.QVariant
(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().static 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
-
QVariant
-
QVariant
public QVariant(char qchar) -
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
See
QVariant::
QVariant(QVariant) CAUTION: argument
null
will convert toQVariant(nullptr)
. -
QVariant
Deprecated.Use the constructor taking a QMetaType instead.See
QVariant::
QVariant(QVariant::Type) -
QVariant
public QVariant(boolean b) -
QVariant
public QVariant(double d) -
QVariant
public QVariant(float f) -
QVariant
public QVariant(int i) -
QVariant
public QVariant(long 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
See
QVariant::
canConvert(QMetaType)const This function was introduced in Qt 6.0.
-
canConvert
Deprecated.See
QVariant::
canConvert(int)const -
clear
-
convert
See
QVariant::
convert(QMetaType) This function was introduced in Qt 6.0.
-
convert
Deprecated.This function was introduced in Qt 6.0.
-
convertTo
See
QVariant::
convert(int, void*)const This function was introduced in Qt 6.0.
-
create
See
QVariant::
create(QMetaType, const void*) -
create
See
QVariant::
create(int, const void*) -
value
CAUTION: This method returns
null
in case the variant stores a null pointer and in case it is invalid. -
detach
See
QVariant::
detach() -
isDetached
See
QVariant::
isDetached()const -
isNull
-
isValid
-
load
See
QVariant::
load(QDataStream&) -
metaType
This function was introduced in Qt 6.0.
-
writeTo
See
operator<<(QDataStream&,
QVariant) -
assign
See
QVariant::
operator=(QVariant) CAUTION
null
will convert toQVariant(nullptr)
. -
equals
-
readFrom
See
operator>>(QDataStream&,
QVariant&) -
save
See
QVariant::
save(QDataStream&)const -
setValue
See
QVariant::
setValue(QVariant) CAUTION: argument
null
will convert toQVariant(nullptr)
. -
swap
-
toBitArray
-
toBoolean
-
toByteArray
-
toChar
-
toDate
-
toDateTime
-
toDouble
-
toEasingCurve
-
toFloat
-
toHash
-
toInt
-
toJsonArray
-
toJsonDocument
-
toJsonObject
-
toJsonValue
-
toLine
-
toLineF
-
toList
-
toLocale
-
toLong
-
toMap
-
toModelIndex
-
toPersistentModelIndex
-
toPoint
-
toPointF
-
toRect
-
toRectF
-
toRegularExpression
-
toSize
-
toSizeF
-
toString
-
toStringList
-
toTime
-
toUrl
-
toUuid
-
type
Deprecated.Use typeId() or metaType().See
QVariant::
type()const -
typeId
-
typeName
-
userType
-
value
- Parameters:
clazz
- target Java class the variant is converted intoinstantiations
- only required for generic container types- Returns:
- value of the variant (converted to target class if necessary)
-
compare
See
QVariant::
compare(QVariant, QVariant) This function was introduced in Qt 6.0.
-
fromMetaType
See
QVariant::
fromMetaType(QMetaType, const void*) This function was introduced in Qt 6.7.
-
fromValue
CAUTION: argument
null
will convert toQVariant(nullptr)
. -
nameToType
Deprecated.See
QVariant::
nameToType(const char*) -
typeToName
Deprecated.See
QVariant::
typeToName(int) -
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)
.
-