41 case QVariant::Invalid:
44 return QObject::tr(
"Boolean" );
46 return QObject::tr(
"Integer (32 bit)" );
48 return QObject::tr(
"Integer (unsigned 32 bit)" );
49 case QVariant::LongLong:
50 return QObject::tr(
"Integer (64 bit)" );
51 case QVariant::ULongLong:
52 return QObject::tr(
"Integer (unsigned 64 bit)" );
53 case QVariant::Double:
54 return QObject::tr(
"Decimal (double)" );
56 return QObject::tr(
"Character" );
58 return QObject::tr(
"Map" );
64 return QObject::tr(
"Integer List" );
65 case QVariant::LongLong:
66 return QObject::tr(
"Integer (64 bit) List" );
67 case QVariant::Double:
68 return QObject::tr(
"Decimal (double) List" );
70 return QObject::tr(
"List" );
73 case QVariant::String:
74 return QObject::tr(
"Text (string)" );
75 case QVariant::StringList:
76 return QObject::tr(
"String List" );
77 case QVariant::ByteArray:
78 return QObject::tr(
"Binary Object (BLOB)" );
79 case QVariant::BitArray:
80 return QObject::tr(
"Bit Array" );
82 return QObject::tr(
"Date" );
84 return QObject::tr(
"Time" );
85 case QVariant::DateTime:
86 return QObject::tr(
"Date & Time" );
88 return QObject::tr(
"URL" );
89 case QVariant::Locale:
90 return QObject::tr(
"Locale" );
93 return QObject::tr(
"Rectangle" );
96 return QObject::tr(
"Size" );
99 return QObject::tr(
"Line" );
100 case QVariant::Point:
101 case QVariant::PointF:
102 return QObject::tr(
"Point" );
103 case QVariant::RegularExpression:
104 return QObject::tr(
"Regular Expression" );
106 return QObject::tr(
"Hash" );
107 case QVariant::EasingCurve:
108 return QObject::tr(
"Easing Curve" );
110 return QObject::tr(
"UUID" );
111 case QVariant::ModelIndex:
112 case QVariant::PersistentModelIndex:
113 return QObject::tr(
"Model Index" );
115 return QObject::tr(
"Font" );
116 case QVariant::Pixmap:
117 return QObject::tr(
"Pixmap" );
118 case QVariant::Brush:
119 return QObject::tr(
"Brush" );
120 case QVariant::Color:
121 return QObject::tr(
"Color" );
122 case QVariant::Palette:
123 return QObject::tr(
"Palette" );
124 case QVariant::Image:
125 return QObject::tr(
"Image" );
126 case QVariant::Polygon:
127 case QVariant::PolygonF:
128 return QObject::tr(
"Polygon" );
129 case QVariant::Region:
130 return QObject::tr(
"Region" );
131 case QVariant::Bitmap:
132 return QObject::tr(
"Bitmap" );
133 case QVariant::Cursor:
134 return QObject::tr(
"Cursor" );
135 case QVariant::KeySequence:
136 return QObject::tr(
"Key Sequence" );
138 return QObject::tr(
"Pen" );
139 case QVariant::TextLength:
140 return QObject::tr(
"Text Length" );
141 case QVariant::TextFormat:
142 return QObject::tr(
"Text Format" );
143 case QVariant::Matrix4x4:
144 return QObject::tr(
"Matrix" );
145 case QVariant::Transform:
146 return QObject::tr(
"Transform" );
147 case QVariant::Vector2D:
148 case QVariant::Vector3D:
149 case QVariant::Vector4D:
150 return QObject::tr(
"Vector" );
151 case QVariant::Quaternion:
152 return QObject::tr(
"Quaternion" );
154 return QObject::tr(
"Icon" );
155 case QVariant::SizePolicy:
156 return QObject::tr(
"Size Policy" );
166 if ( variant.isNull() || !variant.isValid() )
169 switch ( variant.type() )
171 case QVariant::Invalid:
175 case QVariant::LongLong:
176 case QVariant::ULongLong:
177 case QVariant::Double:
180 case QVariant::StringList:
182 case QVariant::Locale:
183 case QVariant::RegularExpression:
185 case QVariant::EasingCurve:
186 case QVariant::ModelIndex:
187 case QVariant::PersistentModelIndex:
189 case QVariant::LastType:
194 if ( variant.toDate().isNull() )
196 QgsDebugMsg( QStringLiteral(
"NULL QDateTime was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
201 if ( variant.toTime().isNull() )
203 QgsDebugMsg( QStringLiteral(
"NULL QTime was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
207 case QVariant::DateTime:
208 if ( variant.toDate().isNull() )
210 QgsDebugMsg( QStringLiteral(
"NULL QDate was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
215 if ( variant.toChar().isNull() )
217 QgsDebugMsg( QStringLiteral(
"NULL QChar was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
221 case QVariant::String:
222 if ( variant.toString().isNull() )
224 QgsDebugMsg( QStringLiteral(
"NULL QString was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
228 case QVariant::ByteArray:
229 if ( variant.toByteArray().isNull() )
231 QgsDebugMsg( QStringLiteral(
"NULL QByteArray was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
235 case QVariant::BitArray:
236 if ( variant.toBitArray().isNull() )
238 QgsDebugMsg( QStringLiteral(
"NULL QBitArray was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
243 if ( variant.toRect().isNull() )
245 QgsDebugMsg( QStringLiteral(
"NULL QRect was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
249 case QVariant::RectF:
250 if ( variant.toRectF().isNull() )
252 QgsDebugMsg( QStringLiteral(
"NULL QRectF was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
257 if ( variant.toSize().isNull() )
259 QgsDebugMsg( QStringLiteral(
"NULL QSize was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
263 case QVariant::SizeF:
264 if ( variant.toSizeF().isNull() )
266 QgsDebugMsg( QStringLiteral(
"NULL QSizeF was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
271 if ( variant.toLine().isNull() )
273 QgsDebugMsg( QStringLiteral(
"NULL QLine was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
277 case QVariant::LineF:
278 if ( variant.toLineF().isNull() )
280 QgsDebugMsg( QStringLiteral(
"NULL QLineF was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
284 case QVariant::Point:
285 if ( variant.toPoint().isNull() )
287 QgsDebugMsg( QStringLiteral(
"NULL QPoint was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
291 case QVariant::PointF:
292 if ( variant.toPointF().isNull() )
294 QgsDebugMsg( QStringLiteral(
"NULL QPointF was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
299 if ( variant.toUuid().isNull() )
301 QgsDebugMsg( QStringLiteral(
"NULL QUuid was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
305 case QVariant::Pixmap:
306 if ( variant.value< QPixmap >().isNull() )
308 QgsDebugMsg( QStringLiteral(
"NULL QPixmap was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
312 case QVariant::Image:
313 if ( variant.value< QImage >().isNull() )
315 QgsDebugMsg( QStringLiteral(
"NULL QImage was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
319 case QVariant::Region:
320 if ( variant.value< QRegion >().isNull() )
322 QgsDebugMsg( QStringLiteral(
"NULL QRegion was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
326 case QVariant::Bitmap:
327 if ( variant.value< QBitmap >().isNull() )
329 QgsDebugMsg( QStringLiteral(
"NULL QBitmap was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
334 if ( variant.value< QIcon >().isNull() )
336 QgsDebugMsg( QStringLiteral(
"NULL QIcon was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
340 case QVariant::Vector2D:
341 if ( variant.value< QVector2D >().isNull() )
343 QgsDebugMsg( QStringLiteral(
"NULL QVector2D was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
347 case QVariant::Vector3D:
348 if ( variant.value< QVector3D >().isNull() )
350 QgsDebugMsg( QStringLiteral(
"NULL QVector3D was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
354 case QVariant::Vector4D:
355 if ( variant.value< QVector4D >().isNull() )
357 QgsDebugMsg( QStringLiteral(
"NULL QVector4D was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
361 case QVariant::Quaternion:
362 if ( variant.value< QQuaternion >().isNull() )
364 QgsDebugMsg( QStringLiteral(
"NULL QQuaternion was stored in a QVariant -- stop it! Always use an invalid QVariant() instead." ) );
369 case QVariant::Color:
371 case QVariant::Brush:
372 case QVariant::Polygon:
373 case QVariant::Palette:
374 case QVariant::Cursor:
375 case QVariant::KeySequence:
377 case QVariant::TextLength:
378 case QVariant::PolygonF:
379 case QVariant::TextFormat:
380 case QVariant::Transform:
381 case QVariant::Matrix4x4:
382 case QVariant::SizePolicy:
385 case QVariant::UserType:
static QString typeToDisplayString(QVariant::Type type, QVariant::Type subType=QVariant::Type::Invalid)
Returns a user-friendly translated string representing a QVariant type.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.