Remove QVariant constructor taking Qt::GlobalColor.
The constructor is wrong, it creates instance of QVariant encapsulating a QColor instance. QVariant should not implicitly convert data, never. Change-Id: Idc794ecdecb42d8b53fee3f993bf51ddd43f595d Reviewed-by: Lars Knoll <lars.knoll@nokia.com>bb10
parent
10c88faf79
commit
ff55d64f67
|
|
@ -68,6 +68,12 @@ information about a particular change.
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1349,19 +1349,6 @@ QVariant::QVariant(const char *val)
|
|||
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)
|
||||
|
|
@ -1443,7 +1430,6 @@ QVariant::QVariant(const QRegExp ®Exp) { d.is_null = false; d.type = RegExp;
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@ class Q_CORE_EXPORT QVariant
|
|||
QVariant(const QUrl &url);
|
||||
QVariant(const QEasingCurve &easing);
|
||||
#endif
|
||||
QVariant(Qt::GlobalColor color);
|
||||
|
||||
QVariant& operator=(const QVariant &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
|
|
|
|||
|
|
@ -108,15 +108,6 @@ struct GuiTypesFilter {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void tst_QMimeData::colorData() const
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,8 +235,6 @@ private slots:
|
|||
|
||||
void saveLoadCustomTypes();
|
||||
|
||||
void globalColor();
|
||||
|
||||
void variantMap();
|
||||
void variantHash();
|
||||
|
||||
|
|
@ -2447,13 +2445,6 @@ void tst_QVariant::url()
|
|||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue