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. QML Text formatting causes href to be ignored
Forum Updated to NodeBB v4.3 + New Features

QML Text formatting causes href to be ignored

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
text url link
2 Posts 2 Posters 941 Views 2 Watching
  • 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.
  • B Offline
    B Offline
    bradg
    wrote on last edited by
    #1

    So it's possible to use RichText formatting for a Text object, including an anchor with an href, which is great, but has anyone noticed that if you have any tag before an href, that the href gets ignored? Is this a bug in the underlying text processing system?

    Text
    {
         text:
         qsTr("Here is some text")
             + "<br><br>"
             + qsTr("Here is a second line of text. Click here to go to google: <a href='https://www.google.com'>Google</a>.")
             + qsTr(" And that's all I have to say about that.")
    
         color: "black"
         linkColor: "moccasin"
    
         font.pixelSize: 12
         onLinkActivated: Qt.openUrlExternally(link)
    }
    

    The above will not recognize the href. If I remove the double line break, it works. I've tried explicitly setting the textFormat to RichText, but no luck.

    T 1 Reply Last reply
    0
    • B bradg

      So it's possible to use RichText formatting for a Text object, including an anchor with an href, which is great, but has anyone noticed that if you have any tag before an href, that the href gets ignored? Is this a bug in the underlying text processing system?

      Text
      {
           text:
           qsTr("Here is some text")
               + "<br><br>"
               + qsTr("Here is a second line of text. Click here to go to google: <a href='https://www.google.com'>Google</a>.")
               + qsTr(" And that's all I have to say about that.")
      
           color: "black"
           linkColor: "moccasin"
      
           font.pixelSize: 12
           onLinkActivated: Qt.openUrlExternally(link)
      }
      

      The above will not recognize the href. If I remove the double line break, it works. I've tried explicitly setting the textFormat to RichText, but no luck.

      T Offline
      T Offline
      tarod.net
      wrote on last edited by
      #2

      @bradg It's working in my case. I'm working with Qt 5.5.

      "Individually, we are one drop. Together, we are an ocean."

      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