Utils: FsEngine micro-optimizations

Mostly for shorter code, but also save a few cycles due to less
string construction and run time dispatch.

Also, make testFilePathFromToString() test two paths instead one path
twice.

Change-Id: I50a3145bca1a4b262a15e96173ea7ebd9cb678ad
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2022-11-29 10:28:37 +01:00
parent f7d022009b
commit 8249eabbad
7 changed files with 46 additions and 63 deletions

View File

@@ -138,10 +138,8 @@ bool FolderSortProxyModel::filterAcceptsRow(int source_row, const QModelIndex &s
if (static_cast<QFileSystemModel *>(sourceModel())->rootPath().isEmpty()) {
QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
while (sourceIndex.isValid()) {
if (sourceIndex.data().toString()
== FilePath::specialPath(FilePath::SpecialPathComponent::RootName)) {
if (sourceIndex.data().toString() == FilePath::specialRootName())
return false;
}
sourceIndex = sourceIndex.parent();
}