diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-11-08 14:48:23 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-11-13 13:51:22 +0000 |
commit | 51cbd5288c85cb4de382cb23d6f5559c2b626126 (patch) | |
tree | 0dd7bb8cfdafe21682266f9a055f0b2baf3d3ecd /src/widgets/widgets/qlabel_p.h | |
parent | 2735c5bf069bcadefc2d6b626161e1166c2a683b (diff) |
Fix rendering of markdown in QLabel
Since 65314b6ce88cdbb28a22be0cab9856ec9bc9604b there is a TextFormat
for MarkdownText, and QWidgetTextControl supports that, but QLabel
does it in its own way and sets plain text or rich text on the text
document itself. Add a code path for MarkdownText there.
[ChangeLog][QtWidgets][QLabel] Markdown is now a supported textFormat
for QLabel.
Fixes: QTBUG-79766
Change-Id: Ib9370ef300089af2c4d6070e545c5470f32833a8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/widgets/qlabel_p.h')
-rw-r--r-- | src/widgets/widgets/qlabel_p.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h index 59188563a9..6b3fbc5f0c 100644 --- a/src/widgets/widgets/qlabel_p.h +++ b/src/widgets/widgets/qlabel_p.h @@ -93,8 +93,8 @@ public: #endif inline bool needTextControl() const { return isTextLabel - && (isRichText - || (!isRichText && (textInteractionFlags & (Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard)))); + && (effectiveTextFormat != Qt::PlainText + || (textInteractionFlags & (Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard))); } void ensureTextPopulated() const; @@ -134,6 +134,7 @@ public: int shortcutId; #endif Qt::TextFormat textformat; + Qt::TextFormat effectiveTextFormat; Qt::TextInteractionFlags textInteractionFlags; mutable QSizePolicy sizePolicy; int margin; @@ -143,7 +144,6 @@ public: uint scaledcontents : 1; mutable uint textLayoutDirty : 1; mutable uint textDirty : 1; - mutable uint isRichText : 1; mutable uint isTextLabel : 1; mutable uint hasShortcut : 1; #ifndef QT_NO_CURSOR |