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