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

QPlainTextEdit does not respect QTextBlockFormat::lineHeight()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.3.0, 5.4.0, 5.5.0
    • None
    • Debian Linux Jessie x86-64, gcc 4.9.2

    Description

      Run the following program:

      #include "mainwindow.h"
      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QPlainTextEdit te;
          te.setPlainText("abcabc\ndefdef");
      
          QTextCursor cursor = te.textCursor();
          cursor.select(QTextCursor::Document);
          QTextBlockFormat fmt;
          fmt.setLineHeight(100, QTextBlockFormat::FixedHeight);
          cursor.setBlockFormat(fmt);
      
          te.show();
      
          return a.exec();
      }
      

      The line height of the fonts will be used instead of the explicitly set line height in the block format, since the QPlainTextEditLayout never actually checks the block format's line height. Replacing QPlainTextEdit with QTextEdit shows the expected result.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            songziming Song Ziming
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes