mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 22:52:33 -06:00
Use slice method where applicable
These code segments already have its boundary checked and can thus be faster. PR #22411.
This commit is contained in:
@@ -46,7 +46,7 @@ void SearchSortModel::setNameFilter(const QString &searchTerm)
|
||||
{
|
||||
m_searchTerm = searchTerm;
|
||||
if ((searchTerm.length() > 2) && searchTerm.startsWith(u'"') && searchTerm.endsWith(u'"'))
|
||||
m_searchTermWords = QStringList(m_searchTerm.mid(1, m_searchTerm.length() - 2));
|
||||
m_searchTermWords = QStringList(m_searchTerm.sliced(1, (m_searchTerm.length() - 2)));
|
||||
else
|
||||
m_searchTermWords = searchTerm.split(u' ', Qt::SkipEmptyParts);
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ void SearchWidget::loadHistory()
|
||||
}
|
||||
|
||||
if (history.size() > m_historyLength)
|
||||
history = history.mid(history.size() - m_historyLength);
|
||||
history.remove(0, (history.size() - m_historyLength));
|
||||
|
||||
m_searchPatternCompleterModel->setStringList(history);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user