Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.12, 5.13, 5.14, 5.15, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8
-
None
-
-
61b17127a (dev)
Description
On Qt 5.9 a string with only white-spaces (eg. ' ') passed to QByteArray::toDouble() will produce a failed convertion with the ok flag set to false.
But since at least Qt 5.12, the ok flag is now true.
While with QString::toDouble(), it remained false until now.
Tested on Qt 5.12, 5.15, 6.2, 6.8.
The attached program allows to the issue.
Qt 5.9 output:
QByteArray: " " val: 0 ok: false QByteArray: " " val: 0 ok: false QByteArray: "" val: 0 ok: false QString: " " val: 0 ok: false QString: " " val: 0 ok: false QString: "" val: 0 ok: false
Qt 5.12 and later output:
QByteArray: " " val: 0 ok: true QByteArray: " " val: 0 ok: true QByteArray: "" val: 0 ok: false QString: " " val: 0 ok: false QString: " " val: 0 ok: false QString: "" val: 0 ok: false
This seems like an old bug but I have not found any other issue on this or a documentation about this change.
Attachments
For Gerrit Dashboard: QTBUG-137038 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
649073,1 | QByteArray: make toDouble() reject space-only strings | 6.9 | qt/qtbase | Status: NEW | +2 | 0 |
646912,2 | QByteArray: make toDouble() reject space-only strings | dev | qt/qtbase | Status: MERGED | +2 | 0 |