From 67b1fa48bea4fcb8c304f1571a9431414b8dfa2f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 21 Dec 2017 08:30:34 +0100 Subject: Update font when text format's letter spacing type is changed The QTextFormat::FontLetterSpacingType property was added outside the span of the FirstFontProperty and LastFontProperty, so the fontDirty flag would not be set when it was changed. There is no binary compatible way to fix this before Qt 6, so for now, we add a special case for it. [ChangeLog][QtGui][Text] Fixed an issue where changing the letter spacing type of a QTextCharFormat would not cause its font to update. Task-number: QTBUG-65345 Change-Id: I5ab53d7f82d529b57edceacfc3fa688c6741cd17 Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt Reviewed-by: C. Boemann Reviewed-by: Simon Hausmann --- src/gui/text/qtextformat.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 8fe474af2c..da36f87230 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -201,8 +201,10 @@ public: inline void insertProperty(qint32 key, const QVariant &value) { hashDirty = true; - if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) + if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) + || key == QTextFormat::FontLetterSpacingType) { fontDirty = true; + } for (int i = 0; i < props.count(); ++i) if (props.at(i).key == key) { props[i].value = value; @@ -216,8 +218,10 @@ public: for (int i = 0; i < props.count(); ++i) if (props.at(i).key == key) { hashDirty = true; - if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) + if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) + || key == QTextFormat::FontLetterSpacingType) { fontDirty = true; + } props.remove(i); return; } -- cgit v1.2.3