diff options
Diffstat (limited to 'src/corelib/text/qbytearrayview.h')
-rw-r--r-- | src/corelib/text/qbytearrayview.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h index 40205cae9c..612dbc3e82 100644 --- a/src/corelib/text/qbytearrayview.h +++ b/src/corelib/text/qbytearrayview.h @@ -260,9 +260,19 @@ public: [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const { return QtPrivate::toIntegral<qulonglong>(*this, ok, base); } [[nodiscard]] float toFloat(bool *ok = nullptr) const - { return QtPrivate::toFloat(*this, ok); } + { + const auto r = QtPrivate::toFloat(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0f); + } [[nodiscard]] double toDouble(bool *ok = nullptr) const - { return QtPrivate::toDouble(*this, ok); } + { + const auto r = QtPrivate::toDouble(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0); + } [[nodiscard]] bool startsWith(QByteArrayView other) const noexcept { return QtPrivate::startsWith(*this, other); } |