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. Help with HTML Text in QML
Forum Updated to NodeBB v4.3 + New Features

Help with HTML Text in QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 764 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
    Mertanian
    wrote on last edited by Mertanian
    #1

    Hello. I have an object like this:

    Text {
            text: '<font style="font-weight:900;">Text Test</font>'
            color: "black"
        }
    

    I want to set font-weight value as in the docs: http://doc.qt.io/qt-5/richtext-html-subset.html
    I need to use font-weight because I want slightly thinner font than a font I get by using <b></b> tags.

    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      The text format can be specified by hand if the auto detection doesn't give desired results: http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mertanian
        wrote on last edited by
        #3

        Thank you, @jpnurmi!
        Setting textFormat: Text.RichText worked for me.

        1 Reply Last reply
        0

        • Login

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