Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Modifying the font.pixelSize of a TextEdit does not affect the code block.
Forum Updated to NodeBB v4.3 + New Features

Modifying the font.pixelSize of a TextEdit does not affect the code block.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 257 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.
  • H Offline
    H Offline
    HsiaoPak
    wrote on 19 Jun 2024, 04:13 last edited by HsiaoPak
    #1

    I'm using TextEdit to load Markdown, and when I modify the font.pixelSize, both the main text and headings are changing accordingly, but the font size of the code block remains the same.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 19 Jun 2024, 06:26 last edited by
      #2

      May be sample code will help to help you. Post the sample code.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      H 1 Reply Last reply 19 Jun 2024, 09:02
      0
      • B Offline
        B Offline
        blanca236
        wrote on 19 Jun 2024, 06:36 last edited by
        #3

        Hello,
        When working with Markdown in TextEdit, adjusting font sizes for code blocks can be a bit tricky. Here are some approaches you can try: HTML Tags: To change the font size within Markdown cells, you can use the HTML <span> tag with the style attribute. Custom CSS (Advanced): If your Markdown renderer supports custom CSS (e.g., GitHub or certain Markdown editors), create a custom CSS rule to target code blocks.
        I hope this info useful to you!...
        Best Regard
        Ford Benefits

        1 Reply Last reply
        0
        • D dheerendra
          19 Jun 2024, 06:26

          May be sample code will help to help you. Post the sample code.

          H Offline
          H Offline
          HsiaoPak
          wrote on 19 Jun 2024, 09:02 last edited by
          #4

          @dheerendra

          import QtQuick 2.15
          import QtQuick.Controls 2.15
          
          TextEdit {
              id: textedit
              width: 600
              height: 300
              textFormat: TextEdit.MarkdownText
          
              Shortcut {
                  sequence: "Ctrl+="
                  onActivated: {
                      textedit.font.pixelSize += 1
                  }
              }
          
              text: "*Italic*    **Bold**
          # Heading 1
          ## Heading 2
          
          body
          
          `code block`
          
          [Link](http://a.com)
          "
          }
          

          Maybe you meant to replace "`" with "```". The size of the code block did not increase.

          1 Reply Last reply
          0

          1/4

          19 Jun 2024, 04:13

          • Login

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