io.qt.core.QVariant Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.core;
import io.qt.*;
/**
* Acts like a union for the most common Qt data types
* Java wrapper for Qt class QVariant
*/
public class QVariant extends QtObject
implements java.lang.Cloneable
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QVariant::Type
*
* @deprecated Use QMetaType::Type instead.
*/
@QtExtensibleEnum
@Deprecated
public enum Type implements QtEnumerator {
/**
* Representing QVariant:: Invalid
*/
Invalid(0),
/**
* Representing QVariant:: Bool
*/
Bool(1),
/**
* Representing QVariant:: Int
*/
Int(2),
/**
* Representing QVariant:: UInt
*/
UInt(3),
/**
* Representing QVariant:: LongLong
*/
LongLong(4),
/**
* Representing QVariant:: ULongLong
*/
ULongLong(5),
/**
* Representing QVariant:: Double
*/
Double(6),
/**
* Representing QVariant:: Char
*/
Char(7),
/**
* Representing QVariant:: Map
*/
Map(8),
/**
* Representing QVariant:: List
*/
List(9),
/**
* Representing QVariant:: String
*/
String(10),
/**
* Representing QVariant:: StringList
*/
StringList(11),
/**
* Representing QVariant:: ByteArray
*/
ByteArray(12),
/**
* Representing QVariant:: BitArray
*/
BitArray(13),
/**
* Representing QVariant:: Date
*/
Date(14),
/**
* Representing QVariant:: Time
*/
Time(15),
/**
* Representing QVariant:: DateTime
*/
DateTime(16),
/**
* Representing QVariant:: Url
*/
Url(17),
/**
* Representing QVariant:: Locale
*/
Locale(18),
/**
* Representing QVariant:: Rect
*/
Rect(19),
/**
* Representing QVariant:: RectF
*/
RectF(20),
/**
* Representing QVariant:: Size
*/
Size(21),
/**
* Representing QVariant:: SizeF
*/
SizeF(22),
/**
* Representing QVariant:: Line
*/
Line(23),
/**
* Representing QVariant:: LineF
*/
LineF(24),
/**
* Representing QVariant:: Point
*/
Point(25),
/**
* Representing QVariant:: PointF
*/
PointF(26),
/**
* Representing QVariant:: RegularExpression
*/
RegularExpression(44),
/**
* Representing QVariant:: Hash
*/
Hash(28),
/**
* Representing QVariant:: EasingCurve
*/
EasingCurve(29),
/**
* Representing QVariant:: Uuid
*/
Uuid(30),
/**
* Representing QVariant:: ModelIndex
*/
ModelIndex(42),
/**
* Representing QVariant:: PersistentModelIndex
*/
PersistentModelIndex(50),
/**
* Representing QVariant:: LastCoreType
*/
LastCoreType(63),
/**
* Representing QVariant:: Font
*/
Font(4096),
/**
* Representing QVariant:: Pixmap
*/
Pixmap(4097),
/**
* Representing QVariant:: Brush
*/
Brush(4098),
/**
* Representing QVariant:: Color
*/
Color(4099),
/**
* Representing QVariant:: Palette
*/
Palette(4100),
/**
* Representing QVariant:: Image
*/
Image(4102),
/**
* Representing QVariant:: Polygon
*/
Polygon(4103),
/**
* Representing QVariant:: Region
*/
Region(4104),
/**
* Representing QVariant:: Bitmap
*/
Bitmap(4105),
/**
* Representing QVariant:: Cursor
*/
Cursor(4106),
/**
* Representing QVariant:: KeySequence
*/
KeySequence(4107),
/**
* Representing QVariant:: Pen
*/
Pen(4108),
/**
* Representing QVariant:: TextLength
*/
TextLength(4109),
/**
* Representing QVariant:: TextFormat
*/
TextFormat(4110),
/**
* Representing QVariant:: Transform
*/
Transform(4112),
/**
* Representing QVariant:: Matrix4x4
*/
Matrix4x4(4113),
/**
* Representing QVariant:: Vector2D
*/
Vector2D(4114),
/**
* Representing QVariant:: Vector3D
*/
Vector3D(4115),
/**
* Representing QVariant:: Vector4D
*/
Vector4D(4116),
/**
* Representing QVariant:: Quaternion
*/
Quaternion(4117),
/**
* Representing QVariant:: PolygonF
*/
PolygonF(4118),
/**
* Representing QVariant:: Icon
*/
Icon(4101),
/**
* Representing QVariant:: LastGuiType
*/
LastGuiType(4119),
/**
* Representing QVariant:: SizePolicy
*/
SizePolicy(8192),
/**
* Representing QVariant:: UserType
*/
UserType(65536),
/**
* Representing QVariant:: LastType
*/
LastType(-1);
static {
QtJambi_LibraryUtilities.initialize();
}
private Type(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
* @throws QNoSuchEnumValueException if value not existent in the enum
*/
public static @NonNull Type resolve(int value) {
switch (value) {
case 0: return Invalid;
case 1: return Bool;
case 2: return Int;
case 3: return UInt;
case 4: return LongLong;
case 5: return ULongLong;
case 6: return Double;
case 7: return Char;
case 8: return Map;
case 9: return List;
case 10: return String;
case 11: return StringList;
case 12: return ByteArray;
case 13: return BitArray;
case 14: return Date;
case 15: return Time;
case 16: return DateTime;
case 17: return Url;
case 18: return Locale;
case 19: return Rect;
case 20: return RectF;
case 21: return Size;
case 22: return SizeF;
case 23: return Line;
case 24: return LineF;
case 25: return Point;
case 26: return PointF;
case 44: return RegularExpression;
case 28: return Hash;
case 29: return EasingCurve;
case 30: return Uuid;
case 42: return ModelIndex;
case 50: return PersistentModelIndex;
case 63: return LastCoreType;
case 4096: return Font;
case 4097: return Pixmap;
case 4098: return Brush;
case 4099: return Color;
case 4100: return Palette;
case 4102: return Image;
case 4103: return Polygon;
case 4104: return Region;
case 4105: return Bitmap;
case 4106: return Cursor;
case 4107: return KeySequence;
case 4108: return Pen;
case 4109: return TextLength;
case 4110: return TextFormat;
case 4112: return Transform;
case 4113: return Matrix4x4;
case 4114: return Vector2D;
case 4115: return Vector3D;
case 4116: return Vector4D;
case 4117: return Quaternion;
case 4118: return PolygonF;
case 4101: return Icon;
case 4119: return LastGuiType;
case 8192: return SizePolicy;
case 65536: return UserType;
case -1: return LastType;
default: return QtJambi_LibraryUtilities.internal.resolveEnum(Type.class, value, null);
}
}
/**
* Returns the corresponding enum entry for the given value and name.
* @param value
* @param name
* @return enum entry
* @throws QNoSuchEnumValueException if value not existent in the enum or name does not match.
*/
public static @NonNull Type resolve(int value, @Nullable String name) {
if(name==null || name.isEmpty())
return resolve(value);
else
return QtJambi_LibraryUtilities.internal.resolveEnum(Type.class, value, name);
}
private final int value;
}
/**
*
*/
public QVariant(){
super((QPrivateConstructor)null);
initialize_native(this);
}
private native static void initialize_native(QVariant instance);
/**
* See QVariant:: QVariant(QBitArray)
*/
public QVariant(io.qt.core.@NonNull QBitArray bitarray){
super((QPrivateConstructor)null);
initialize_native(this, bitarray);
}
private native static void initialize_native(QVariant instance, io.qt.core.QBitArray bitarray);
/**
* See QVariant:: QVariant(QByteArray)
*/
public QVariant(io.qt.core.@NonNull QByteArray bytearray){
super((QPrivateConstructor)null);
initialize_native(this, bytearray);
}
private native static void initialize_native(QVariant instance, io.qt.core.QByteArray bytearray);
/**
*
*/
public QVariant(char qchar){
super((QPrivateConstructor)null);
initialize_native(this, qchar);
}
private native static void initialize_native(QVariant instance, char qchar);
/**
*
*/
public QVariant(io.qt.core.@NonNull QDate date){
super((QPrivateConstructor)null);
initialize_native(this, date);
}
private native static void initialize_native(QVariant instance, io.qt.core.QDate date);
/**
* See QVariant:: QVariant(QDateTime)
*/
public QVariant(io.qt.core.@NonNull QDateTime datetime){
super((QPrivateConstructor)null);
initialize_native(this, datetime);
}
private native static void initialize_native(QVariant instance, io.qt.core.QDateTime datetime);
/**
* See QVariant:: QVariant(QEasingCurve)
*/
public QVariant(io.qt.core.@NonNull QEasingCurve easing){
super((QPrivateConstructor)null);
initialize_native(this, easing);
}
private native static void initialize_native(QVariant instance, io.qt.core.QEasingCurve easing);
/**
* See QVariant:: QVariant(QHash<QString, QVariant>)
*/
public QVariant(java.util.@NonNull Map hash){
super((QPrivateConstructor)null);
initialize_native(this, hash);
}
private native static void initialize_native(QVariant instance, java.util.Map hash);
/**
* See QVariant:: QVariant(QJsonArray)
*/
public QVariant(io.qt.core.@NonNull QJsonArray jsonArray){
super((QPrivateConstructor)null);
initialize_native(this, jsonArray);
}
private native static void initialize_native(QVariant instance, io.qt.core.QJsonArray jsonArray);
/**
* See QVariant:: QVariant(QJsonDocument)
*/
public QVariant(io.qt.core.@NonNull QJsonDocument jsonDocument){
super((QPrivateConstructor)null);
initialize_native(this, jsonDocument);
}
private native static void initialize_native(QVariant instance, io.qt.core.QJsonDocument jsonDocument);
/**
* See QVariant:: QVariant(QJsonObject)
*/
public QVariant(io.qt.core.@NonNull QJsonObject jsonObject){
super((QPrivateConstructor)null);
initialize_native(this, jsonObject);
}
private native static void initialize_native(QVariant instance, io.qt.core.QJsonObject jsonObject);
/**
* See QVariant:: QVariant(QJsonValue)
*/
public QVariant(io.qt.core.@NonNull QJsonValue jsonValue){
super((QPrivateConstructor)null);
initialize_native(this, jsonValue);
}
private native static void initialize_native(QVariant instance, io.qt.core.QJsonValue jsonValue);
/**
*
*/
public QVariant(io.qt.core.@NonNull QLine line){
super((QPrivateConstructor)null);
initialize_native(this, line);
}
private native static void initialize_native(QVariant instance, io.qt.core.QLine line);
/**
* See QVariant:: QVariant(QLineF)
*/
public QVariant(io.qt.core.@NonNull QLineF line){
super((QPrivateConstructor)null);
initialize_native(this, line);
}
private native static void initialize_native(QVariant instance, io.qt.core.QLineF line);
/**
* See QVariant:: QVariant(QList<QVariant>)
*/
public QVariant(java.util.@NonNull Collection extends java.lang.Object> list){
super((QPrivateConstructor)null);
initialize_native(this, list);
}
private native static void initialize_native(QVariant instance, java.util.Collection extends java.lang.Object> list);
/**
* See QVariant:: QVariant(QLocale)
*/
public QVariant(io.qt.core.@NonNull QLocale locale){
super((QPrivateConstructor)null);
initialize_native(this, locale);
}
private native static void initialize_native(QVariant instance, io.qt.core.QLocale locale);
/**
* See QVariant:: QVariant(QMap<QString, QVariant>)
*/
public QVariant(java.util.@Nullable NavigableMap<@NonNull String,? extends @Nullable Object> map){
super((QPrivateConstructor)null);
initialize_native(this, map);
}
private native static void initialize_native(QVariant instance, java.util.NavigableMap<@NonNull String,? extends @Nullable Object> map);
/**
* See QVariant:: QVariant(QMetaType, const void*)
*/
public QVariant(io.qt.core.@NonNull QMetaType type, java.lang.@Nullable Object copy){
super((QPrivateConstructor)null);
initialize_native(this, type, copy);
}
private native static void initialize_native(QVariant instance, io.qt.core.QMetaType type, java.lang.Object copy);
/**
* See QVariant:: QVariant(QModelIndex)
*/
public QVariant(io.qt.core.@NonNull QModelIndex modelIndex){
super((QPrivateConstructor)null);
initialize_native(this, modelIndex);
}
private native static void initialize_native(QVariant instance, io.qt.core.QModelIndex modelIndex);
/**
* See QVariant:: QVariant(QPersistentModelIndex)
*/
public QVariant(io.qt.core.@NonNull QPersistentModelIndex modelIndex){
super((QPrivateConstructor)null);
initialize_native(this, modelIndex);
}
private native static void initialize_native(QVariant instance, io.qt.core.QPersistentModelIndex modelIndex);
/**
* See QVariant:: QVariant(QPoint)
*/
public QVariant(io.qt.core.@NonNull QPoint pt){
super((QPrivateConstructor)null);
initialize_native(this, pt);
}
private native static void initialize_native(QVariant instance, io.qt.core.QPoint pt);
/**
* See QVariant:: QVariant(QPointF)
*/
public QVariant(io.qt.core.@NonNull QPointF pt){
super((QPrivateConstructor)null);
initialize_native(this, pt);
}
private native static void initialize_native(QVariant instance, io.qt.core.QPointF pt);
/**
*
*/
public QVariant(io.qt.core.@NonNull QRect rect){
super((QPrivateConstructor)null);
initialize_native(this, rect);
}
private native static void initialize_native(QVariant instance, io.qt.core.QRect rect);
/**
* See QVariant:: QVariant(QRectF)
*/
public QVariant(io.qt.core.@NonNull QRectF rect){
super((QPrivateConstructor)null);
initialize_native(this, rect);
}
private native static void initialize_native(QVariant instance, io.qt.core.QRectF rect);
/**
* See QVariant:: QVariant(QRegularExpression)
*/
public QVariant(io.qt.core.@NonNull QRegularExpression re){
super((QPrivateConstructor)null);
initialize_native(this, re);
}
private native static void initialize_native(QVariant instance, io.qt.core.QRegularExpression re);
/**
*
*/
public QVariant(io.qt.core.@NonNull QSize size){
super((QPrivateConstructor)null);
initialize_native(this, size);
}
private native static void initialize_native(QVariant instance, io.qt.core.QSize size);
/**
* See QVariant:: QVariant(QSizeF)
*/
public QVariant(io.qt.core.@NonNull QSizeF size){
super((QPrivateConstructor)null);
initialize_native(this, size);
}
private native static void initialize_native(QVariant instance, io.qt.core.QSizeF size);
/**
* See QVariant:: QVariant(QString)
*/
public QVariant(java.lang.@NonNull String string){
super((QPrivateConstructor)null);
initialize_native(this, string);
}
private native static void initialize_native(QVariant instance, java.lang.String string);
/**
*
*/
public QVariant(io.qt.core.@NonNull QTime time){
super((QPrivateConstructor)null);
initialize_native(this, time);
}
private native static void initialize_native(QVariant instance, io.qt.core.QTime time);
/**
*
*/
public QVariant(io.qt.core.@NonNull QUrl url){
super((QPrivateConstructor)null);
initialize_native(this, url);
}
private native static void initialize_native(QVariant instance, io.qt.core.QUrl url);
/**
*
*/
public QVariant(io.qt.core.@NonNull QUuid uuid){
super((QPrivateConstructor)null);
initialize_native(this, uuid);
}
private native static void initialize_native(QVariant instance, io.qt.core.QUuid uuid);
/**
* See QVariant:: QVariant(QVariant)
*/
public QVariant(java.lang.@Nullable Object other){
super((QPrivateConstructor)null);
initialize_native(this, other);
}
private native static void initialize_native(QVariant instance, java.lang.Object other);
/**
* See QVariant:: QVariant(QVariant::Type)
*
* @deprecated Use the constructor taking a QMetaType instead.
*/
@Deprecated
public QVariant(io.qt.core.QVariant.@NonNull Type type){
super((QPrivateConstructor)null);
initialize_native(this, type);
}
@Deprecated
private native static void initialize_native(QVariant instance, io.qt.core.QVariant.Type type);
/**
*
*/
public QVariant(boolean b){
super((QPrivateConstructor)null);
initialize_native(this, b);
}
private native static void initialize_native(QVariant instance, boolean b);
/**
* See QVariant:: QVariant(double)
*/
public QVariant(double d){
super((QPrivateConstructor)null);
initialize_native(this, d);
}
private native static void initialize_native(QVariant instance, double d);
/**
*
*/
public QVariant(float f){
super((QPrivateConstructor)null);
initialize_native(this, f);
}
private native static void initialize_native(QVariant instance, float f);
/**
*
*/
public QVariant(int i){
super((QPrivateConstructor)null);
initialize_native(this, i);
}
private native static void initialize_native(QVariant instance, int i);
/**
* See QVariant:: QVariant(qlonglong)
*/
public QVariant(long ll){
super((QPrivateConstructor)null);
initialize_native(this, ll);
}
private native static void initialize_native(QVariant instance, long ll);
/**
* See QVariant:: canConvert(QMetaType)const
*/
@QtUninvokable
public final boolean canConvert(io.qt.core.@NonNull QMetaType targetType){
return canConvert_native_QMetaType_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(targetType));
}
@QtUninvokable
private native boolean canConvert_native_QMetaType_constfct(long __this__nativeId, long targetType);
/**
* See QVariant:: canConvert(int)const
*/
@Deprecated
@QtUninvokable
public final boolean canConvert(int targetTypeId){
return canConvert_native_int_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), targetTypeId);
}
@Deprecated
@QtUninvokable
private native boolean canConvert_native_int_constfct(long __this__nativeId, int targetTypeId);
/**
*
*/
@QtUninvokable
public final void clear(){
clear_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native void clear_native(long __this__nativeId);
/**
* See QVariant:: convert(QMetaType)
*/
@QtUninvokable
public final boolean convert(io.qt.core.@NonNull QMetaType type){
return convert_native_QMetaType(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(type));
}
@QtUninvokable
private native boolean convert_native_QMetaType(long __this__nativeId, long type);
/**
*
*/
@Deprecated
@QtUninvokable
public final boolean convert(int targetTypeId){
return convert_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), targetTypeId);
}
@Deprecated
@QtUninvokable
private native boolean convert_native_int(long __this__nativeId, int targetTypeId);
/**
* See QVariant:: convert(int, void*)const
*/
@QtUninvokable
protected final java.util.@NonNull Optional<@Nullable Object> convertTo(int type){
return convertTo_native_int_void_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), type);
}
@QtUninvokable
private native java.util.@NonNull Optional<@Nullable Object> convertTo_native_int_void_ptr_constfct(long __this__nativeId, int type);
/**
* See QVariant:: create(QMetaType, const void*)
*/
@QtUninvokable
protected final void create(io.qt.core.@NonNull QMetaType type, java.lang.@Nullable Object copy){
copy = QMetaType.cast(type.javaType(), copy);
create_native_QMetaType_const_void_ptr(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(type), copy);
}
@QtUninvokable
private native void create_native_QMetaType_const_void_ptr(long __this__nativeId, long type, java.lang.Object copy);
/**
* See QVariant:: create(int, const void*)
*/
@QtUninvokable
protected final void create(int type, java.lang.@Nullable Object copy){
copy = QMetaType.cast(QMetaType.javaType(type), copy);
create_native_int_const_void_ptr(QtJambi_LibraryUtilities.internal.nativeId(this), type, copy);
}
@QtUninvokable
private native void create_native_int_const_void_ptr(long __this__nativeId, int type, java.lang.Object copy);
/**
*
*/
@QtUninvokable
public final java.lang.@Nullable Object value(){
return value_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.@Nullable Object value_native_constfct(long __this__nativeId);
/**
* See QVariant:: detach()
*/
@QtUninvokable
public final void detach(){
detach_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native void detach_native(long __this__nativeId);
/**
* See QVariant:: isDetached()const
*/
@QtUninvokable
public final boolean isDetached(){
return isDetached_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isDetached_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean isNull(){
return isNull_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isNull_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean isValid(){
return isValid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean isValid_native_constfct(long __this__nativeId);
/**
* See QVariant:: load(QDataStream&)
*/
@QtUninvokable
public final void load(io.qt.core.@StrictNonNull QDataStream ds){
java.util.Objects.requireNonNull(ds, "Argument 'ds': null not expected.");
load_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(ds));
}
@QtUninvokable
private native void load_native_ref_QDataStream(long __this__nativeId, long ds);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QMetaType metaType(){
return metaType_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QMetaType metaType_native_constfct(long __this__nativeId);
/**
* See operator<<(QDataStream&, QVariant)
*/
@QtUninvokable
public void writeTo(io.qt.core.@StrictNonNull QDataStream s){
java.util.Objects.requireNonNull(s, "Argument 's': null not expected.");
writeTo_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(s));
}
@QtUninvokable
private native void writeTo_native_ref_QDataStream(long __this__nativeId, long s);
/**
* See QVariant:: operator=(QVariant)
*/
@QtUninvokable
public final void assign(io.qt.core.@NonNull QVariant other){
assign_native_cref_QVariant(QtJambi_LibraryUtilities.internal.nativeId(this), other);
}
@QtUninvokable
private native void assign_native_cref_QVariant(long __this__nativeId, io.qt.core.QVariant other);
/**
* See operator==(QVariant, QVariant)
*/
@QtUninvokable
public final boolean equals(io.qt.core.@NonNull QVariant b){
return equals_native_cref_QVariant(QtJambi_LibraryUtilities.internal.nativeId(this), b);
}
@QtUninvokable
private native boolean equals_native_cref_QVariant(long __this__nativeId, io.qt.core.QVariant b);
/**
* See operator>>(QDataStream&, QVariant&)
*/
@QtUninvokable
public void readFrom(io.qt.core.@StrictNonNull QDataStream s){
java.util.Objects.requireNonNull(s, "Argument 's': null not expected.");
readFrom_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(s));
}
@QtUninvokable
private native void readFrom_native_ref_QDataStream(long __this__nativeId, long s);
/**
* See QVariant:: save(QDataStream&)const
*/
@QtUninvokable
public final void save(io.qt.core.@StrictNonNull QDataStream ds){
java.util.Objects.requireNonNull(ds, "Argument 'ds': null not expected.");
save_native_ref_QDataStream_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(ds));
}
@QtUninvokable
private native void save_native_ref_QDataStream_constfct(long __this__nativeId, long ds);
/**
* See QVariant:: setValue(QVariant)
*/
@QtUninvokable
public final void setValue(java.lang.@Nullable Object avalue){
setValue_native_cref_QVariant(QtJambi_LibraryUtilities.internal.nativeId(this), avalue);
}
@QtUninvokable
private native void setValue_native_cref_QVariant(long __this__nativeId, java.lang.Object avalue);
/**
*
*/
@QtUninvokable
public final void swap(io.qt.core.@StrictNonNull QVariant other){
java.util.Objects.requireNonNull(other, "Argument 'other': null not expected.");
swap_native_ref_QVariant(QtJambi_LibraryUtilities.internal.nativeId(this), other);
}
@QtUninvokable
private native void swap_native_ref_QVariant(long __this__nativeId, io.qt.core.QVariant other);
/**
* See QVariant:: toBitArray()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QBitArray toBitArray(){
return toBitArray_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QBitArray toBitArray_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final boolean toBoolean(){
return toBoolean_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean toBoolean_native_constfct(long __this__nativeId);
/**
* See QVariant:: toByteArray()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QByteArray toByteArray(){
return toByteArray_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QByteArray toByteArray_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final char toChar(){
return toChar_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native char toChar_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QDate toDate(){
return toDate_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QDate toDate_native_constfct(long __this__nativeId);
/**
* See QVariant:: toDateTime()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QDateTime toDateTime(){
return toDateTime_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QDateTime toDateTime_native_constfct(long __this__nativeId);
/**
* See QVariant:: toDouble(bool*)const
*/
@QtUninvokable
public final double toDouble(boolean[] ok){
if(ok!=null && ok.length < 1)
throw new IllegalArgumentException("Argument 'ok': Wrong number of elements in array. Found: " + ok.length + ", expected: 1");
return toDouble_native_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), ok);
}
@QtUninvokable
private native double toDouble_native_bool_ptr_constfct(long __this__nativeId, boolean[] ok);
/**
* See QVariant:: toEasingCurve()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QEasingCurve toEasingCurve(){
return toEasingCurve_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QEasingCurve toEasingCurve_native_constfct(long __this__nativeId);
/**
* See QVariant:: toFloat(bool*)const
*/
@QtUninvokable
public final float toFloat(boolean[] ok){
if(ok!=null && ok.length < 1)
throw new IllegalArgumentException("Argument 'ok': Wrong number of elements in array. Found: " + ok.length + ", expected: 1");
return toFloat_native_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), ok);
}
@QtUninvokable
private native float toFloat_native_bool_ptr_constfct(long __this__nativeId, boolean[] ok);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QHash toHash(){
return toHash_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QHash toHash_native_constfct(long __this__nativeId);
/**
* See QVariant:: toInt(bool*)const
*/
@QtUninvokable
public final int toInt(boolean[] ok){
if(ok!=null && ok.length < 1)
throw new IllegalArgumentException("Argument 'ok': Wrong number of elements in array. Found: " + ok.length + ", expected: 1");
return toInt_native_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), ok);
}
@QtUninvokable
private native int toInt_native_bool_ptr_constfct(long __this__nativeId, boolean[] ok);
/**
* See QVariant:: toJsonArray()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonArray toJsonArray(){
return toJsonArray_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonArray toJsonArray_native_constfct(long __this__nativeId);
/**
* See QVariant:: toJsonDocument()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonDocument toJsonDocument(){
return toJsonDocument_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonDocument toJsonDocument_native_constfct(long __this__nativeId);
/**
* See QVariant:: toJsonObject()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonObject toJsonObject(){
return toJsonObject_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonObject toJsonObject_native_constfct(long __this__nativeId);
/**
* See QVariant:: toJsonValue()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QJsonValue toJsonValue(){
return toJsonValue_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QJsonValue toJsonValue_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QLine toLine(){
return toLine_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QLine toLine_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QLineF toLineF(){
return toLineF_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QLineF toLineF_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QList toList(){
return toList_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QList toList_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QLocale toLocale(){
return toLocale_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QLocale toLocale_native_constfct(long __this__nativeId);
/**
* See QVariant:: toLongLong(bool*)const
*/
@QtUninvokable
public final long toLong(boolean[] ok){
if(ok!=null && ok.length < 1)
throw new IllegalArgumentException("Argument 'ok': Wrong number of elements in array. Found: " + ok.length + ", expected: 1");
return toLong_native_bool_ptr_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), ok);
}
@QtUninvokable
private native long toLong_native_bool_ptr_constfct(long __this__nativeId, boolean[] ok);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QMap toMap(){
return toMap_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QMap toMap_native_constfct(long __this__nativeId);
/**
* See QVariant:: toModelIndex()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QModelIndex toModelIndex(){
return toModelIndex_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QModelIndex toModelIndex_native_constfct(long __this__nativeId);
/**
* See QVariant:: toPersistentModelIndex()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QPersistentModelIndex toPersistentModelIndex(){
return toPersistentModelIndex_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QPersistentModelIndex toPersistentModelIndex_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QPoint toPoint(){
return toPoint_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QPoint toPoint_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QPointF toPointF(){
return toPointF_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QPointF toPointF_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QRect toRect(){
return toRect_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QRect toRect_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QRectF toRectF(){
return toRectF_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QRectF toRectF_native_constfct(long __this__nativeId);
/**
* See QVariant:: toRegularExpression()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QRegularExpression toRegularExpression(){
return toRegularExpression_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QRegularExpression toRegularExpression_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QSize toSize(){
return toSize_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QSize toSize_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QSizeF toSizeF(){
return toSizeF_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QSizeF toSizeF_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final java.lang.@NonNull String toString(){
return toString_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String toString_native_constfct(long __this__nativeId);
/**
* See QVariant:: toStringList()const
*/
@QtUninvokable
public final io.qt.core.@NonNull QStringList toStringList(){
return toStringList_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QStringList toStringList_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QTime toTime(){
return toTime_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QTime toTime_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QUrl toUrl(){
return toUrl_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QUrl toUrl_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.core.@NonNull QUuid toUuid(){
return toUuid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QUuid toUuid_native_constfct(long __this__nativeId);
/**
* See QVariant:: type()const
*
* @deprecated Use typeId() or metaType().
*/
@Deprecated
@QtUninvokable
public final io.qt.core.QVariant.@NonNull Type type(){
return io.qt.core.QVariant.Type.resolve(type_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@Deprecated
@QtUninvokable
private native int type_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final int typeId(){
return typeId_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native int typeId_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final java.lang.@Nullable String typeName(){
return typeName_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String typeName_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final int userType(){
return userType_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native int userType_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final T value(java.lang.Class clazz, io.qt.core.QMetaType... instantiations){
return value_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this), clazz, instantiations);
}
@QtUninvokable
private native T value_native_constfct(long __this__nativeId, java.lang.Class clazz, io.qt.core.QMetaType... instantiations);
/**
* See QVariant:: compare(QVariant, QVariant)
*/
public static int compare(io.qt.core.@NonNull QVariant lhs, io.qt.core.@NonNull QVariant rhs){
return compare_native_cref_QVariant_cref_QVariant(lhs, rhs);
}
private native static int compare_native_cref_QVariant_cref_QVariant(io.qt.core.QVariant lhs, io.qt.core.QVariant rhs);
/**
* See QVariant:: fromMetaType(QMetaType, const void*)
*/
public static io.qt.core.@NonNull QVariant fromMetaType(io.qt.core.@NonNull QMetaType type, java.lang.@Nullable Object copy){
return fromMetaType_native_QMetaType_const_void_ptr(QtJambi_LibraryUtilities.internal.checkedNativeId(type), copy);
}
private native static io.qt.core.QVariant fromMetaType_native_QMetaType_const_void_ptr(long type, java.lang.Object copy);
/**
*
*/
public native static io.qt.core.@StrictNonNull QVariant fromValue(T value);
/**
* See QVariant:: nameToType(const char*)
*/
@Deprecated
public static io.qt.core.QVariant.@NonNull Type nameToType(java.lang.@Nullable String name){
return io.qt.core.QVariant.Type.resolve(nameToType_native_const_char_ptr(name));
}
@Deprecated
private native static int nameToType_native_const_char_ptr(java.lang.String name);
/**
* See QVariant:: typeToName(int)
*/
@Deprecated
public native static java.lang.@Nullable String typeToName(int typeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QVariant(QPrivateConstructor p) { super(p); }
/**
* See operator==(QVariant, QVariant)
*/
@Override
@QtUninvokable
public boolean equals(Object other) {
if (other instanceof io.qt.core.QVariant) {
return equals((io.qt.core.QVariant) other);
}
return false;
}
/**
* Returns the objects's hash code computed by qHash(QVariant)
.
*/
@QtUninvokable
@Override
public int hashCode() {
return 0;
}
/**
* Create a variant for the native nullptr type.
*/
public static QVariant nullVariant() {
return new QVariant(QMetaType.Type.Nullptr);
}
static Class> getComplexType(Class> primitiveType) {
if (primitiveType == int.class)
return Integer.class;
else if (primitiveType == double.class)
return Double.class;
else if (primitiveType == long.class)
return Long.class;
else if (primitiveType == float.class)
return Float.class;
else if (primitiveType == short.class)
return Short.class;
else if (primitiveType == boolean.class)
return Boolean.class;
else if (primitiveType == char.class)
return Character.class;
else if (primitiveType == byte.class)
return Byte.class;
else
return primitiveType;
}
/**
* Use {@link QMetaType#fromObject(Object)} instead.
*/
@Deprecated
public static int type(@Nullable Object obj) {
return QMetaType.fromObject(obj).id();
}
/**
* Convenient static function for type conversion.
* @see {@link #convert(QMetaType)}
*/
@SuppressWarnings("unchecked")
public static T convert(@Nullable Object obj, @StrictNonNull Class cl, @StrictNonNull QMetaType @StrictNonNull... instantiations) {
boolean[] ok = {false};
Object result = convert(obj, QMetaType.fromType(cl, instantiations), ok);
Class> _cl = cl.isPrimitive() ? getComplexType(cl) : cl;
return (ok[0] || _cl.isInstance(result)) ? (T)result : null;
}
/**
* Use {@link #isValid()} instead.
*/
@Deprecated
public static boolean isValid(@Nullable Object variant) {
return new QVariant(variant).isValid();
}
private static Class> dbusVariant;
private static boolean dbusVariantResolved;
private static boolean isDBusVariant(Object value, Class > cl) {
if(!dbusVariantResolved) {
dbusVariantResolved = true;
Class> _dbusVariant = null;
try {
_dbusVariant = Class.forName("io.qt.dbus.QDBusVariant");
} catch (Exception e) {
}
dbusVariant = _dbusVariant;
}
return dbusVariant!=null && cl!=dbusVariant && dbusVariant.isInstance(value);
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static > boolean canConvertToEnum(@StrictNonNull Class enumClass, @Nullable Object obj)
{
if(enumClass.isInstance(obj)) {
return true;
}else {
QVariant variant = new QVariant(obj);
if(QtEnumerator.class.isAssignableFrom(enumClass)
|| QtByteEnumerator.class.isAssignableFrom(enumClass)
|| QtShortEnumerator.class.isAssignableFrom(enumClass)) {
return variant.canConvert(QMetaType.Type.Int);
}else if(QtLongEnumerator.class.isAssignableFrom(enumClass)) {
return variant.canConvert(QMetaType.Type.Long);
}else if (variant.canConvert(QMetaType.Type.Int)) {
boolean[] ok = {false};
int value = variant.toInt(ok);
E[] constants = enumClass.getEnumConstants();
return constants!=null && ok[0] && value> E toEnum(@StrictNonNull Class enumClass, @Nullable Object obj) {
return toEnum(enumClass, obj, (boolean[])null);
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static > E toEnum(@StrictNonNull Class enumClass, @Nullable Object obj, boolean @Nullable[] ok) {
if(enumClass.isInstance(obj)) {
try {
if(ok!=null && ok.length>0)
ok[0] = true;
return enumClass.cast(obj);
} catch (Exception e) {
}
}else {
QVariant variant = new QVariant(obj);
if(QtEnumerator.class.isAssignableFrom(enumClass)) {
try {
java.lang.reflect.Method resolveMethod = enumClass.getMethod("resolve", int.class);
int value = variant.toInt(ok);
if(ok==null || ok[0])
return enumClass.cast(resolveMethod.invoke(null, value));
} catch (Exception e) {
}
}else if(QtByteEnumerator.class.isAssignableFrom(enumClass)) {
try {
java.lang.reflect.Method resolveMethod = enumClass.getMethod("resolve", byte.class);
int value = variant.toInt(ok);
if(ok==null || ok[0])
return enumClass.cast(resolveMethod.invoke(null, (byte)value));
} catch (Exception e) {
}
}else if(QtShortEnumerator.class.isAssignableFrom(enumClass)) {
try {
java.lang.reflect.Method resolveMethod = enumClass.getMethod("resolve", short.class);
int value = variant.toInt(ok);
if(ok==null || ok[0])
return enumClass.cast(resolveMethod.invoke(null, value));
} catch (Exception e) {
}
}else if(QtLongEnumerator.class.isAssignableFrom(enumClass)) {
try {
java.lang.reflect.Method resolveMethod = enumClass.getMethod("resolve", long.class);
long value = variant.toLong(ok);
if(ok==null || ok[0])
return enumClass.cast(resolveMethod.invoke(null, value));
} catch (Exception e) {
}
}else{
int value = variant.toInt(ok);
E[] constants = enumClass.getEnumConstants();
if(constants!=null && (ok==null || value0)
ok[0] = false;
return null;
}
/**
* Convenient static function for type conversion.
* @see {@link #convert(QMetaType)}
*/
public static > F toFlags(@StrictNonNull Class flagsClass, @Nullable Object obj) {
return toFlags(flagsClass, obj, null);
}
/**
* Convenient static function for type conversion.
* @see {@link #convert(QMetaType)}
*/
public static > F toFlags(@StrictNonNull Class flagsClass, @Nullable Object obj, boolean @Nullable[] ok) {
if(flagsClass.isInstance(obj)) {
try{
if(ok!=null && ok.length>0)
ok[0] = true;
return flagsClass.cast(obj);
} catch (Exception e) {
}
}else {
QVariant variant = new QVariant(obj);
int value = variant.toInt(ok);
if(ok==null || ok[0]){
try{
return flagsClass.getConstructor(int.class).newInstance(value);
} catch (Exception e) {
}
}
}
if(ok!=null && ok.length>0)
ok[0] = false;
return null;
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToDouble(@Nullable Object obj){
return obj instanceof Number || canConvert(obj, QMetaType.Type.Double);
}
/**
* Convenient static function for type conversion.
* @see {@link #toDouble()}
*/
public static double toDouble(@Nullable Object obj) { return toDouble(obj, null); }
/**
* Convenient static function for type conversion.
* @see {@link #toDouble()}
*/
public static double toDouble(@Nullable Object obj, boolean @Nullable[] ok){
if (obj==null) {
if(ok!=null && ok.length>0)
ok[0] = true;
return 0.0;
} else if (obj instanceof Number) {
if(ok!=null && ok.length>0)
ok[0] = true;
return ((Number) obj).doubleValue();
} else {
QVariant variant = new QVariant(obj);
return variant.toDouble(ok);
}
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToFloat(@Nullable Object obj){
return obj instanceof Number || canConvert(obj, QMetaType.Type.Float);
}
/**
* Convenient static function for type conversion.
* @see {@link #toFloat()}
*/
public static float toFloat(@Nullable Object obj) { return toFloat(obj, null); }
/**
* Convenient static function for type conversion.
* @see {@link #toFloat()}
*/
public static float toFloat(@Nullable Object obj, boolean @Nullable[] ok){
if (obj==null) {
if(ok!=null && ok.length>0)
ok[0] = true;
return 0.f;
} else if (obj instanceof Float) {
if(ok!=null && ok.length>0)
ok[0] = true;
return (Float)obj;
} else if (obj instanceof Number) {
if(ok!=null && ok.length>0)
ok[0] = true;
return ((Number) obj).floatValue();
} else {
QVariant variant = new QVariant(obj);
return variant.toFloat(ok);
}
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToString(@Nullable Object obj){
return true;
}
/**
* Convenient static function for type conversion.
* @see {@link #toString()}
*/
public static @NonNull String toString(@Nullable Object obj){
return obj==null ? new String() : ""+obj;
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToBoolean(@Nullable Object obj){
return obj instanceof Boolean || obj instanceof Number || canConvert(obj, QMetaType.Type.Bool);
}
/**
* Convenient static function for type conversion.
* @see {@link #toBoolean()}
*/
public static boolean toBoolean(@Nullable Object obj){
if (obj==null) {
return false;
} else if (obj instanceof Boolean) {
return (Boolean) obj;
} else if (obj instanceof Number) {
return ((Number) obj).intValue() != 0;
} else {
return new QVariant(obj).toBoolean();
}
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToByteArray(@Nullable Object obj){
return obj instanceof QByteArray || canConvert(obj, QMetaType.Type.QByteArray);
}
/**
* Convenient static function for type conversion.
* @see {@link #toByteArray()}
*/
public static @NonNull QByteArray toByteArray(@Nullable Object obj)
{
if(obj instanceof QByteArray) {
if(!((QtObjectInterface)obj).isDisposed())
return (QByteArray)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QByteArray);
if(returned instanceof QByteArray) {
return (QByteArray)returned;
}
}
return new QByteArray();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToBitArray(@Nullable Object obj)
{
return obj instanceof QBitArray || canConvert(obj, QMetaType.Type.QBitArray);
}
/**
* Convenient static function for type conversion.
* @see {@link #toBitArray()}
*/
public static @NonNull QBitArray toBitArray(@Nullable Object obj)
{
if(obj instanceof QBitArray) {
if(!((QtObjectInterface)obj).isDisposed())
return (QBitArray)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QBitArray);
if(returned instanceof QBitArray) {
return (QBitArray)returned;
}
}
return new QBitArray();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToChar(@Nullable Object obj)
{
return obj instanceof Character || canConvert(obj, QMetaType.Type.QChar);
}
/**
* Convenient static function for type conversion.
* @see {@link #toChar()}
*/
public static char toChar(@Nullable Object obj)
{
if(obj==null)
return 0;
else if (obj instanceof Character)
return (Character) obj;
else
return new QVariant(obj).toChar();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToDate(@Nullable Object obj)
{
return obj instanceof QDate || canConvert(obj, QMetaType.Type.QDate);
}
/**
* Convenient static function for type conversion.
* @see {@link #toDate()}
*/
public static @NonNull QDate toDate(@Nullable Object obj)
{
if(obj instanceof QDate) {
if(!((QtObjectInterface)obj).isDisposed())
return (QDate)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QDate);
if(returned instanceof QDate) {
return (QDate)returned;
}
}
return new QDate();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToDateTime(@Nullable Object obj)
{
return obj instanceof QDateTime || canConvert(obj, QMetaType.Type.QDateTime);
}
/**
* Convenient static function for type conversion.
* @see {@link #toDateTime()}
*/
public static @NonNull QDateTime toDateTime(@Nullable Object obj)
{
if(obj instanceof QDateTime) {
if(!((QtObjectInterface)obj).isDisposed())
return (QDateTime)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QDateTime);
if(returned instanceof QDateTime) {
return (QDateTime)returned;
}
}
return new QDateTime();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToInt(@Nullable Object obj)
{
return obj instanceof Number || canConvert(obj, QMetaType.Type.Int);
}
/**
* Convenient static function for type conversion.
* @see {@link #toInt()}
*/
public static int toInt(@Nullable Object obj) { return toInt(obj, null); }
/**
* Convenient static function for type conversion.
* @see {@link #toFloat()}
*/
public static int toInt(@Nullable Object obj, boolean @Nullable[] ok){
if(obj==null) {
if(ok!=null && ok.length>0)
ok[0] = true;
return 0;
}else if (obj instanceof Number) {
if(ok!=null && ok.length>0)
ok[0] = true;
return ((Number) obj).intValue();
} else {
QVariant variant = new QVariant(obj);
return variant.toInt(ok);
}
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToLine(@Nullable Object obj)
{
return obj instanceof QLine || canConvert(obj, QMetaType.Type.QLine);
}
/**
* Convenient static function for type conversion.
* @see {@link #toLine()}
*/
public static @NonNull QLine toLine(@Nullable Object obj)
{
if(obj instanceof QLine) {
if(!((QtObjectInterface)obj).isDisposed())
return (QLine)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QLine);
if(returned instanceof QLine) {
return (QLine)returned;
}
}
return new QLine();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToLineF(@Nullable Object obj)
{
return obj instanceof QLineF || canConvert(obj, QMetaType.Type.QLineF);
}
/**
* Convenient static function for type conversion.
* @see {@link #toLineF()}
*/
public static @NonNull QLineF toLineF(@Nullable Object obj)
{
if(obj instanceof QLineF) {
if(!((QtObjectInterface)obj).isDisposed())
return (QLineF)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QLineF);
if(returned instanceof QLineF) {
return (QLineF)returned;
}
}
return new QLineF();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToLocale(@Nullable Object obj)
{
return obj instanceof QLocale || canConvert(obj, QMetaType.Type.QLocale);
}
/**
* Convenient static function for type conversion.
* @see {@link #toLocale()}
*/
public static @NonNull QLocale toLocale(@Nullable Object obj)
{
if(obj instanceof QLocale) {
if(!((QtObjectInterface)obj).isDisposed())
return (QLocale)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QLocale);
if(returned instanceof QLocale) {
return (QLocale)returned;
}
}
return new QLocale();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToPoint(@Nullable Object obj)
{
return obj instanceof QPoint || canConvert(obj, QMetaType.Type.QPoint);
}
/**
* Convenient static function for type conversion.
* @see {@link #toPoint()}
*/
public static @NonNull QPoint toPoint(@Nullable Object obj)
{
if(obj instanceof QPoint) {
if(!((QtObjectInterface)obj).isDisposed())
return (QPoint)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QPoint);
if(returned instanceof QPoint) {
return (QPoint)returned;
}
}
return new QPoint();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToPointF(@Nullable Object obj)
{
return obj instanceof QPointF || canConvert(obj, QMetaType.Type.QPointF);
}
/**
* Convenient static function for type conversion.
* @see {@link #toPointF()}
*/
public static @NonNull QPointF toPointF(@Nullable Object obj)
{
if(obj instanceof QPointF) {
if(!((QtObjectInterface)obj).isDisposed())
return (QPointF)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QPointF);
if(returned instanceof QPointF) {
return (QPointF)returned;
}
}
return new QPointF();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToRect(@Nullable Object obj)
{
return obj instanceof QRect || canConvert(obj, QMetaType.Type.QRect);
}
/**
* Convenient static function for type conversion.
* @see {@link #toRect()}
*/
public static @NonNull QRect toRect(@Nullable Object obj)
{
if(obj instanceof QRect) {
if(!((QtObjectInterface)obj).isDisposed())
return (QRect)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QRect);
if(returned instanceof QRect) {
return (QRect)returned;
}
}
return new QRect();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToRectF(@Nullable Object obj)
{
return obj instanceof QRectF || canConvert(obj, QMetaType.Type.QRectF);
}
/**
* Convenient static function for type conversion.
* @see {@link #toRectF()}
*/
public static @NonNull QRectF toRectF(@Nullable Object obj)
{
if(obj instanceof QRectF) {
if(!((QtObjectInterface)obj).isDisposed())
return (QRectF)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QRectF);
if(returned instanceof QRectF) {
return (QRectF)returned;
}
}
return new QRectF();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToRegularExpression(@Nullable Object obj)
{
return obj instanceof QRegularExpression || canConvert(obj, QMetaType.Type.QRegularExpression);
}
/**
* Convenient static function for type conversion.
* @see {@link #toRegularExpression()}
*/
public static @NonNull QRegularExpression toRegularExpression(@Nullable Object obj)
{
if(obj instanceof QRegularExpression) {
if(!((QtObjectInterface)obj).isDisposed())
return (QRegularExpression)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QRegularExpression);
if(returned instanceof QRegularExpression) {
return (QRegularExpression)returned;
}
}
return new QRegularExpression();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToSize(@Nullable Object obj)
{
return obj instanceof QSize || canConvert(obj, QMetaType.Type.QSize);
}
/**
* Convenient static function for type conversion.
* @see {@link #toSize()}
*/
public static @NonNull QSize toSize(@Nullable Object obj)
{
if(obj instanceof QSize) {
if(!((QtObjectInterface)obj).isDisposed())
return (QSize)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QSize);
if(returned instanceof QSize) {
return (QSize)returned;
}
}
return new QSize();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToSizeF(@Nullable Object obj)
{
return obj instanceof QSizeF || canConvert(obj, QMetaType.Type.QSizeF);
}
/**
* Convenient static function for type conversion.
* @see {@link #toSizeF()}
*/
public static @NonNull QSizeF toSizeF(@Nullable Object obj)
{
if(obj instanceof QSizeF) {
if(!((QtObjectInterface)obj).isDisposed())
return (QSizeF)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QSizeF);
if(returned instanceof QSizeF) {
return (QSizeF)returned;
}
}
return new QSizeF();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToTime(@Nullable Object obj)
{
return obj instanceof QTime || canConvert(obj, QMetaType.Type.QTime);
}
/**
* Convenient static function for type conversion.
* @see {@link #toTime()}
*/
public static @NonNull QTime toTime(@Nullable Object obj)
{
if(obj instanceof QTime) {
if(!((QtObjectInterface)obj).isDisposed())
return (QTime)obj;
}else if(obj!=null){
Object returned = convert(obj, QMetaType.Type.QTime);
if(returned instanceof QTime) {
return (QTime)returned;
}
}
return new QTime();
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToLong(@Nullable Object obj)
{
return obj instanceof Number || canConvert(obj, QMetaType.Type.LongLong);
}
/**
* Convenient static function for type conversion.
* @see {@link #toLong()}
*/
public static long toLong(@Nullable Object obj, boolean @Nullable[] ok){
if(obj==null) {
if(ok!=null && ok.length>0)
ok[0] = true;
return 0L;
}else if (obj instanceof Number) {
if(ok!=null && ok.length>0)
ok[0] = true;
return ((Number) obj).longValue();
} else {
QVariant variant = new QVariant(obj);
return variant.toLong(ok);
}
}
/**
* Convenient static function for type conversion.
* @see {@link #canConvert(QMetaType)}
*/
public static boolean canConvertToList(@Nullable Object obj)
{
return obj instanceof java.util.Collection || canConvert(obj, QMetaType.Type.QVariantList);
}
/**
* Convenient static function for type conversion.
* @see {@link #toList()}
*/
@SuppressWarnings("unchecked")
public static @NonNull QList<@Nullable Object> toList(@Nullable Object obj)
{
if (obj instanceof java.util.Collection){
if (obj instanceof QList && ((QList>)obj).elementMetaType().javaType()==Object.class)
return (QList