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

Basic TextArea functionality depends on C++

XMLWordPrintable

    • 045f9ce19 (dev)

      The following TextArea-based editor example shows that even basic features such as bold/not-bold seem to depend on the C++-only features of QTextDocument:

      https://qt-project.org/doc/qt-5.1/qtquickcontrols/text.html

      The QML code reads:

      onTriggered: document.bold = !document.bold

      When document is a DocumentHandler that manipulates the underlying QTextDocument of the TextArea.

      Besides being limiting to pure QML code, this is even more of an issue when we consider that the manipulation of that underlying QTextDocument is itself vaguely defined. The documentation reads:

      Warning: The QTextDocument provided is used internally by Qt Quick
      elements to provide text manipulation primitives. You are not
      allowed to perform any modification of the internal state of the
      QTextDocument. If you do, the element in question may stop
      functioning or crash.

      So not only one has to resort to the C++ API for basic manipulation of the TextArea, but it's unclear which of these operations are in fact safe.

      It would be useful to have more of that API clearly and cleanly exposed to QML code.

        For Gerrit Dashboard: QTBUG-36521
        # Subject Branch Project Status CR V

            srutledg Shawn Rutledge
            niemeyer Gustavo Niemeyer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes