diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-04-27 14:05:21 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-05 05:28:19 +0000 |
commit | 616000ed7f1b2e60d8766c36eab5b86c9c8e6ee3 (patch) | |
tree | 2a172bde727515a5e60a164238f2bb6d11c80fc3 /examples | |
parent | c86aa0043137e95d8fc5c1ab69b613b5a2cc8650 (diff) |
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>
Diffstat (limited to 'examples')
-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 36c8d5982d..129ded3fa4 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -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); |