Kai Uwe Broulik (29 July 2026 09:52) wrote:
> Qt has a feature called AutoText where when you have a label (both in Qt
> Widgets and Qt Quick) and its contents “look like HTML”
> (Qt::mightBeRichText) it will switch to rich text (styled text) and
> start interpreting it as HTML.
>
> Just name a file or a Wifi SSID "<h1>hello.txt" and ...
A stray thought prompted by this: Qt::mightBeRichText() uses a fairly
dumb heuristic, just looking for something tag-like before the first
newline. One potential mitigation would be to relegate that to a
pre-test and have a slightly more stringent test for AutoText, say
looksLikeRichText(), which uses that precheck and, if it passes, does
something closer to a (cheap as we can sensibly make it) check that the
apparent rich-text is well-formed. For plain text this stays cheap, for
HTML it costs a bit more, but we'd avoid the "mark-up spills out of the
text into other things" issue (assuming we made that the focus of the
approximate-validity check).
I'm not familiar with the relevant infrastructure, though, so perhaps
that increase in cost would be a significant impediment to making such a
change. If not, would it in fact mitigate the problem you're describing
adequately ?
Eddy.
--
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development