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