summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringview.h
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-16 18:16:04 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-05-16 18:16:04 +0300
commit231d3670981a33ec42b91ad1cb33c1fc50551066 (patch)
treeb1ef1096f4e279baaa2ea0d2daf14b5c4185a82f /src/corelib/text/qstringview.h
parentffdd372c7bbda62e9d937f406319f38e3e982774 (diff)
parent8fc1a885d19a2dfb1a3a684aea1cfa41967e041f (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into tqtc/lts-5.15-opensourcev5.15.5-lts-lgpl
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r--src/corelib/text/qstringview.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 38a6a43219..cd5bd3343d 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -244,7 +244,8 @@ public:
}
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos, qsizetype n) const
{
- return QStringView(m_data + qBound(qsizetype(0), pos, m_size), qBound(qsizetype(0), pos + n, m_size) - qBound(qsizetype(0), pos, m_size));
+ return QStringView(m_data + qBound(qsizetype(0), pos, m_size),
+ n == -1 ? m_size - pos : qBound(qsizetype(0), pos + n, m_size) - qBound(qsizetype(0), pos, m_size));
}
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qsizetype n) const
{