Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Not Evaluated
-
Resolution: Done
-
Affects Version/s: 5.15.3
-
Fix Version/s: 6.0.0
-
Component/s: Core: Containers and Algorithms
-
Labels:None
-
Platform/s:
Description
Consider a simple example:
const auto tryType = [](int targetTypeId) { auto v = QVariant::fromValue(123); Q_ASSERT(v.convert(targetTypeId)); qDebug() << v << "can convert to string:" << v.canConvert(QMetaType::QString); }; tryType(QMetaType::Short); tryType(QMetaType::UShort); tryType(QMetaType::Int); tryType(QMetaType::UInt); tryType(QMetaType::Long); tryType(QMetaType::ULong); tryType(QMetaType::LongLong); tryType(QMetaType::ULongLong);
We can expect to see true for all types but instead we see:
QVariant(short, 123) can convert to string: true
QVariant(ushort, 123) can convert to string: true
QVariant(int, 123) can convert to string: true
QVariant(uint, 123) can convert to string: true
QVariant(long, 123) can convert to string: false
QVariant(ulong, 123) can convert to string: false
QVariant(qlonglong, 123) can convert to string: true
QVariant(qulonglong, 123) can convert to string: true