Hi!

We had a discussion in the Qt Contributor Summit 2026 about our text components 
defaulting to AutoText.

For context, when using this text format, Qt analyzes the text content: If it 
is HTML, then it uses the RichText format in Qt Widgets and StyledText format 
in Qt Quick (components like QLabel, Text and Label).

It was intended as a convenience, so you wouldn't have to manually enable rich 
text support all over the place. Unfortunately, it has security implications. 
If applications are neglecting to override this format for components showing 
end user-provided content, they will get accidental rich text support in the 
most unexpected places. This can lead to broken layouts, obfuscating text, 
large memory allocations, and even triggering downloads of remote data using 
image tags.

Over time, it has turned out that this is a significant trap which regularly 
surprises users, and we've realized that AutoText was a mistake. (To add to the 
injury, it only supports RichText and PlainText, as we cannot detect Markdown, 
so in general it is an outdated concept.)

In the session in Qt CS, consensus was that Qt should be secure by default and 
that the AutoText is not that. So, while it will break a lot of existing apps, 
the proposal is to change it in Qt 6.13. To make a final decision on this, I 
want to raise the discussion here. Ideally, I would like to add a warning about 
this in Qt 6.12.1, which is planned for release next week, so there isn't a lot 
of time if we want to reach that deadline. If more time is needed, then the 
next release is mid-January.

Summary of Qt CS session here, with some links to action items: 
https://qt-project.atlassian.net/browse/QTCS-34

Here is my current list of things we would like to do:


  *
Add run-time warning to Qt 6.12.x which triggers whenever AutoText gets 
resolved to RichText/StyledText. This detects intentional use and alerts 
developers that they need to update their code before the next minor release. 
Work in progress for Qt Widgets here: 
https://codereview.qt-project.org/c/qt/qtbase/+/784816
  *
Add compile-time warnings using qmllint and clazy to detect uses where AutoText 
is used with either rich text or undeterminable (possibly user-provided) text.
  *
Blog about it and try to spread the word as much as possible
  *
Change the default from AutoText to PlainText in Qt 6.13.  Possibly with an 
environment variable to manually select the old behavior.
  *
For the static functions in QMessageBox, it does not make sense to warn, since 
there would be no way for users to fix the warning in the Qt 6.12 timespan. But 
in Qt 6.13, we can deprecate the existing functions and replace them with ones 
that also accept a text format.
  *
In Qt Widgets, add convenience constructors that take a text format as well as 
a string in classes such as QLabel.
  *
For cases like QToolTip, it has always been rich text enabled and there is no 
way in the API to make it plain text-only. I would consider tooltips with 
user-provided content rare enough that we can just document this, as done in 
the patch linked above.

Looking forward to hearing more opinions on this.


--

Eskil Abrahamsen Blomfeldt

Principal Manager, Graphics Engines



The Qt Company

Sandakerveien 116

0484, Oslo, Norway

[email protected]

+47 938 85 836

http://qt.io



The Future is Written with Qt

--



Confidential
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to