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>
This commit is contained in:
Marc Mutz 2020-04-27 13:44:29 +02:00
parent f58c8fb453
commit bfde4f4a96

View File

@ -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")