Am 04.08.26 um 10:46 schrieb Cristián Maureira-Fredes via Development:


On 8/3/26 7:26 PM, Andreas Hartmetz wrote:
Am 29.07.26 um 09:52 schrieb Kai Uwe Broulik:
Hi everyone,

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.
A probably impractical idea to preserve some of the convenience: Distinguish "static" text input from "runtime" text input and preserve the auto rich text feature for the former. Some languages make a distinction between user-supplied strings and validated strings, but that seems like much too big of a change. This would need a predictable and conservative (if in doubt, not richt text) heuristic to really improve safety and the ability to see through translations to make it useful enough. Just mentioning it in case somebody can think of a good way to implement it.

Like something similar to Template String from Python?
https://peps.python.org/pep-0750/
or you had a diff feature from another programming language in mind?


I mainly combined these ideas:
- AutoText is only a security problem if the string is externally
  supplied
- Fixed strings in the (QML) source code are not externally supplied
- The QML engine has some compiler-like facilities that could possibly,
  with minimal extra effort, identify fixed strings in the source code;
  not sure how much of that runs in maximally interpreted mode.

The minimal extra effort part is important for the cost-benefit ratio to make any sense.

AutoText also seems most useful when throwing something together quickly without much care (prototypes and such), which is a case in which fixed or at most translated strings are very common.
--
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to