Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to set indent for QTextEdit's markdown content

Is it possible to set indent for QTextEdit's markdown content

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 823 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mamsds
    wrote on last edited by
    #1

    I am currently exploring QTextEdit's rendering of Markdown text. The problem is shown in the below image:

    Screenshot_2024-01-19_13-42-29.png

    In the original plain text (bottom half), my "- Hello worldsd"'s indent is expected (well actually it is not indent, just some margin). But in the rendered textbox (top half), the indent becomes very large, occupying ~20% of the entire width of my QTextEdit.
    My question is whether or not it is possible to make the indent smaller, ideally configurable.

    Thanks,

    C 1 Reply Last reply
    0
    • M mamsds

      I am currently exploring QTextEdit's rendering of Markdown text. The problem is shown in the below image:

      Screenshot_2024-01-19_13-42-29.png

      In the original plain text (bottom half), my "- Hello worldsd"'s indent is expected (well actually it is not indent, just some margin). But in the rendered textbox (top half), the indent becomes very large, occupying ~20% of the entire width of my QTextEdit.
      My question is whether or not it is possible to make the indent smaller, ideally configurable.

      Thanks,

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @mamsds Welcome to the Qt forums.

      I would start by looking at QTextEdit::tabStopDistance() to see if that adjusts the indenting depth of the lists.

      Markdown is not WYSIWYG and you have asked for nested unordered lists, which it has given you. I do not consider that there is a problem here.

      M 1 Reply Last reply
      0
      • C ChrisW67

        @mamsds Welcome to the Qt forums.

        I would start by looking at QTextEdit::tabStopDistance() to see if that adjusts the indenting depth of the lists.

        Markdown is not WYSIWYG and you have asked for nested unordered lists, which it has given you. I do not consider that there is a problem here.

        M Offline
        M Offline
        mamsds
        wrote on last edited by
        #3

        Hi @ChrisW67 , for tabStopDistance(), I actually checked it before posting. It doesnt help in this case.
        On nested list argument, note that I was talking about the first line, i.e., * Hello worldsd line, the indent is large already. I am not specifically asking to tweak the indent of the 2nd line (i.e., * asd)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mamsds
          wrote on last edited by
          #4

          Turns out that it is possible, it is defined under the document member variable of QTextEdit:

          ui->textEdit->document()->setIndentWidth(10);
          
          1 Reply Last reply
          3

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved