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



  • 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



  • 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 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..


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.