QML Label with HTML-Tags
-
wrote on 24 Aug 2017, 10:08 last edited by
Hi devs, how can I set the font-weight inside a html-tag? I have tried the following code, but it doesn't work. Can anyone help me?
Code:
Label{ topPadding: 10 leftPadding: 20 rightPadding: 20 font.weight: Font.Light wrapMode: Text.WordWrap textFormat: Text.RichText text: qsTr("<font font-weight:medium>The first step</font> is to select a tool. You can choose it from a predefined list.") }
-
Hi devs, how can I set the font-weight inside a html-tag? I have tried the following code, but it doesn't work. Can anyone help me?
Code:
Label{ topPadding: 10 leftPadding: 20 rightPadding: 20 font.weight: Font.Light wrapMode: Text.WordWrap textFormat: Text.RichText text: qsTr("<font font-weight:medium>The first step</font> is to select a tool. You can choose it from a predefined list.") }
@Manu19 said in QML Label with HTML-Tags:
<font font-weight:medium>
this is not valid HTML!
text: qsTr('<font font-weight="medium">bold text</font>');
-
wrote on 24 Aug 2017, 11:44 last edited by
@raven-worx said in QML Label with HTML-Tags:
'<font font-weight="medium">bold text</font>'
Thank you for your answer, but your code doesn't work too. My Code:
Label { topPadding: 10 leftPadding: 20 rightPadding: 20 wrapMode: Text.WordWrap font.weight: Font.Light textFormat: Text.RichText text: qsTr('<font font-weight="bold">bold text</font>'); }
-
@raven-worx said in QML Label with HTML-Tags:
'<font font-weight="medium">bold text</font>'
Thank you for your answer, but your code doesn't work too. My Code:
Label { topPadding: 10 leftPadding: 20 rightPadding: 20 wrapMode: Text.WordWrap font.weight: Font.Light textFormat: Text.RichText text: qsTr('<font font-weight="bold">bold text</font>'); }
-
wrote on 24 Aug 2017, 12:12 last edited by
My code was only a example. I have tried "bold", but bold is a little bit strong for me. Thank you for your time and work.
1/5