Class QVariant
- All Implemented Interfaces:
QtObjectInterface,Cloneable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated.Use QMetaType::Type instead. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQVariant()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 voidOverloaded function forassign(java.lang.Object).final voidfinal booleancanConvert(int targetTypeId) Deprecated.final booleancanConvert(QMetaType targetType) final booleancanConvert(QMetaType.Type targetType) final booleancanConvert(QVariant.Type targetType) Deprecated, for removal: This API element is subject to removal in a future version.static booleancanConvert(Object obj, int targetType) Deprecated, for removal: This API element is subject to removal in a future version.static booleancanConvert(Object obj, QMetaType type) Convenient static function for type conversion.static booleancanConvert(Object obj, QMetaType.Type type) Convenient static function for type conversion.static booleanConvenient static function for type conversion.static booleanConvenient static function for type conversion.static booleanConvenient static function for type conversion.static booleancanConvertToChar(Object obj) Convenient static function for type conversion.static booleanConvenient static function for type conversion.static booleancanConvertToDate(Object obj) Convenient static function for type conversion.static booleanConvenient static function for type conversion.static booleancanConvertToDouble(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 booleancanConvertToFlags(Object obj) Convenient static function for type conversion.static booleancanConvertToFloat(Object obj) Convenient static function for type conversion.static booleancanConvertToInt(Object obj) Convenient static function for type conversion.static booleancanConvertToLine(Object obj) Convenient static function for type conversion.static booleancanConvertToLineF(Object obj) Convenient static function for type conversion.static booleancanConvertToList(Object obj) Convenient static function for type conversion.static booleancanConvertToLocale(Object obj) Convenient static function for type conversion.static booleancanConvertToLong(Object obj) Convenient static function for type conversion.static booleancanConvertToMap(Object obj) Convenient static function for type conversion.static booleancanConvertToPoint(Object obj) Convenient static function for type conversion.static booleancanConvertToPointF(Object obj) Convenient static function for type conversion.static booleancanConvertToRect(Object obj) Convenient static function for type conversion.static booleancanConvertToRectF(Object obj) Convenient static function for type conversion.static booleanConvenient static function for type conversion.static booleancanConvertToSize(Object obj) Convenient static function for type conversion.static booleancanConvertToSizeF(Object obj) Convenient static function for type conversion.static booleancanConvertToString(Object obj) Convenient static function for type conversion.static booleanConvenient static function for type conversion.static booleancanConvertToTime(Object obj) Convenient static function for type conversion.final voidclear()clone()Creates and returns a copy of this object.static intfinal booleanconvert(int targetTypeId) Deprecated.final booleanstatic ObjectConvenient static function for type conversion.static ObjectConvenient static function for type conversion.static ObjectConvenient static function for type conversion.static ObjectConvenient static function for type conversion.static Objectconvert(Object obj, QMetaType.Type type) Convenient static function for type conversion.static Objectconvert(Object obj, QMetaType.Type type, boolean [] ok) Convenient static function for type conversion.static <T> TConvenient static function for type conversion.final booleanconvertTo(int type) protected final voidSeeQVariant::create(int, const void*) protected final voidSeeQVariant::create(QMetaType, const void*) final voiddetach()SeeQVariant::detach() final booleanbooleanstatic QVariantfromMetaType(QMetaType type) Overloaded function forfromMetaType(io.qt.core.QMetaType, java.lang.Object)withcopy = null.static QVariantfromMetaType(QMetaType type, Object copy) static QVariantfromMetaType(QMetaType.Type type) Overloaded function forfromMetaType(io.qt.core.QMetaType.Type, java.lang.Object)withcopy = null.static QVariantfromMetaType(QMetaType.Type type, Object copy) Overloaded function forfromMetaType(io.qt.core.QMetaType, java.lang.Object).static <T> QVariantfromValue(T value) inthashCode()Returns the objects's hash code computed byqHash(QVariant).final booleanSeeQVariant::isDetached()const final booleanisNull()final booleanisValid()static booleanDeprecated, for removal: This API element is subject to removal in a future version.final voidload(QDataStream ds) SeeQVariant::load(QDataStream&) static ObjectloadObject(QDataStream stream) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.readObject(Class, QMetaType...)instead.static ObjectloadObject(QDataStream stream, Boolean [] ok) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.readObject(Class, QMetaType...)instead.final QMetaTypemetaType()static QVariant.TypenameToType(String name) Deprecated.static ObjectReturns value if value is not null andNULLotherwise.static QVariantDeprecated, for removal: This API element is subject to removal in a future version.Use QVariant.NULL insteadstatic <T extends QtObjectInterface>
Tqvariant_cast(Object object, Class<T> targetType, QMetaType ... instantiations) voidfinal voidsave(QDataStream ds) SeeQVariant::save(QDataStream&)const static voidsaveObject(QDataStream stream, Object object) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.writeObject(Object)instead.static voidsaveObject(QDataStream stream, Object object, Boolean [] ok) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.writeObject(Object)instead.final voidfinal voidfinal QBitArraystatic QBitArraytoBitArray(Object obj) Convenient static function for type conversion.final booleanstatic booleanConvenient static function for type conversion.final QByteArraystatic QByteArraytoByteArray(Object obj) Convenient static function for type conversion.final chartoChar()static charConvenient static function for type conversion.static Collection<?> toCollection(Object obj) Convenient static function for type conversion.final QDatetoDate()static QDateConvenient static function for type conversion.final QDateTimestatic QDateTimetoDateTime(Object obj) Convenient static function for type conversion.final doubletoDouble()Overloaded function fortoDouble(boolean[])withok = null.final doubletoDouble(boolean[] ok) static doubleConvenient static function for type conversion.static doubleConvenient static function for type conversion.final QEasingCurvestatic <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 floattoFloat()Overloaded function fortoFloat(boolean[])withok = null.final floattoFloat(boolean[] ok) static floatConvenient static function for type conversion.static floatConvenient static function for type conversion.toHash()Convenient static function for type conversion.final inttoInt()Overloaded function fortoInt(boolean[])withok = null.final inttoInt(boolean[] ok) static intConvenient static function for type conversion.static intConvenient static function for type conversion.final QJsonArrayfinal QJsonDocumentfinal QJsonObjectfinal QJsonValuefinal QLinetoLine()static QLineConvenient static function for type conversion.final QLineFtoLineF()static QLineFConvenient static function for type conversion.toList()Convenient static function for type conversion.final QLocaletoLocale()static QLocaleConvenient static function for type conversion.final longtoLong()Overloaded function fortoLong(boolean[])withok = null.final longtoLong(boolean[] ok) static longConvenient static function for type conversion.toMap()Convenient static function for type conversion.final QModelIndexfinal QPersistentModelIndexfinal QPointtoPoint()static QPointConvenient static function for type conversion.final QPointFtoPointF()static QPointFConvenient static function for type conversion.final QRecttoRect()static QRectConvenient static function for type conversion.final QRectFtoRectF()static QRectFConvenient static function for type conversion.final QRegularExpressionstatic QRegularExpressionConvenient static function for type conversion.final QSizetoSize()static QSizeConvenient static function for type conversion.final QSizeFtoSizeF()static QSizeFConvenient static function for type conversion.final StringtoString()static StringConvenient static function for type conversion.final QStringListstatic QStringListtoStringList(Object obj) Convenient static function for type conversion.final QTimetoTime()static QTimeConvenient static function for type conversion.final QUrltoUrl()final QUuidtoUuid()final QVariant.Typetype()Deprecated.Use typeId() or metaType().static intDeprecated, for removal: This API element is subject to removal in a future version.static <T> ObjecttypedNullable(T value, Class<T> type, QMetaType ... instantiations) Returns value if value is not null andNULLotherwise.final inttypeId()final StringtypeName()static StringtypeToName(int typeId) Deprecated.final intuserType()final Objectvalue()final <T> TvoidMethods 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
-
QVariant
-
QVariant
-
QVariant
-
QVariant
- Parameters:
hash-
-
QVariant
-
QVariant
- Parameters:
jsonDocument-
-
QVariant
- Parameters:
jsonObject-
-
QVariant
-
QVariant
-
QVariant
-
QVariant
- Parameters:
list-
-
QVariant
-
QVariant
- Parameters:
type-copy-
-
QVariant
- Parameters:
modelIndex-
-
QVariant
- Parameters:
modelIndex-
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
See
QVariant::QVariant(QVariant) CAUTION: argument
nullwill convert toQVariant(nullptr).- Parameters:
other-
-
QVariant
Deprecated.Use the constructor taking a QMetaType instead.See
QVariant::QVariant(QVariant::Type) - Parameters:
type-
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
QVariant
-
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
nullin case the variant stores a null pointer and in case it is invalid.- Returns:
-
detach
See
QVariant::detach() -
isDetached
-
isNull
-
isValid
-
load
See
QVariant::load(QDataStream&) - Parameters:
ds-
-
metaType
- Returns:
- Since:
- This function was introduced in Qt 6.0.
-
writeTo
- Parameters:
s-
-
assign
See
QVariant::operator=(QVariant) CAUTION
nullwill convert toQVariant(nullptr).- Parameters:
other-
-
equals
- Parameters:
rhs-- Returns:
-
readFrom
- Parameters:
s-
-
save
See
QVariant::save(QDataStream&)const - Parameters:
ds-
-
setValue
See
QVariant::setValue(QVariant) CAUTION: argument
nullwill convert toQVariant(nullptr).- Parameters:
avalue-
-
swap
- Parameters:
other-
-
toBitArray
-
toBoolean
-
toByteArray
-
toChar
-
toDate
-
toDateTime
-
toDouble
- Parameters:
ok-- Returns:
-
toEasingCurve
- Returns:
-
toFloat
- Parameters:
ok-- Returns:
-
toHash
-
toInt
- Parameters:
ok-- Returns:
-
toJsonArray
-
toJsonDocument
- Returns:
-
toJsonObject
-
toJsonValue
-
toLine
-
toLineF
-
toList
-
toLocale
-
toLong
- Parameters:
ok-- Returns:
-
toMap
-
toModelIndex
-
toPersistentModelIndex
- Returns:
-
toPoint
-
toPointF
-
toRect
-
toRectF
-
toRegularExpression
- Returns:
-
toSize
-
toSizeF
-
toString
-
toStringList
-
toTime
-
toUrl
-
toUuid
-
type
Deprecated.Use typeId() or metaType().See
QVariant::type()const - Returns:
-
typeId
-
typeName
-
userType
-
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
nullwill 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, for removal: This API element is subject to removal in a future version.Use QVariant.NULL insteadCreate a variant for the native nullptr type. -
nullable
-
typedNullable
-
type
Deprecated, for removal: This API element is subject to removal in a future version.UseQMetaType.fromObject(Object)instead. -
convert
-
isValid
Deprecated, for removal: This API element is subject to removal in a future version.UseisValid()instead. -
canConvertToEnum
-
canConvertToFlags
Convenient static function for type conversion. -
toEnum
-
toEnum
-
toFlags
-
toFlags
-
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
-
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
-
canConvertToChar
Convenient static function for type conversion. -
toChar
Convenient static function for type conversion. -
canConvertToDate
Convenient static function for type conversion. -
toDate
-
canConvertToDateTime
Convenient static function for type conversion. -
toDateTime
-
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
-
canConvertToLineF
Convenient static function for type conversion. -
toLineF
-
canConvertToLocale
Convenient static function for type conversion. -
toLocale
-
canConvertToPoint
Convenient static function for type conversion. -
toPoint
-
canConvertToPointF
Convenient static function for type conversion. -
toPointF
-
canConvertToRect
Convenient static function for type conversion. -
toRect
-
canConvertToRectF
Convenient static function for type conversion. -
toRectF
-
canConvertToRegularExpression
Convenient static function for type conversion. -
toRegularExpression
Convenient static function for type conversion. -
canConvertToSize
Convenient static function for type conversion. -
toSize
-
canConvertToSizeF
Convenient static function for type conversion. -
toSizeF
-
canConvertToTime
Convenient static function for type conversion. -
toTime
-
canConvertToLong
Convenient static function for type conversion. -
toLong
Convenient static function for type conversion. -
canConvertToList
Convenient static function for type conversion. -
toList
-
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
-
toMap
-
qvariant_cast
@QtUninvokable public static <T extends QtObjectInterface> T qvariant_cast(Object object, Class<T> targetType, QMetaType ... instantiations) -
saveObject
@Deprecated(forRemoval=true, since="6.8.2") public static void saveObject(QDataStream stream, Object object) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.writeObject(Object)instead. -
saveObject
@Deprecated(forRemoval=true, since="6.8.2") public static void saveObject(QDataStream stream, Object object, Boolean [] ok) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.writeObject(Object)instead. -
loadObject
Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.readObject(Class, QMetaType...)instead. -
loadObject
@Deprecated(forRemoval=true, since="6.8.2") public static Object loadObject(QDataStream stream, Boolean [] ok) Deprecated, for removal: This API element is subject to removal in a future version.UseQDataStream.readObject(Class, QMetaType...)instead. -
convert
-
convert
-
convert
-
convert
-
canConvert
-
convert
Convenient static function for type conversion. -
convert
Convenient static function for type conversion. -
canConvert
@Deprecated(forRemoval=true, since="6.8.2") @QtUninvokable public final boolean canConvert(QVariant.Type targetType) Deprecated, for removal: This API element is subject to removal in a future version. -
canConvert
-
convert
-
canConvert
Convenient static function for type conversion. -
canConvert
@Deprecated(forRemoval=true, since="6.8.2") public static boolean canConvert(Object obj, int targetType) Deprecated, for removal: This API element is subject to removal in a future version.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).
-