diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-04-27 13:44:29 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-04-27 18:11:13 +0000 |
commit | bfde4f4a962ca56a7f2d7d63e788e79aa64cfb1f (patch) | |
tree | d6e58bb951a338cc323522c01b3f250feb459d62 /examples/network | |
parent | f58c8fb4537c5d751da9d2c86ca0f61ad0adbbb2 (diff) | |
download | qtbase-bfde4f4a962ca56a7f2d7d63e788e79aa64cfb1f.tar.gz |
torrent example: fix stripping of file extension
Due to QChar being convertible from almost any integral type,
the old code actually called QString::remove(QChar).
Fix by using QString::chop() instead.
Change-Id: I345b018aa137ecff608a130e69ade5d37ef0805c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/network')
-rw-r--r-- | examples/network/torrent/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index c343ee81b9..0d56858514 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -407,7 +407,7 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF QString baseFileName = QFileInfo(fileName).fileName(); if (baseFileName.toLower().endsWith(".torrent")) - baseFileName.remove(baseFileName.size() - 8); + baseFileName.chop(8); item->setText(0, baseFileName); item->setToolTip(0, tr("Torrent: %1<br>Destination: %2") |