Qt 4.8
Classes | Macros | Functions | Variables
qguivariant.cpp File Reference
#include "qvariant.h"
#include "qbitmap.h"
#include "qbrush.h"
#include "qcolor.h"
#include "qcursor.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "qfont.h"
#include "qicon.h"
#include "qimage.h"
#include "qkeysequence.h"
#include "qtransform.h"
#include "qmatrix.h"
#include "qpalette.h"
#include "qpen.h"
#include "qpixmap.h"
#include "qpolygon.h"
#include "qregion.h"
#include "qsizepolicy.h"
#include "qtextformat.h"
#include "qmatrix4x4.h"
#include "qvector2d.h"
#include "qvector3d.h"
#include "qvector4d.h"
#include "qquaternion.h"
#include "private/qvariant_p.h"

Go to the source code of this file.

Classes

struct  QMetaTypeGuiHelper
 

Macros

#define Q_DECL_METATYPE_HELPER(TYPE)
 
#define Q_IMPL_METATYPE_HELPER(TYPE)
 

Functions

static void clear (QVariant::Private *d)
 
static bool compare (const QVariant::Private *a, const QVariant::Private *b)
 
static void construct (QVariant::Private *x, const void *copy)
 
static bool convert (const QVariant::Private *d, QVariant::Type t, void *result, bool *ok)
 
static bool isNull (const QVariant::Private *d)
 
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler ()
 
int qRegisterGuiVariant ()
 
int qUnregisterGuiVariant ()
 
static void streamDebug (QDebug dbg, const QVariant &v)
 

Variables

Q_CORE_EXPORT const QMetaTypeGuiHelperqMetaTypeGuiHelper
 
const QVariant::Handler qt_gui_variant_handler
 
static const QVariant::Handler * qt_guivariant_last_handler = 0
 
static const QMetaTypeGuiHelper qVariantGuiHelper []
 

Macro Definition Documentation

◆ Q_DECL_METATYPE_HELPER

#define Q_DECL_METATYPE_HELPER (   TYPE)
Value:
typedef void *(*QConstruct##TYPE)(const TYPE *); \
static const QConstruct##TYPE qConstruct##TYPE = qMetaTypeConstructHelper<TYPE>; \
typedef void (*QDestruct##TYPE)(TYPE *); \
static const QDestruct##TYPE qDestruct##TYPE = qMetaTypeDeleteHelper<TYPE>; \
typedef void (*QSave##TYPE)(QDataStream &, const TYPE *); \
static const QSave##TYPE qSave##TYPE = qMetaTypeSaveHelper<TYPE>; \
typedef void (*QLoad##TYPE)(QDataStream &, TYPE *); \
static const QLoad##TYPE qLoad##TYPE = qMetaTypeLoadHelper<TYPE>;
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71

Definition at line 680 of file qguivariant.cpp.

◆ Q_IMPL_METATYPE_HELPER

#define Q_IMPL_METATYPE_HELPER (   TYPE)
Value:
{ reinterpret_cast<QMetaType::Constructor>(qConstruct##TYPE), \
reinterpret_cast<QMetaType::Destructor>(qDestruct##TYPE), \
reinterpret_cast<QMetaType::SaveOperator>(qSave##TYPE), \
reinterpret_cast<QMetaType::LoadOperator>(qLoad##TYPE) \
}
void *(* Constructor)(const void *)
Definition: qmetatype.h:105
void(* SaveOperator)(QDataStream &, const void *)
Definition: qmetatype.h:108

Definition at line 739 of file qguivariant.cpp.

Function Documentation

◆ clear()

static void clear ( QVariant::Private *  d)
static

Definition at line 188 of file qguivariant.cpp.

189 {
190  switch (d->type) {
191  case QVariant::Bitmap:
192  v_clear<QBitmap>(d);
193  break;
194  case QVariant::Cursor:
195  v_clear<QCursor>(d);
196  break;
197  case QVariant::Region:
198  v_clear<QRegion>(d);
199  break;
200  case QVariant::Polygon:
201  v_clear<QPolygon>(d);
202  break;
203  case QVariant::Font:
204  v_clear<QFont>(d);
205  break;
206  case QVariant::Pixmap:
207  v_clear<QPixmap>(d);
208  break;
209  case QVariant::Image:
210  v_clear<QImage>(d);
211  break;
212  case QVariant::Brush:
213  v_clear<QBrush>(d);
214  break;
215  case QVariant::Color:
216  v_clear<QColor>(d);
217  break;
218  case QVariant::Palette:
219  v_clear<QPalette>(d);
220  break;
221 #ifdef QT3_SUPPORT
222  case QVariant::ColorGroup:
223  v_clear<QColorGroup>(d);
224  break;
225 #endif
226 #ifndef QT_NO_ICON
227  case QVariant::Icon:
228  v_clear<QIcon>(d);
229  break;
230 #endif
231  case QVariant::Matrix:
232  v_clear<QMatrix>(d);
233  break;
234  case QVariant::Transform:
235  v_clear<QTransform>(d);
236  break;
238  v_clear<QTextFormat>(d);
239  break;
241  v_clear<QTextLength>(d);
242  break;
244  v_clear<QSizePolicy>(d);
245  break;
246 #ifndef QT_NO_SHORTCUT
248  v_clear<QKeySequence>(d);
249  break;
250 #endif
251  case QVariant::Pen:
252  v_clear<QPen>(d);
253  break;
254 #ifndef QT_NO_MATRIX4X4
255  case QVariant::Matrix4x4:
256  v_clear<QMatrix4x4>(d);
257  break;
258 #endif
259 #ifndef QT_NO_VECTOR2D
260  case QVariant::Vector2D:
261  v_clear<QVector2D>(d);
262  break;
263 #endif
264 #ifndef QT_NO_VECTOR3D
265  case QVariant::Vector3D:
266  v_clear<QVector3D>(d);
267  break;
268 #endif
269 #ifndef QT_NO_VECTOR4D
270  case QVariant::Vector4D:
271  v_clear<QVector4D>(d);
272  break;
273 #endif
274 #ifndef QT_NO_QUATERNION
276  v_clear<QVector4D>(d);
277  break;
278 #endif
279  default:
280  qcoreVariantHandler()->clear(d);
281  return;
282  }
283 
284  d->type = QVariant::Invalid;
285  d->is_null = true;
286  d->is_shared = false;
287 }
double d
Definition: qnumeric_p.h:62
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193

◆ compare()

static bool compare ( const QVariant::Private *  a,
const QVariant::Private *  b 
)
static

Definition at line 350 of file qguivariant.cpp.

351 {
352  Q_ASSERT(a->type == b->type);
353  switch(a->type) {
354  case QVariant::Cursor:
355 #ifndef QT_NO_CURSOR
356  return v_cast<QCursor>(a)->shape() == v_cast<QCursor>(b)->shape();
357 #endif
358  case QVariant::Bitmap:
359  return v_cast<QBitmap>(a)->cacheKey()
360  == v_cast<QBitmap>(b)->cacheKey();
361  case QVariant::Polygon:
362  return *v_cast<QPolygon>(a) == *v_cast<QPolygon>(b);
363  case QVariant::Region:
364  return *v_cast<QRegion>(a) == *v_cast<QRegion>(b);
365  case QVariant::Font:
366  return *v_cast<QFont>(a) == *v_cast<QFont>(b);
367  case QVariant::Pixmap:
368  return v_cast<QPixmap>(a)->cacheKey() == v_cast<QPixmap>(b)->cacheKey();
369  case QVariant::Image:
370  return *v_cast<QImage>(a) == *v_cast<QImage>(b);
371  case QVariant::Brush:
372  return *v_cast<QBrush>(a) == *v_cast<QBrush>(b);
373  case QVariant::Color:
374  return *v_cast<QColor>(a) == *v_cast<QColor>(b);
375  case QVariant::Palette:
376  return *v_cast<QPalette>(a) == *v_cast<QPalette>(b);
377 #ifdef QT3_SUPPORT
378  case QVariant::ColorGroup:
379  return *v_cast<QColorGroup>(a) == *v_cast<QColorGroup>(b);
380 #endif
381 #ifndef QT_NO_ICON
382  case QVariant::Icon:
383  /* QIcon::operator==() cannot be reasonably implemented for QIcon,
384  * so we always return false. */
385  return false;
386 #endif
387  case QVariant::Matrix:
388  return *v_cast<QMatrix>(a) == *v_cast<QMatrix>(b);
389  case QVariant::Transform:
390  return *v_cast<QTransform>(a) == *v_cast<QTransform>(b);
392  return *v_cast<QTextFormat>(a) == *v_cast<QTextFormat>(b);
394  return *v_cast<QTextLength>(a) == *v_cast<QTextLength>(b);
396  return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b);
397 #ifndef QT_NO_SHORTCUT
399  return *v_cast<QKeySequence>(a) == *v_cast<QKeySequence>(b);
400 #endif
401  case QVariant::Pen:
402  return *v_cast<QPen>(a) == *v_cast<QPen>(b);
403 #ifndef QT_NO_MATRIX4X4
404  case QVariant::Matrix4x4:
405  return *v_cast<QMatrix4x4>(a) == *v_cast<QMatrix4x4>(b);
406 #endif
407 #ifndef QT_NO_VECTOR2D
408  case QVariant::Vector2D:
409  return *v_cast<QVector2D>(a) == *v_cast<QVector2D>(b);
410 #endif
411 #ifndef QT_NO_VECTOR3D
412  case QVariant::Vector3D:
413  return *v_cast<QVector3D>(a) == *v_cast<QVector3D>(b);
414 #endif
415 #ifndef QT_NO_VECTOR4D
416  case QVariant::Vector4D:
417  return *v_cast<QVector4D>(a) == *v_cast<QVector4D>(b);
418 #endif
419 #ifndef QT_NO_QUATERNION
421  return *v_cast<QQuaternion>(a) == *v_cast<QQuaternion>(b);
422 #endif
423  default:
424  break;
425  }
426  return qcoreVariantHandler()->compare(a, b);
427 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
The QMatrix class specifies 2D transformations of a coordinate system.
Definition: qmatrix.h:61
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
long ASN1_INTEGER_get ASN1_INTEGER * a
The QPolygon class provides a vector of points using integer precision.
Definition: qpolygon.h:60
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
const T * v_cast(const QVariant::Private *d, T *=0)
Definition: qvariant_p.h:78
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
The QTextFormat class provides formatting information for a QTextDocument.
Definition: qtextformat.h:129
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition: qmatrix4x4.h:63
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
The QTextLength class encapsulates the different types of length used in a QTextDocument.
Definition: qtextformat.h:84
The QColorGroup class contains color groups for each widget state.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition: qquaternion.h:59
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ construct()

static void construct ( QVariant::Private *  x,
const void *  copy 
)
static

Definition at line 80 of file qguivariant.cpp.

81 {
82  switch (x->type) {
83  case QVariant::Bitmap:
84  v_construct<QBitmap>(x, copy);
85  break;
86  case QVariant::Region:
87  v_construct<QRegion>(x, copy);
88  break;
89  case QVariant::Polygon:
90  v_construct<QPolygon>(x, copy);
91  break;
92  case QVariant::Font:
93  v_construct<QFont>(x, copy);
94  break;
95  case QVariant::Pixmap:
96  v_construct<QPixmap>(x, copy);
97  break;
98  case QVariant::Image:
99  v_construct<QImage>(x, copy);
100  break;
101  case QVariant::Brush:
102  v_construct<QBrush>(x, copy);
103  break;
104  case QVariant::Color:
105  v_construct<QColor>(x, copy);
106  break;
107  case QVariant::Palette:
108  v_construct<QPalette>(x, copy);
109  break;
110 #ifdef QT3_SUPPORT
111  case QVariant::ColorGroup:
112  v_construct<QColorGroup>(x, copy);
113  break;
114 #endif
115 #ifndef QT_NO_ICON
116  case QVariant::Icon:
117  v_construct<QIcon>(x, copy);
118  break;
119 #endif
120  case QVariant::Matrix:
121  v_construct<QMatrix>(x, copy);
122  break;
123  case QVariant::Transform:
124  v_construct<QTransform>(x, copy);
125  break;
127  v_construct<QTextFormat>(x, copy);
128  break;
130  v_construct<QTextLength>(x, copy);
131  break;
132 #ifndef QT_NO_SHORTCUT
134  v_construct<QKeySequence>(x, copy);
135  break;
136 #endif
137  case QVariant::Pen:
138  v_construct<QPen>(x, copy);
139  break;
141  v_construct<QSizePolicy>(x, copy);
142  break;
143 #ifndef QT_NO_CURSOR
144  case QVariant::Cursor:
145  v_construct<QCursor>(x, copy);
146  break;
147 #endif
148  case 62: {
149  // small 'trick' to let a QVariant(Qt::blue) create a variant
150  // of type QColor
151  x->type = QVariant::Color;
152  QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
153  v_construct<QColor>(x, &color);
154  break;
155  }
156 #ifndef QT_NO_MATRIX4X4
157  case QVariant::Matrix4x4:
158  v_construct<QMatrix4x4>(x, copy);
159  break;
160 #endif
161 #ifndef QT_NO_VECTOR2D
162  case QVariant::Vector2D:
163  v_construct<QVector2D>(x, copy);
164  break;
165 #endif
166 #ifndef QT_NO_VECTOR3D
167  case QVariant::Vector3D:
168  v_construct<QVector3D>(x, copy);
169  break;
170 #endif
171 #ifndef QT_NO_VECTOR4D
172  case QVariant::Vector4D:
173  v_construct<QVector4D>(x, copy);
174  break;
175 #endif
176 #ifndef QT_NO_QUATERNION
178  v_construct<QQuaternion>(x, copy);
179  break;
180 #endif
181  default:
182  qcoreVariantHandler()->construct(x, copy);
183  return;
184  }
185  x->is_null = !copy;
186 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193

◆ convert()

static bool convert ( const QVariant::Private *  d,
QVariant::Type  t,
void *  result,
bool *  ok 
)
static

Definition at line 431 of file qguivariant.cpp.

433 {
434  switch (t) {
435  case QVariant::ByteArray:
436  if (d->type == QVariant::Color) {
437  *static_cast<QByteArray *>(result) = v_cast<QColor>(d)->name().toLatin1();
438  return true;
439  }
440  break;
441  case QVariant::String: {
442  QString *str = static_cast<QString *>(result);
443  switch (d->type) {
444 #ifndef QT_NO_SHORTCUT
446  *str = QString(*v_cast<QKeySequence>(d));
447  return true;
448 #endif
449  case QVariant::Font:
450  *str = v_cast<QFont>(d)->toString();
451  return true;
452  case QVariant::Color:
453  *str = v_cast<QColor>(d)->name();
454  return true;
455  default:
456  break;
457  }
458  break;
459  }
460  case QVariant::Pixmap:
461  if (d->type == QVariant::Image) {
462  *static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d));
463  return true;
464  } else if (d->type == QVariant::Bitmap) {
465  *static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d);
466  return true;
467  } else if (d->type == QVariant::Brush) {
468  if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) {
469  *static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture();
470  return true;
471  }
472  }
473  break;
474  case QVariant::Image:
475  if (d->type == QVariant::Pixmap) {
476  *static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage();
477  return true;
478  } else if (d->type == QVariant::Bitmap) {
479  *static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage();
480  return true;
481  }
482  break;
483  case QVariant::Bitmap:
484  if (d->type == QVariant::Pixmap) {
485  *static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d);
486  return true;
487  } else if (d->type == QVariant::Image) {
488  *static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d));
489  return true;
490  }
491  break;
492 #ifndef QT_NO_SHORTCUT
493  case QVariant::Int:
494  if (d->type == QVariant::KeySequence) {
495  *static_cast<int *>(result) = (int)(*(v_cast<QKeySequence>(d)));
496  return true;
497  }
498  break;
499 #endif
500  case QVariant::Font:
501  if (d->type == QVariant::String) {
502  QFont *f = static_cast<QFont *>(result);
503  f->fromString(*v_cast<QString>(d));
504  return true;
505  }
506  break;
507  case QVariant::Color:
508  if (d->type == QVariant::String) {
509  static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
510  return static_cast<QColor *>(result)->isValid();
511  } else if (d->type == QVariant::ByteArray) {
512  static_cast<QColor *>(result)->setNamedColor(QString::fromLatin1(
513  *v_cast<QByteArray>(d)));
514  return true;
515  } else if (d->type == QVariant::Brush) {
516  if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
517  *static_cast<QColor *>(result) = v_cast<QBrush>(d)->color();
518  return true;
519  }
520  }
521  break;
522  case QVariant::Brush:
523  if (d->type == QVariant::Color) {
524  *static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d));
525  return true;
526  } else if (d->type == QVariant::Pixmap) {
527  *static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d));
528  return true;
529  }
530  break;
531 #ifndef QT_NO_SHORTCUT
532  case QVariant::KeySequence: {
533  QKeySequence *seq = static_cast<QKeySequence *>(result);
534  switch (d->type) {
535  case QVariant::String:
536  *seq = QKeySequence(*v_cast<QString>(d));
537  return true;
538  case QVariant::Int:
539  *seq = QKeySequence(d->data.i);
540  return true;
541  default:
542  break;
543  }
544  }
545 #endif
546  default:
547  break;
548  }
549  return qcoreVariantHandler()->convert(d, t, result, ok);
550 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
bool fromString(const QString &)
Sets this font to match the description descrip.
Definition: qfont.cpp:2367
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
const T * v_cast(const QVariant::Private *d, T *=0)
Definition: qvariant_p.h:78
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
static QString toString(Register *reg, int type, bool *ok=0)
const char * name
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags...
Definition: qbitmap.cpp:281

◆ isNull()

static bool isNull ( const QVariant::Private *  d)
static

Definition at line 290 of file qguivariant.cpp.

291 {
292  switch(d->type) {
293  case QVariant::Bitmap:
294  return v_cast<QBitmap>(d)->isNull();
295  case QVariant::Region:
296  return v_cast<QRegion>(d)->isEmpty();
297  case QVariant::Polygon:
298  return v_cast<QPolygon>(d)->isEmpty();
299  case QVariant::Pixmap:
300  return v_cast<QPixmap>(d)->isNull();
301  case QVariant::Image:
302  return v_cast<QImage>(d)->isNull();
303 #ifndef QT_NO_ICON
304  case QVariant::Icon:
305  return v_cast<QIcon>(d)->isNull();
306 #endif
307  case QVariant::Matrix:
310  case QVariant::Cursor:
312  case QVariant::Font:
313  case QVariant::Brush:
314  case QVariant::Color:
315  case QVariant::Palette:
316 #ifdef QT3_SUPPORT
317  case QVariant::ColorGroup:
318 #endif
320 #ifndef QT_NO_SHORTCUT
322 #endif
323  case QVariant::Pen:
324 #ifndef QT_NO_MATRIX4X4
325  case QVariant::Matrix4x4:
326 #endif
327  break;
328 #ifndef QT_NO_VECTOR2D
329  case QVariant::Vector2D:
330  return v_cast<QVector2D>(d)->isNull();
331 #endif
332 #ifndef QT_NO_VECTOR3D
333  case QVariant::Vector3D:
334  return v_cast<QVector3D>(d)->isNull();
335 #endif
336 #ifndef QT_NO_VECTOR4D
337  case QVariant::Vector4D:
338  return v_cast<QVector4D>(d)->isNull();
339 #endif
340 #ifndef QT_NO_QUATERNION
342  return v_cast<QQuaternion>(d)->isNull();
343 #endif
344  default:
345  return qcoreVariantHandler()->isNull(d);
346  }
347  return d->is_null;
348 }
double d
Definition: qnumeric_p.h:62
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
The QPolygon class provides a vector of points using integer precision.
Definition: qpolygon.h:60
const T * v_cast(const QVariant::Private *d, T *=0)
Definition: qvariant_p.h:78
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
static bool isEmpty(const char *str)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static bool isNull(const QVariant::Private *d)
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition: qquaternion.h:59
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ qcoreVariantHandler()

Q_CORE_EXPORT const QVariant::Handler* qcoreVariantHandler ( )

Definition at line 1193 of file qvariant.cpp.

Referenced by clear(), compare(), construct(), convert(), isNull(), and streamDebug().

1194 {
1195  return &qt_kernel_variant_handler;
1196 }
const QVariant::Handler qt_kernel_variant_handler
Definition: qvariant.cpp:1175

◆ qRegisterGuiVariant()

int qRegisterGuiVariant ( )

Definition at line 811 of file qguivariant.cpp.

Referenced by QVariant::operator!=(), and QApplication::QApplication().

812 {
816  return 1;
817 }
const QVariant::Handler qt_gui_variant_handler
static const QMetaTypeGuiHelper qVariantGuiHelper[]
Q_CORE_EXPORT const QMetaTypeGuiHelper * qMetaTypeGuiHelper
Definition: qmetatype.cpp:346
static const Handler * handler
Definition: qvariant.h:419
static const QVariant::Handler * qt_guivariant_last_handler

◆ qUnregisterGuiVariant()

int qUnregisterGuiVariant ( )

Definition at line 820 of file qguivariant.cpp.

Referenced by QVariant::operator!=(), QApplication::QApplication(), and QApplication::~QApplication().

821 {
823  qMetaTypeGuiHelper = 0;
824  return 1;
825 }
Q_CORE_EXPORT const QMetaTypeGuiHelper * qMetaTypeGuiHelper
Definition: qmetatype.cpp:346
static const Handler * handler
Definition: qvariant.h:419
static const QVariant::Handler * qt_guivariant_last_handler

◆ streamDebug()

static void streamDebug ( QDebug  dbg,
const QVariant v 
)
static

Definition at line 553 of file qguivariant.cpp.

554 {
555  switch(v.type()) {
556  case QVariant::Cursor:
557 #ifndef QT_NO_CURSOR
558 // dbg.nospace() << qvariant_cast<QCursor>(v); //FIXME
559 #endif
560  break;
561  case QVariant::Bitmap:
562 // dbg.nospace() << qvariant_cast<QBitmap>(v); //FIXME
563  break;
564  case QVariant::Polygon:
565  dbg.nospace() << qvariant_cast<QPolygon>(v);
566  break;
567  case QVariant::Region:
568  dbg.nospace() << qvariant_cast<QRegion>(v);
569  break;
570  case QVariant::Font:
571 // dbg.nospace() << qvariant_cast<QFont>(v); //FIXME
572  break;
573  case QVariant::Matrix:
574  dbg.nospace() << qvariant_cast<QMatrix>(v);
575  break;
576  case QVariant::Transform:
577  dbg.nospace() << qvariant_cast<QTransform>(v);
578  break;
579  case QVariant::Pixmap:
580 // dbg.nospace() << qvariant_cast<QPixmap>(v); //FIXME
581  break;
582  case QVariant::Image:
583 // dbg.nospace() << qvariant_cast<QImage>(v); //FIXME
584  break;
585  case QVariant::Brush:
586  dbg.nospace() << qvariant_cast<QBrush>(v);
587  break;
588  case QVariant::Color:
589  dbg.nospace() << qvariant_cast<QColor>(v);
590  break;
591  case QVariant::Palette:
592 // dbg.nospace() << qvariant_cast<QPalette>(v); //FIXME
593  break;
594 #ifndef QT_NO_ICON
595  case QVariant::Icon:
596 // dbg.nospace() << qvariant_cast<QIcon>(v); // FIXME
597  break;
598 #endif
600 // dbg.nospace() << qvariant_cast<QSizePolicy>(v); //FIXME
601  break;
602 #ifndef QT_NO_SHORTCUT
604  dbg.nospace() << qvariant_cast<QKeySequence>(v);
605  break;
606 #endif
607  case QVariant::Pen:
608  dbg.nospace() << qvariant_cast<QPen>(v);
609  break;
610 #ifndef QT_NO_MATRIX4X4
611  case QVariant::Matrix4x4:
612  dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
613  break;
614 #endif
615 #ifndef QT_NO_VECTOR2D
616  case QVariant::Vector2D:
617  dbg.nospace() << qvariant_cast<QVector2D>(v);
618  break;
619 #endif
620 #ifndef QT_NO_VECTOR3D
621  case QVariant::Vector3D:
622  dbg.nospace() << qvariant_cast<QVector3D>(v);
623  break;
624 #endif
625 #ifndef QT_NO_VECTOR4D
626  case QVariant::Vector4D:
627  dbg.nospace() << qvariant_cast<QVector4D>(v);
628  break;
629 #endif
630 #ifndef QT_NO_QUATERNION
632  dbg.nospace() << qvariant_cast<QQuaternion>(v);
633  break;
634 #endif
635  default:
636  qcoreVariantHandler()->debugStream(dbg, v);
637  break;
638  }
639 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
The QMatrix class specifies 2D transformations of a coordinate system.
Definition: qmatrix.h:61
Q_CORE_EXPORT const QVariant::Handler * qcoreVariantHandler()
Definition: qvariant.cpp:1193
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
The QPolygon class provides a vector of points using integer precision.
Definition: qpolygon.h:60
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition: qmatrix4x4.h:63
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
Type type() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1901
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition: qquaternion.h:59
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
T qvariant_cast(const QVariant &value)
Returns the given value converted to the template type T.
Definition: qvariant.h:571

Variable Documentation

◆ qMetaTypeGuiHelper

Q_CORE_EXPORT const QMetaTypeGuiHelper* qMetaTypeGuiHelper

◆ qt_gui_variant_handler

const QVariant::Handler qt_gui_variant_handler
Initial value:
= {
0,
0,
0,
}
static void clear(QVariant::Private *d)
static bool isNull(const QVariant::Private *d)
static void streamDebug(QDebug dbg, const QVariant &v)
static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, bool *ok)
static void construct(QVariant::Private *x, const void *copy)
Definition: qguivariant.cpp:80
static bool compare(const QVariant::Private *a, const QVariant::Private *b)

Definition at line 642 of file qguivariant.cpp.

Referenced by qRegisterGuiVariant().

◆ qt_guivariant_last_handler

const QVariant::Handler* qt_guivariant_last_handler = 0
static

Definition at line 810 of file qguivariant.cpp.

Referenced by qUnregisterGuiVariant().

◆ qVariantGuiHelper

const QMetaTypeGuiHelper qVariantGuiHelper[]
static

Definition at line 747 of file qguivariant.cpp.

Referenced by qRegisterGuiVariant().