Skip to content

Commit

Permalink
改用asprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
heyuanjie87 committed Jul 26, 2022
1 parent cccf896 commit bcebabf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Modem/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void Modem::showTransfer(int total, int remain, float speed)
ui->progress->setValue((int)p);
ui->progress->setFormat(fmt);

fmt = fmt.sprintf("速度:%.2fKB/S 剩余:%d/%dKB",
fmt = fmt.asprintf("速度:%.2fKB/S 剩余:%d/%dKB",
speed/1024, remain/1024, total/1024);
showStatus(fmt);
}
Expand Down
2 changes: 1 addition & 1 deletion NewSession/NewSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void NewSession::makeID(QString &id)
QDateTime dt;

dt = dt.currentDateTime();
id = id.sprintf("%d", dt.toTime_t());
id = id.asprintf("%d", dt.toTime_t());
}

void NewSession::on_sesType_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
Expand Down
2 changes: 1 addition & 1 deletion QTermWidget/QTermWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void QTermWidget::debug(const QByteArray &data)
for (int i = 0; i < data.size(); i ++)
{
QString tmp;
str += tmp.sprintf("0x%02X, ", (unsigned char)(data.data()[i]));
str += tmp.asprintf("0x%02X, ", (unsigned char)(data.data()[i]));
}

qDebug(str.toStdString().data());
Expand Down
4 changes: 2 additions & 2 deletions SendSave/SendSave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void SendSave::on_add_clicked()
QString endline = "\\n";
QString value = "test";

sn.sprintf("%d", ui->tbSave->rowCount() + 1);
sn = QString::asprintf("%d", ui->tbSave->rowCount() + 1);
tableAddRow(sn, type, value, endline);
worker->dbAddRow(sn, sn, type, value, endline);
}
Expand All @@ -131,7 +131,7 @@ void SendSave::on_tbSave_itemChanged(QTableWidgetItem *item)
QString sn;
QString val;

sn.sprintf("%d", item->row() + 1);
sn = QString::asprintf("%d", item->row() + 1);
val = item->text();
worker->dbUpdateRow(sn, item->column(), val);

Expand Down

0 comments on commit bcebabf

Please sign in to comment.