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

Text improvements

XMLWordPrintable

      Overview

      We want to improve text handling in general and allow more advanced visual effects.
      The goal is to be able to do the effects common in presentation programs and a simple ebook reader entirely in QML.

      Current thoughts

      We want to separate the layout process from the visual Text element.

      • a TextLayout QML or JS object would do the layout (possibly in a separate thread) and provide an imperative JS API to manipulate the different elements of the text (paragraphs, lines, words, characters).
      • the Text element would become a simple view of a TextLayout.

      Status

      A TextLayout takes some text and a width and layouts the text accordingly.

      TextLayout {
          id: textLayout
          text: "..."
          width: 450
      }
      

      A Text element can refer to the layout and display the text.

      Text {
          layout: textLayout
          color: "white"
      }
      

      It is possible to get a list of line elements (currently QObjects) through JS and set properties on them (currently x, y, color).

      for (var i = 0; i < textLayout.lineCount; ++i)
      {
          var line = textLayout.lineAt(i);
          line.x = i * 10
          line.y = 25
          line.color = "red"
      }
      

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

            bodson Yann Bodson (Inactive)
            minshin Minjung Shin (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes