diff options
Diffstat (limited to 'src/gui/kernel/qguivariant.cpp')
-rw-r--r-- | src/gui/kernel/qguivariant.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index edca8d9423..c9c45ba815 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -41,12 +41,12 @@ #include "qbitmap.h" #include "qbrush.h" #include "qcolor.h" +#include "qcolorspace.h" #include "qcursor.h" #include "qfont.h" #include "qimage.h" #include "qkeysequence.h" #include "qtransform.h" -#include "qmatrix.h" #include "qpalette.h" #include "qpen.h" #include "qpixmap.h" @@ -103,13 +103,13 @@ static void construct(QVariant::Private *x, const void *copy) { const int type = x->type; QVariantConstructor<GuiTypesFilter> constructor(x, copy); - QMetaTypeSwitcher::switcher<void>(constructor, type, 0); + QMetaTypeSwitcher::switcher<void>(constructor, type, nullptr); } static void clear(QVariant::Private *d) { QVariantDestructor<GuiTypesFilter> destructor(d); - QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0); + QMetaTypeSwitcher::switcher<void>(destructor, d->type, nullptr); } // This class is a hack that customizes access to QPolygon and QPolygonF @@ -129,7 +129,7 @@ public: static bool isNull(const QVariant::Private *d) { QGuiVariantIsNull<GuiTypesFilter> isNull(d); - return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0); + return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, nullptr); } // This class is a hack that customizes access to QPixmap, QBitmap, QCursor and QIcon @@ -171,32 +171,32 @@ public: static bool compare(const QVariant::Private *a, const QVariant::Private *b) { QGuiVariantComparator<GuiTypesFilter> comparator(a, b); - return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0); + return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, nullptr); } static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) { switch (t) { - case QVariant::ByteArray: - if (d->type == QVariant::Color) { + case QMetaType::QByteArray: + if (d->type == QMetaType::QColor) { const QColor *c = v_cast<QColor>(d); *static_cast<QByteArray *>(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1(); return true; } break; - case QVariant::String: { + case QMetaType::QString: { QString *str = static_cast<QString *>(result); switch (d->type) { #ifndef QT_NO_SHORTCUT - case QVariant::KeySequence: + case QMetaType::QKeySequence: *str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText); return true; #endif - case QVariant::Font: + case QMetaType::QFont: *str = v_cast<QFont>(d)->toString(); return true; - case QVariant::Color: { + case QMetaType::QColor: { const QColor *c = v_cast<QColor>(d); *str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); return true; @@ -206,85 +206,85 @@ static bool convert(const QVariant::Private *d, int t, } break; } - case QVariant::Pixmap: - if (d->type == QVariant::Image) { + case QMetaType::QPixmap: + if (d->type == QMetaType::QImage) { *static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d)); return true; - } else if (d->type == QVariant::Bitmap) { + } else if (d->type == QMetaType::QBitmap) { *static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d); return true; - } else if (d->type == QVariant::Brush) { + } else if (d->type == QMetaType::QBrush) { if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) { *static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture(); return true; } } break; - case QVariant::Image: - if (d->type == QVariant::Pixmap) { + case QMetaType::QImage: + if (d->type == QMetaType::QPixmap) { *static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage(); return true; - } else if (d->type == QVariant::Bitmap) { + } else if (d->type == QMetaType::QBitmap) { *static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage(); return true; } break; - case QVariant::Bitmap: - if (d->type == QVariant::Pixmap) { + case QMetaType::QBitmap: + if (d->type == QMetaType::QPixmap) { *static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d); return true; - } else if (d->type == QVariant::Image) { + } else if (d->type == QMetaType::QImage) { *static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d)); return true; } break; #ifndef QT_NO_SHORTCUT - case QVariant::Int: - if (d->type == QVariant::KeySequence) { + case QMetaType::Int: + if (d->type == QMetaType::QKeySequence) { const QKeySequence &seq = *v_cast<QKeySequence>(d); *static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0]; return true; } break; #endif - case QVariant::Font: - if (d->type == QVariant::String) { + case QMetaType::QFont: + if (d->type == QMetaType::QString) { QFont *f = static_cast<QFont *>(result); f->fromString(*v_cast<QString>(d)); return true; } break; - case QVariant::Color: - if (d->type == QVariant::String) { + case QMetaType::QColor: + if (d->type == QMetaType::QString) { static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d)); return static_cast<QColor *>(result)->isValid(); - } else if (d->type == QVariant::ByteArray) { + } else if (d->type == QMetaType::QByteArray) { static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d))); return true; - } else if (d->type == QVariant::Brush) { + } else if (d->type == QMetaType::QBrush) { if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) { *static_cast<QColor *>(result) = v_cast<QBrush>(d)->color(); return true; } } break; - case QVariant::Brush: - if (d->type == QVariant::Color) { + case QMetaType::QBrush: + if (d->type == QMetaType::QColor) { *static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d)); return true; - } else if (d->type == QVariant::Pixmap) { + } else if (d->type == QMetaType::QPixmap) { *static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d)); return true; } break; #ifndef QT_NO_SHORTCUT - case QVariant::KeySequence: { + case QMetaType::QKeySequence: { QKeySequence *seq = static_cast<QKeySequence *>(result); switch (d->type) { - case QVariant::String: + case QMetaType::QString: *seq = QKeySequence(*v_cast<QString>(d)); return true; - case QVariant::Int: + case QMetaType::Int: *seq = QKeySequence(d->data.i); return true; default: @@ -294,7 +294,7 @@ static bool convert(const QVariant::Private *d, int t, } #endif #ifndef QT_NO_ICON - case QVariant::Icon: { + case QMetaType::QIcon: { if (ok) *ok = false; return false; @@ -311,7 +311,7 @@ static void streamDebug(QDebug dbg, const QVariant &v) { QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr()); QVariantDebugStream<GuiTypesFilter> stream(dbg, d); - QMetaTypeSwitcher::switcher<void>(stream, d->type, 0); + QMetaTypeSwitcher::switcher<void>(stream, d->type, nullptr); } #endif @@ -320,12 +320,12 @@ const QVariant::Handler qt_gui_variant_handler = { clear, isNull, #ifndef QT_NO_DATASTREAM - 0, - 0, + nullptr, + nullptr, #endif compare, convert, - 0, + nullptr, #if !defined(QT_NO_DEBUG_STREAM) streamDebug #else |