Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-117106

Expose QString::toHtmlEscaped() to QML

    XMLWordPrintable

Details

    • All

    Description

      Escaping HTML input might come in handy for adding custom formatting to a rich text label.

      In KDE we often find ourselves reimplementing and copy-pasting basic variant of `sanitize` function, hoping that it would be enough for QtQuick/Text parser. Of course, doing in it JavaScript, like constructing a mapping table or regex of every call isn't very efficient, let alone dealing code duplication in the long term.

      How about exposing Qt Core method QString::toHtmlEscaped as a global Qt.toHtmlEscaped function?

      It would be a nice addition to the supported standard global functions encodeURI, decodeURIComponent, … family.

      If there are no objections, I could give a shot, and send a patch with tests later.


      For the context: https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1716

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            ratijas ivan tkachenko
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes