From d1186f9299f1351236269a0db39d43fdae28a944 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Thu, 13 Feb 2020 12:56:07 +0100 Subject: Doc: Update description of QTextDocument::characterCount A QTextDocument always contains a QChar::ParagraphSeparator, so characterCount() will always return actual count + 1. The tests confirm this behavior, make it explicit in the docs. Fixes: QTBUG-80597 Change-Id: I91040fb6eb2c4fae5235458c695110f8f15bdfea Reviewed-by: Volker Hilsheimer Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Leena Miettinen --- src/gui/text/qtextdocument.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui/text/qtextdocument.cpp') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 1353568ec1..7d0a0b2168 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -904,6 +904,9 @@ int QTextDocument::lineCount() const Returns the number of characters of this document. + \note As a QTextDocument always contains at least one + QChar::ParagraphSeparator, this method will return at least 1. + \sa blockCount(), characterAt() */ int QTextDocument::characterCount() const -- cgit v1.2.3