Hi,

I won't mention any specific version in the warning, just "a future Qt 
release." That way we can continue the discussion of which version changes the 
default after this. I hope to have both the patches to add the warnings up 
today, since this is the urgent part.

Deprecate and replace existing functions/properties: I don’t like that the new 
names will be longer.  Wouldn’t it be nice to eventually get back to what we 
already have, except with the default format being plain text?  If we warn 
about auto-detection for a while (every time it actually happens), and then 
just change the behavior in some future release before the next LTS, maybe we 
don’t need to rename anything.

I think it can mostly be solved without replacing any functions, just changing 
the default. The static functions in QMessageBox are a bit more tricky, since 
they don't have any way to override the text format. So we can't really add a 
warning there since there will be no way to silence it without adding new API.

I think accepting that these default to rich text is one option, same as for 
QToolTip. You could still get into traps if you show an error dialog with 
something like a filename which includes HTML tags for instance, but at some 
point, maybe it is the user's responsibility to familiarize themselves with the 
documented behavior.

An alternative is to add overloads that accept a text format in Qt 6.13 and 
then start warning that we will change the default in the next one.

Either way, I think QLabel/Text/Label are the most important ones to fix first, 
so I will focus on those.

--
Eskil Abrahamsen Blomfeldt
Principal Manager, Graphics Engines

The Qt Company
Sandakerveien 116
0484 Oslo, Norway
[email protected]
http://qt.io

Confidential
________________________________
From: Development <[email protected]> on behalf of Shawn 
Rutledge via Development <[email protected]>
Sent: Thursday, November 5, 2026 9:54 AM
To: List for announcements regarding Qt releases and development via Announce 
via Development <[email protected]>
Subject: Re: [Development] Changing the default of AutoText to PlainText



On Nov 2, 2026, at 16:00, Eskil Abrahamsen Blomfeldt via Development 
<[email protected]> wrote:

  *
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.


I worry whether 6.13 is too soon to change behavior.  But I want to eventually 
get rid of the AutoText implementation, because it’s not possible to be 
completely correct: to be reasonable, we only try to detect an HTML tag within 
some prefix of the whole text; and we cannot detect markdown.  Plain text is 
also HTML (the whole thing is one paragraph) and is also markdown 
(double-newlines are significant).

So we should do what we can to encourage specifying text format whenever it’s 
not plain text and whenever it comes from user input: we need the warning ASAP. 
But we might also expect someone to write a bug about the default changing.  
Maybe that’s also ok, we just mark it invalid: I’m not sure how big a deal that 
would be for anyone.  Warning over a somewhat longer period (until 6.14?) might 
soften the blow.

Deprecate and replace existing functions/properties: I don’t like that the new 
names will be longer.  Wouldn’t it be nice to eventually get back to what we 
already have, except with the default format being plain text?  If we warn 
about auto-detection for a while (every time it actually happens), and then 
just change the behavior in some future release before the next LTS, maybe we 
don’t need to rename anything.

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

Reply via email to