Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.15.11, 6.4
-
None
-
MSVC2019 and MinGW is running on a Windows 10 machine.
GCC is on a Linux VM with Ubuntu 20.04.2 LTS
I encountered the issue with QT versions 5.15.x but could reproduce it on 6.4 too in all mentioned environments.
-
-
Foundation PM Staging
Description
According documentation, QVariant::toList() converts a variant to a list, if its a QVariantList.
It does so if I use MSVC2019 compiler, but not with MinGW/GCC. When I use MinGW/GCC, it produces a new List and puts the intended List into that.
Example:
QVariant variant = QVariantList {1, 2, 3};
QVariantList list = variant.toList();
qInfo() << "variant:" << variant << "is" << QMetaType::typeName(variant.userType());
qInfo() << "List:" << list << "has" << list.count() << "elements";
Output with MSVC2019 (considered correct):
variant: QVariant(QVariantList, (QVariant(int, 1), QVariant(int, 2), QVariant(int, 3))) is QVariantList
List: (QVariant(int, 1), QVariant(int, 2), QVariant(int, 3)) has 3 elements
Output with GCC/MinGW 64 bit (considered wrong):
variant: QVariant(QVariantList, (QVariant(int, 1), QVariant(int, 2), QVariant(int, 3))) is QVariantList
List: (QVariant(QVariantList, (QVariant(int, 1), QVariant(int, 2), QVariant(int, 3)))) has 1 elements
With debugging, one can see that in those situations, the intended list with 3 elements is the one and only element in 'root' list. I expected the list of three elements as 'root' list like MSVC2019 produces.