use formattedDataSize for displaying sizes
This commit is contained in:
parent
9c094fb094
commit
8975d15683
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QLocale>
|
||||
#include <QMetaEnum>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -172,6 +173,10 @@ static inline T orThrow(Option<T> opt, Error err) {
|
|||
}
|
||||
}
|
||||
|
||||
static inline QString toBinSize(qint64 bytes) {
|
||||
return QLocale().formattedDataSize(bytes, 2, QLocale::DataSizeSIFormat);
|
||||
}
|
||||
|
||||
static inline QDebug operator<<(QDebug debug, std::string const &t) {
|
||||
debug << QString::fromStdString(t);
|
||||
return debug;
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace Arc {
|
|||
switch(col) {
|
||||
case Column::Size:
|
||||
if(auto file = node->getFile()) {
|
||||
return QVariant{QString::number(file->size())};
|
||||
return QVariant{toBinSize(file->size())};
|
||||
}
|
||||
break;
|
||||
case Column::Type:
|
||||
|
|
Loading…
Reference in New Issue
Block a user