diff options
author | David Schulz <[email protected]> | 2025-01-07 10:41:34 +0100 |
---|---|---|
committer | David Schulz <[email protected]> | 2025-01-13 10:03:52 +0000 |
commit | dd4433a1ff63cefbd8d598413dd4bac82a811471 (patch) | |
tree | 9de07cffd89204584e03bebdd22fdbe9097334af /src/libs/utils/textutils.cpp | |
parent | d25d6647e310c52a68984453f41ba60a2e73be12 (diff) |
Utils: pass a document instead of a cursor to Utils::Text::textAt
None of the additional information by the cursor was used and almost all
usages of the function created a text cursor for calling this function.
Change-Id: I2667103738d159b33b7769d1934c435e45bd1bdd
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/libs/utils/textutils.cpp')
-rw-r--r-- | src/libs/utils/textutils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp index c6cc137853e..af5f2719c5f 100644 --- a/src/libs/utils/textutils.cpp +++ b/src/libs/utils/textutils.cpp @@ -156,10 +156,11 @@ int positionInText(const QTextDocument *textDocument, int line, int column) return textDocument->findBlockByNumber(line - 1).position() + column - 1; } -QString textAt(QTextCursor tc, int pos, int length) +QString textAt(QTextDocument *textDocument, int pos, int length) { if (pos < 0) pos = 0; + QTextCursor tc(textDocument); tc.movePosition(QTextCursor::End); const int end = std::min(pos + length, tc.position()); |