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

QTextLayout.lineCount() returns 0 in certain situations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0
    • GUI: Text handling
    • None
    • Linux/X11

    Description

      If in a QTextBlock text passages are highlighted by QSyntaxHighlighter, then QTextLayout.lineCount() returns 0. Under these circumstances no block operations can be implemented which are based on the individual lines of a block (e.g. hyphenation).

      // After contentsChange(int, int, int) was triggered.
      
      auto lineCount = blockLayout->lineCount();
      for (int i = 0; i < lineCount; ++i) {
          // We'll never get here, if any word in the block is highlighted. :-(
          
          auto line = blockLayout->lineAt(i);
          if (line.isValid()) {
          
              // Hyphenation or any other line operation.
          
          }
      }
      

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            serious Frank Sembowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes