torrent example: fix premature pessimisation
Use case-insensitive endsWith() instead of lowering a QString and then comparing case-sensitively. As a drive-by, replace ascii string literal with char16_t one. Change-Id: Id4d8e5b197baba7aa3ae4c2ae57414c1242b3827 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
c86aa00431
commit
616000ed7f
@ -405,7 +405,7 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(torrentView);
|
||||
|
||||
QString baseFileName = QFileInfo(fileName).fileName();
|
||||
if (baseFileName.toLower().endsWith(".torrent"))
|
||||
if (baseFileName.endsWith(u".torrent", Qt::CaseInsensitive))
|
||||
baseFileName.chop(8);
|
||||
|
||||
item->setText(0, baseFileName);
|
||||
|
Loading…
Reference in New Issue
Block a user