Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.0 Beta3
-
None
-
a25644aec (dev), 7d86115a1 (6.5.0), 40f20ed9e (6.5)
Description
Comparing a valid QVariant containing an integer value 0 with any QString through operator== returns true.
If the QVariant contains any other value the comparison produces the expected output.
The following test
const QVariant myInt0(0); const QVariant myInt1(1); const QVariant myString("my string"); qDebug() << myInt0 << myString << (myInt0 == myString) << (myInt0 != myString); qDebug() << myInt1 << myString << (myInt1 == myString) << (myInt1 != myString);
prints the following lines:
> QVariant(int, 0) QVariant(QString, "my string") true false > QVariant(int, 1) QVariant(QString, "my string") false true
Tested also with Qt 6.2.3 and 6.4.2 and here both the comparisons work as expected.