method returns void is to compare the return value of QMetaMethod::returnType()
to QMetaType::Void.
+- QVariant:
+ * Inconsistent constructor taking Qt::GlobalColor and producing QVariant(QColor)
+ instance was removed. Code constructing such variants can be migrated by
+ explicitly calling QColor constructor. For example from "QVariant(Qt::red)"
+ to "QVariant(QColor(Qt::red))"
+
- QTestLib:
* The plain-text, xml and lightxml test output formats have been changed to
show a test result for every row of test data in data-driven tests. In
Constructs a new variant with the regular expression value \a re.
*/
-/*! \since 4.2
- \fn QVariant::QVariant(Qt::GlobalColor color)
-
- Constructs a new variant of type QVariant::Color and initializes
- it with \a color.
-
- This is a convenience constructor that allows \c{QVariant(Qt::blue);}
- to create a valid QVariant storing a QColor.
-
- Note: This constructor will assert if the application does not link
- to the Qt GUI library.
- */
-
QVariant::QVariant(Type type)
{ create(type, 0); }
QVariant::QVariant(int typeId, const void *copy)
QVariant::QVariant(const QRegularExpression &re) { d.is_null = false; d.type = QMetaType::QRegularExpression; v_construct<QRegularExpression>(&d, re); }
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGEXP
-QVariant::QVariant(Qt::GlobalColor color) { create(62, &color); }
/*!
Returns the storage type of the value stored in the variant.
QVariant(const QUrl &url);
QVariant(const QEasingCurve &easing);
#endif
- QVariant(Qt::GlobalColor color);
QVariant& operator=(const QVariant &other);
#ifdef Q_COMPILER_RVALUE_REFS
static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
- if (Q_UNLIKELY(type == 62)) {
- // small 'trick' to let a QVariant(Qt::blue) create a variant
- // of type QColor
- // TODO Get rid of this hack.
- x->type = QVariant::Color;
- QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
- v_construct<QColor>(x, &color);
- return;
- }
QVariantConstructor<GuiTypesFilter> constructor(x, copy);
QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
}
QCOMPARE(qvariant_cast<QColor>(mimeData.colorData()), red);
// change, verify
- mimeData.setColorData(Qt::blue);
+ mimeData.setColorData(QColor(Qt::blue));
QVERIFY(mimeData.hasColor());
QCOMPARE(qvariant_cast<QColor>(mimeData.colorData()), blue);
}
void saveLoadCustomTypes();
- void globalColor();
-
void variantMap();
void variantHash();
QCOMPARE(v3.toString(), str);
}
-void tst_QVariant::globalColor()
-{
- QVariant variant(Qt::blue);
- QVERIFY(variant.type() == QVariant::Color);
- QVERIFY(qVariantValue<QColor>(variant) == QColor(Qt::blue));
-}
-
void tst_QVariant::variantMap()
{
QMap<QString, QVariant> map;