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

<PRE> in textEdit does not use fixed size font on Android

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.3.1
    • Component/s: GUI: Font handling
    • Environment:
      Windows 7 QT 5.2.0 ("correct")
      Android 4.3 QT 5.2.0 ("wrong")
    • Platform/s:
      Android
    • Commits:
      3cf9621fa02b17a36dacf336adcc9ed993de7699, 08117eee009f06d77bba489bd9513b5671e3d604

      Description

      I have a textEdit as part of a layout in my QMainWindow.

      I call the following (extracted, minimized example, real lines are longer, no real data in example):

      ui->textEdit->setHtml("<PRE>\n00 00000000\n00 1111----\n ----1111\n</PRE>\n");

      I assumed to get ("correct")

      00 00000000
      00 1111----
      ----1111

      (all lines end at same position, looks correct, at least on my system, here in bug tracker).

      But I get ("wrong", not real amount of characters, but it looks like this)

      00 00000000
      00 1111-- (each '-' is smaller, not fixed size)
      -1111 (each space and '' is smaller, not fixed size)

      It is correctly displayed on Windows, but wrong on Android (Nexus 7 (2012)).
      It looks like implementation on Android does not use fixed size font.

      I already tried additionally to set font of textEdit, e.g. by

      ui->textEdit->setStyleSheet("font: 9pt \"Courier\";");

      or

      QFont font("Monospace");
      font.setStyleHint(QFont::TypeWriter);
      ui->textEdit->setFont(font);

      It sometimes changes font or font size, but never looked to be a fixed size font on Android.

      I get the complete output as string from a big (already existing) subroutine,
      so it would be no solution to use something like a HTML table for each character,
      at least I think this is no acceptable solution to do this.

      I also tried <TT> or <CODE> without success.

      Any other idea?

        Attachments

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

          Activity

            People

            • Assignee:
              esabraha Eskil Abrahamsen Blomfeldt
              Reporter:
              capiman Martin Maurer
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes