From acad1711a6cd98602d06740d7de9b9602eb571c4 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sat, 15 Oct 2022 17:37:55 +0200 Subject: QFileDialog: use QString::remove() instead of mid() Minor, less allocations. Change-Id: I73c188b0030248c6d038fab3dfb949442083d33d Reviewed-by: Volker Hilsheimer --- src/widgets/dialogs/qfiledialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/dialogs/qfiledialog.cpp') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 694c035c26..6974edcaec 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -4157,12 +4157,12 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { #if defined(Q_OS_UNIX) if (currentLocation == QDir::separator()) - return path.mid(currentLocation.size()); + return path.remove(0, currentLocation.size()); #endif if (currentLocation.endsWith(u'/')) - return path.mid(currentLocation.size()); + return path.remove(0, currentLocation.size()); else - return path.mid(currentLocation.size()+1); + return path.remove(0, currentLocation.size()+1); } return index.data(QFileSystemModel::FilePathRole).toString(); } -- cgit v1.2.3