diff mbox series

[10/34] kernelshark: Use sliced() or first() instead of mid/right/left()

Message ID 20240114171723.14092-11-dev@benjarobin.fr (mailing list archive)
State Accepted
Commit 982a3157c09b413a4658fbe716f77ff4811e7c80
Headers show
Series Fix kernelshark issues introduced by the migration to Qt6 | expand

Commit Message

Benjamin ROBIN Jan. 14, 2024, 5:16 p.m. UTC
Fix Clazy warning and it is faster.

Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
---
 src/KsMainWindow.cpp | 2 +-
 src/KsUtils.cpp      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/KsMainWindow.cpp b/src/KsMainWindow.cpp
index 68853d6..72ad371 100644
--- a/src/KsMainWindow.cpp
+++ b/src/KsMainWindow.cpp
@@ -1275,7 +1275,7 @@  void KsMainWindow::_load(const QString& fileName, bool append)
 		pbLabel += fileName;
 	} else {
 		pbLabel += "...";
-		pbLabel += fileName.mid(fileName.size() - 37, 37);
+		pbLabel += fileName.sliced(fileName.size() - 37);
 	}
 
 	setWindowTitle("Kernel Shark");
diff --git a/src/KsUtils.cpp b/src/KsUtils.cpp
index a68e4c1..b84add4 100644
--- a/src/KsUtils.cpp
+++ b/src/KsUtils.cpp
@@ -534,8 +534,8 @@  QVector<int> parseIdList(QString v_str)
 		int i = item.indexOf('-');
 		if (i > 0) {
 			/* This item is an interval. */
-			int to = item.right(item.size() - i - 1).toInt();
-			int from = item.left(i).toInt();
+			int to = item.sliced(i + 1).toInt();
+			int from = item.first(i).toInt();
 			int s = v.size();
 
 			v.resize(s + to - from + 1);