Add flag for showing document terminator in text

In 208496091d, the behavior of
QTextOption::ShowLineAndParagraphSeparators was changed to also
include a section symbol at the end of the document. This was
an unnecessary behavioral change. Instead we add a separate flag
for this marker.

[ChangeLog][QtGui][Text] Added QTextOption::ShowDocumentTerminator
flag.

Task-number: QTBUG-52048
Change-Id: I2f6f7e5c9c894f46525682f2c6520a7003fa09bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
bb10
Eskil Abrahamsen Blomfeldt 2016-03-29 18:33:35 +02:00
parent bfe86cb642
commit 53180c430f
3 changed files with 9 additions and 2 deletions

View File

@ -1569,8 +1569,12 @@ void QTextEngine::validate() const
layoutData = new LayoutData();
if (block.docHandle()) {
layoutData->string = block.text();
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
layoutData->string += QLatin1Char(block.next().isValid() ? 0xb6 : 0xA7);
if (block.next().isValid()) {
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
layoutData->string += QChar(0xb6);
} else if (option.flags() & QTextOption::ShowDocumentTerminator) {
layoutData->string += QChar(0xA7);
}
} else {
layoutData->string = text;
}

View File

@ -309,6 +309,8 @@ QList<QTextOption::Tab> QTextOption::tabs() const
this width is excluded.
\value ShowTabsAndSpaces Visualize spaces with little dots, and tabs with little arrows.
\value ShowLineAndParagraphSeparators Visualize line and paragraph separators with appropriate symbol characters.
\value ShowDocumentTerminator Visualize the end of the document with a section sign. This enum value was added
in Qt 5.7.
\value AddSpaceForLineAndParagraphSeparators While determining the line-break positions take into account the
space added for drawing a separator character.
\value SuppressColors Suppress all color changes in the character formats (except the main selection).

View File

@ -109,6 +109,7 @@ public:
ShowLineAndParagraphSeparators = 0x2,
AddSpaceForLineAndParagraphSeparators = 0x4,
SuppressColors = 0x8,
ShowDocumentTerminator = 0x10,
IncludeTrailingSpaces = 0x80000000
};
Q_DECLARE_FLAGS(Flags, Flag)