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

Empty line (\n) at the top of QTextEdit and QLabel when using markdown

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2: Important
    • Resolution: Done
    • 5.14.0
    • 5.14.1, 5.14.2, 5.15.0 Alpha
    • GUI: Text handling
    • None
    • Issue seen in a plain C++ environment, as well as in Pyside2 and PyQt5

      The issue has been seen on LXDE (Lubuntu 18.04), KDE and WIndows 8
    • Linux/X11, Windows
    • 76fbe75abee7d77911467d56630176f777e8ed78 (qt/qtbase/5.14)

    Description

      We see an empty line (\n) at the top of QTextEdit and QLabel widgets when using markdown formatting

      Please note: This has not been tested on a C++ environment, so it's possible that the bug is only for Pyside2 and PyQt5
      Update: Has been seen in a plain C++ environment (see comment from chehrlic), as well as on Pyside2 and PyQt5. (First found on PyQt5)

      Below is a minimal example (the result can be seen in the attached screenshot)

      import sys
      from Pyside2 import QtWidgets
      
      
      class MyMainWindow(QtWidgets.QMainWindow):
          def __init__(self):
              super().__init__()
      
              self.qte = QtWidgets.QTextEdit()
              self.qte.setReadOnly(True)
              self.qte.setMarkdown("Markdown text")
              self.setCentralWidget(self.qte)
      
              self.show()
      
      
      app = QtWidgets.QApplication(sys.argv)
      main_window = MyMainWindow()
      main_window.show()
      app.exec_()
      

      Attachments

        Issue Links

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

          Activity

            People

              rakeller Rainer Keller
              sunyatazero Tord Dellsén
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes