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

Add a way to change QTextEdit's line-breaking algorithm

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • GUI: Text handling
    • None

    Description

      I want to change QTextEdit's line-breaking algorithm so that text I'm displaying that is not English (it's code, in fact) gets wrapped in a better way. The definition of what a "word" is in Qt may be well-suited for human languages, but it is not well-suited for code, and so long lines of code end up getting wrapped at really bad places. For example, this single line of code:

      • (void)setRecombinationRate(numeric rates, [Ni ends = NULL], [string$ sex = "*"])

      gets wrapped by QTextEdit, in a narrow window, to this:

      -
      (void)setRecombinationRate(numeri
      c rates, [Ni ends = NULL], [string
      $ sex = "*"])

      I would like to tailor the line-breaking algorithm to achieve something more like this:

      • (void)setRecombinationRate(
        numeric rates, [Ni ends = NULL],
        [string$ sex = "*"])

      I have done much the same thing in Cocoa with an override of -lineBreakBeforeIndex:withinRange: in a subclass of NSTextStorage; but there seems to be no comparable place for me to override the default behavior in Qt.

      Note that I know you can customize Qt's layout so that text flows around obstacles within the QTextEdit; that is not what I'm asking about. :->

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            bhaller Ben Haller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes