mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 08:54:13 -04:00
Merge pull request #2991 from thunder2/qt6-sprintf
Replaced deprecated QString::sprintf by QString::asprintf
This commit is contained in:
commit
cbc1a89505
4 changed files with 15 additions and 15 deletions
|
@ -95,7 +95,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
for(int i = 0; i < 4; ++i) {
|
||||
if (fileSize < 1024) {
|
||||
fileSize = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", fileSize / multi);
|
||||
temp = QString::asprintf("%.2f ", fileSize / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
for(int i = 0; i < 4; ++i) {
|
||||
if (remaining < 1024) {
|
||||
remaining = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", remaining / multi);
|
||||
temp = QString::asprintf("%.2f ", remaining / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
for(int i = 0; i < 4; ++i) {
|
||||
if (completed < 1024) {
|
||||
completed = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", completed / multi);
|
||||
temp = QString::asprintf("%.2f ", completed / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
temp = "";
|
||||
} else {
|
||||
temp.clear();
|
||||
temp.sprintf("%.2f", dlspeed/1024.);
|
||||
temp = QString::asprintf("%.2f", dlspeed/1024.);
|
||||
temp += " KB/s";
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
|
|
|
@ -93,7 +93,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
for(int i = 0; i < 4; ++i) {
|
||||
if (fileSize < 1024) {
|
||||
fileSize = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", fileSize / multi);
|
||||
temp = QString::asprintf("%.2f ", fileSize / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
for(int i = 0; i < 4; ++i) {
|
||||
if (transferred < 1024) {
|
||||
transferred = index.data().toLongLong();
|
||||
temp.sprintf("%.2f ", transferred / multi);
|
||||
temp = QString::asprintf("%.2f ", transferred / multi);
|
||||
temp += byteUnits[i];
|
||||
break;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
temp = "";
|
||||
} else {
|
||||
temp.clear();
|
||||
temp.sprintf("%.2f", ulspeed/1024.);
|
||||
temp = QString::asprintf("%.2f", ulspeed/1024.);
|
||||
temp += " KB/s";
|
||||
}
|
||||
painter->drawText(option.rect, Qt::AlignRight | Qt::AlignVCenter, temp);
|
||||
|
|
|
@ -450,15 +450,15 @@ QString ToNumberUnits(uint32_t count)
|
|||
QString ans;
|
||||
if (count > 1000000)
|
||||
{
|
||||
ans.sprintf("%6.2fm", count / 1000000.0);
|
||||
ans = QString::asprintf("%6.2fm", count / 1000000.0);
|
||||
}
|
||||
else if (count > 1000)
|
||||
{
|
||||
ans.sprintf("%6.2fk", count / 1000.0);
|
||||
ans = QString::asprintf("%6.2fk", count / 1000.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ans.sprintf("%6d", count);
|
||||
ans = QString::asprintf("%6d", count);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
|
|
@ -96,12 +96,12 @@ void BWListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
|
||||
switch(index.column()) {
|
||||
case COLUMN_IN_RATE:
|
||||
temp.sprintf("%.3f ", index.data().toFloat());
|
||||
temp = QString::asprintf("%.3f ", index.data().toFloat());
|
||||
//temp=QString::number(index.data().toFloat());
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
case COLUMN_IN_MAX:
|
||||
temp.sprintf("%.3f ", index.data().toFloat());
|
||||
temp = QString::asprintf("%.3f ", index.data().toFloat());
|
||||
//temp=QString::number(index.data().toFloat());
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
|
@ -112,7 +112,7 @@ void BWListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
case COLUMN_IN_ALLOC:
|
||||
flValue = index.data().toFloat();
|
||||
if (flValue < std::numeric_limits<float>::max()){
|
||||
temp.sprintf("%.3f ", flValue);
|
||||
temp = QString::asprintf("%.3f ", flValue);
|
||||
} else {
|
||||
temp=strNA;
|
||||
}
|
||||
|
@ -128,12 +128,12 @@ void BWListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
case COLUMN_OUT_RATE:
|
||||
temp.sprintf("%.3f ", index.data().toFloat());
|
||||
temp = QString::asprintf("%.3f ", index.data().toFloat());
|
||||
//temp=QString::number(index.data().toFloat());
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
case COLUMN_OUT_MAX:
|
||||
temp.sprintf("%.3f ", index.data().toFloat());
|
||||
temp = QString::asprintf("%.3f ", index.data().toFloat());
|
||||
//temp=QString::number(index.data().toFloat());
|
||||
painter->drawText(option.rect, Qt::AlignRight, temp);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue