summaryrefslogtreecommitdiff
path: root/examples/network
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-04-27 13:44:29 +0200
committerMarc Mutz <marc.mutz@kdab.com>2020-04-27 18:11:13 +0000
commitbfde4f4a962ca56a7f2d7d63e788e79aa64cfb1f (patch)
treed6e58bb951a338cc323522c01b3f250feb459d62 /examples/network
parentf58c8fb4537c5d751da9d2c86ca0f61ad0adbbb2 (diff)
downloadqtbase-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.cpp2
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")