|author||Stephen Kelly <firstname.lastname@example.org>||2012-09-28 17:22:21 +0200|
|committer||The Qt Project <email@example.com>||2012-10-10 08:45:22 +0200|
Delete the QVariant ctors taking global Qt enum values.
They have unexpected results in Qt 5 (the Qt::GlobalColor one works as expected in Qt 4, but was removed in Qt 5): QVariant v = QVariant(Qt::red); qDebug() << v; // QVariant(int, 7) v = Qt::red; qDebug() << v; // QVariant(int, 7) The correct way is to use: QVariant v = QVariant::fromValue(QColor(Qt::red)); The deleted constructors are the ones for which there is a class with an implicit constructor taking the enum, and that class is a built-in metatype. QLocale::Language and QKeySequence::StandardKey would also fit the description, but I can't include the header for QKeySequence as it is in QtGui, and I don't want to include the qlocale header in qvariant.h. Putting a QLocale::Language is probably very uncommon anyway. The QTextFormat test is doing the wrong thing, but the result isn't being tested. Added new tests which fail before the patch. Change-Id: Ia38a0784990f4d40ff7457a86daf58aabd4964eb Reviewed-by: Jędrzej Nowacki <firstname.lastname@example.org>
Diffstat (limited to 'dist')
1 files changed, 4 insertions, 0 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index c6c7f9292d..a56325d40a 100644
@@ -92,6 +92,10 @@ information about a particular change.
instance was removed. Code constructing such variants can be migrated by
explicitly calling QColor constructor. For example from "QVariant(Qt::red)"
+ * Similarly, implicit creation of QVariants from enum values Qt::BrushStyle,
+ Qt::PenStyle, and Qt::CursorShape have been removed. Create objects explicitly
+ or use static_cast<int>(Qt::SolidLine) to create a QVariant of type int with
+ the same value as the enum.
* The plain-text, xml and lightxml test output formats have been changed to