From 284eab836cd2362c9f08648faa380a4b904bd239 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 24 Sep 2019 14:39:20 +0200 Subject: [PATCH] Help/litehtml: Fix text search in presence of multi-byte characters std::string::size is returning byte-count, not character count, in contrast to QString::size. Do not mix. Fixes: QTCREATORBUG-22970 Change-Id: I865ca0c13a08fb500b6526ba6ee3207359e75107 Reviewed-by: hjk --- src/plugins/help/qlitehtml/container_qpainter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/help/qlitehtml/container_qpainter.cpp b/src/plugins/help/qlitehtml/container_qpainter.cpp index 6801513c2d9..341c8b712f5 100644 --- a/src/plugins/help/qlitehtml/container_qpainter.cpp +++ b/src/plugins/help/qlitehtml/container_qpainter.cpp @@ -641,8 +641,9 @@ void DocumentContainer::buildIndex() current->get_text(text); if (!text.empty()) { m_index.indexToElement.push_back({index, current}); - m_index.text += QString::fromStdString(text); - index += text.size(); + const QString str = QString::fromStdString(text); + m_index.text += str; + index += str.size(); } } current = nextLeaf(current, m_document->root());