From ef0e96e447eb06c978b80ce1086c68d8772f3859 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Fri, 24 Feb 2023 07:58:51 -0500 Subject: [PATCH] Qt: Revert to our function for displaying bit speed with units The Qt formattedDataSize() locale aware function only handles sizes in bytes, not other units. Revert to using our format_size() function from wsutil for the bits per second display string in the Conversation window. Fix #18211 --- ui/qt/models/atap_data_model.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/qt/models/atap_data_model.cpp b/ui/qt/models/atap_data_model.cpp index 635821bba8..c3d6ad8e55 100644 --- a/ui/qt/models/atap_data_model.cpp +++ b/ui/qt/models/atap_data_model.cpp @@ -765,9 +765,9 @@ QVariant ConversationDataModel::data(const QModelIndex &idx, int role) const return role == Qt::DisplayRole ? QString::number(duration, 'f', width) : (QVariant)duration; } case CONV_COLUMN_BPS_AB: - return bpsCalculated ? (role == Qt::DisplayRole ? formatString(bps_ab) : QVariant((qlonglong)bps_ab)): QVariant(); + return bpsCalculated ? (role == Qt::DisplayRole ? gchar_free_to_qstring(format_size((int64_t)bps_ab, FORMAT_SIZE_UNIT_BITS_S, FORMAT_SIZE_PREFIX_SI)) : QVariant((qlonglong)bps_ab)): QVariant(); case CONV_COLUMN_BPS_BA: - return bpsCalculated ? (role == Qt::DisplayRole ? formatString(bps_ba) : QVariant((qlonglong)bps_ba)): QVariant(); + return bpsCalculated ? (role == Qt::DisplayRole ? gchar_free_to_qstring(format_size((int64_t)bps_ba, FORMAT_SIZE_UNIT_BITS_S, FORMAT_SIZE_PREFIX_SI)) : QVariant((qlonglong)bps_ba)): QVariant(); } } else if (role == Qt::ToolTipRole) { if (idx.column() == CONV_COLUMN_START || idx.column() == CONV_COLUMN_DURATION)