Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1
-
-
64a560d977a0a511ef541d6116d82e7b5c911a92 e0c798742adbc984e71c0f65cc432101da5b9c52
Description
Setting a QObject property is not working as expected. If we execute the following commands:
test.setProperty("a", "");
test.setProperty("a", false);
And then try to print value of "a", we get as "". Result expected here is false.
I checked the underlying code and observed that logic compares the old value to new value and updates only in these are different. but in this case, code treats "" as false, and don't update property value. May be QVariant::operator== needs to modified.
As a workaround, we can set property as invalid before setting it to false.
Attaching the sample project also.
Attachments
For Gerrit Dashboard: QTBUG-69744 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
236055,2 | QObject: do allow setProperty() to change the type of the property | 5.11 | qt/qtbase | Status: MERGED | +2 | 0 |
236078,3 | QObject: do allow setProperty() to change the type of the property | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |