diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-11-02 09:50:54 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-11-02 22:08:15 +0100 |
commit | 43028212ffc4d126ba81928ac051bdb136c057af (patch) | |
tree | 24205b6af56955d97507c7f6c2a97bb6814ad113 /src/qml/qml/qqmldatablob_p.h | |
parent | 5e40a44ebb89fdf5f4fb6ee2a85193e5fbc3e6c3 (diff) |
QQmlDataBlob: Take and return qreal for progress
QQmlDataBlob so far took and returned a quint8 for progress – however
the sole consumer of it expected a qreal in the [0;1] range.
progress returning an integer dates back all the way to
22a7d19d68bab2882fd9a6ebefd65152bbc1eaf5; the reason why this did not
create issues in practice is that the code path is only exercised when
downloading QML files over the network, which turned out to be a rather
uncommon use case.
Change-Id: I0140729955e393a19000adabe55f40fdd2caa04d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmldatablob_p.h')
-rw-r--r-- | src/qml/qml/qqmldatablob_p.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/qml/qqmldatablob_p.h b/src/qml/qml/qqmldatablob_p.h index 522d02e97a..b54f71c79e 100644 --- a/src/qml/qml/qqmldatablob_p.h +++ b/src/qml/qml/qqmldatablob_p.h @@ -181,13 +181,14 @@ private: } } - inline quint8 progress() const + inline qreal progress() const { - return quint8((_p.loadRelaxed() & ProgressMask) >> ProgressShift); + return quint8((_p.loadRelaxed() & ProgressMask) >> ProgressShift) / float(0xFF); } - inline void setProgress(quint8 v) + inline void setProgress(qreal progress) { + quint8 v = 0xFF * progress; while (true) { int d = _p.loadRelaxed(); int nd = (d & ~ProgressMask) | ((v << ProgressShift) & ProgressMask); |