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. [SOLVED] Need some explanation about HTML on labels...
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Need some explanation about HTML on labels...

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views 1 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So with this code
    @ ui->label->setText("<html><head/><body><p><a ><span style=" text-decoration: underline; color:#dd4814;">"+tr("How to use")+" ""+tr("Live Earth")+"" "+tr("page")+"?</span></a></p></body></html>");
    @

    i have this label:
    !http://i.imgur.com/Q2xlnZt.png(1)!

    Which is wrong because i have text-decoration:underline; which cannot be seen

    If i add one <br> like:
    @ ui->label->setText("<html><head/><body><p><a ><span style=" text-decoration: underline; color:#dd4814;">"+tr("How to use")+"<br>"+" ""+tr("Live Earth")+"" "+tr("page")+"?</span></a></p></body></html>");
    @

    label becomes
    !http://i.imgur.com/b5jI3ju.png(2)!

    you can see only 1st line becomes underlined.. I need some help :D

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      Looks like the underline is clipped by the label height. You could try giving it a minimum height that exceeds the normal one. However, this will make your label less flexible (different screen resolutions/font sizes/translations might need different minimum heights to work properly...)

      Another thing: Why don't you include the quotation marks around Live Earth in the translation string? The current way you're doing it will not allow proper translation, because not all languages follow the syntax (word ordering) that you've hardcoded there.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        [quote author="DerManu" date="1377952346"]Looks like the underline is clipped by the label height. You could try giving it a minimum height that exceeds the normal one. However, this will make your label less flexible (different screen resolutions/font sizes/translations might need different minimum heights to work properly...)

        Another thing: Why don't you include the quotation marks around Live Earth in the translation string? The current way you're doing it will not allow proper translation, because not all languages follow the syntax (word ordering) that you've hardcoded there.[/quote]

        Hmm yeah you are right, its about the underline getting clipped by the label height...

        Well thanks for answering, i was really confused on what i was doing wrong and in the end seems like a qt thing cutting the underline of every label..

        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