diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-27 09:12:18 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-29 12:08:08 +0100 |
| commit | d7575ae2a750173786d0d98b7b9b3cc9893ac15c (patch) | |
| tree | f438f7ea5bc37e6d7b8eb0f6c26aef2657db80c9 /src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml | |
| parent | 4ceb343e7f006972940b6880f974770c02fa6b87 (diff) | |
Dialogs: Pass fileSize as double rather than string
Passing it as string gives the illusion of greater accuracy. However,
the string is coerced to double again when calling formattedDataSize().
Therefore the accuracy is indeed an illusion.
Admit to the limited accuracy and range-check the number. 9PB should
be enough for everyone.
Pick-to: 6.7
Change-Id: If0ce5a762dce0b1df35ccb57af87d87719750786
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml')
| -rw-r--r-- | src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml b/src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml index ac543e735d..a28d9dea08 100644 --- a/src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml +++ b/src/quickdialogs/quickdialogsquickimpl/qml/FileDialogDelegateLabel.qml @@ -50,7 +50,12 @@ Item { implicitHeight: childrenRect.height Label { - text: locale.formattedDataSize(root.delegate.fileSize) + text: { + const fileSize = root.delegate.fileSize; + return fileSize > Number.MAX_SAFE_INTEGER + ? ('>' + locale.formattedDataSize(Number.MAX_SAFE_INTEGER)) + : locale.formattedDataSize(fileSize); + } font.pixelSize: root.delegate.font.pixelSize * 0.75 color: root.fileDetailRowTextColor } |
