diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-23 11:29:55 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-02-12 19:40:09 +0000 |
commit | f2e3fdc803b9842b6ba4aefe7becdd42eafc4d38 (patch) | |
tree | 02d3c5e43602c6c3c729614fe3655ec9a8b5b8c1 /examples/network/torrent/addtorrentdialog.cpp | |
parent | 05c38a9111320da311e5993faf12ce8e1f1713e8 (diff) |
examples: migrate to QString::asprintf
Not that many, if any, uses of sprintf here were idiomatic Qt,
but that's for another commit.
Change-Id: Ic34470d9799942f786770ba9541b29c34d67c6f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'examples/network/torrent/addtorrentdialog.cpp')
-rw-r--r-- | examples/network/torrent/addtorrentdialog.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/network/torrent/addtorrentdialog.cpp b/examples/network/torrent/addtorrentdialog.cpp index 4c63d3293e..a0d21598c3 100644 --- a/examples/network/torrent/addtorrentdialog.cpp +++ b/examples/network/torrent/addtorrentdialog.cpp @@ -48,16 +48,14 @@ static QString stringNumber(qint64 number) { - QString tmp; if (number > (1024 * 1024 * 1024)) - tmp.sprintf("%.2fGB", number / (1024.0 * 1024.0 * 1024.0)); + return QString::asprintf("%.2fGB", number / (1024.0 * 1024.0 * 1024.0)); else if (number > (1024 * 1024)) - tmp.sprintf("%.2fMB", number / (1024.0 * 1024.0)); + return QString::asprintf("%.2fMB", number / (1024.0 * 1024.0)); else if (number > (1024)) - tmp.sprintf("%.2fKB", number / (1024.0)); + return QString::asprintf("%.2fKB", number / (1024.0)); else - tmp.sprintf("%d bytes", int(number)); - return tmp; + return QString::asprintf("%d bytes", int(number)); } AddTorrentDialog::AddTorrentDialog(QWidget *parent) |