[SOLVED]HTML font face tag not work with QML Text
QML and Qt Quick
3
Posts
2
Posters
2.2k
Views
1
Watching
-
wrote on 23 Jan 2015, 02:34 last edited by
<font face> tag have no effect, while <font color> and <font size> still okay. Did I do something wrong?
Please explain that for me, thank you.@import QtQuick 2.3
Rectangle {
width: 360
height: 360
color: "black"
MouseArea {
anchors.fill: parent
onClicked: {
//Qt.quit();
}
}Text { anchors.top: parent.top //font.family: "Courier" text: "<font face='Courier' color='green' size='7'>Hello World</font>" } Text { anchors.bottom: parent.bottom //font.family: "Arial" text: "<font face='Arial' color='yellow' size='8'>Hello World</font>" }
}
@
Ah sorry, my company doesn't allow uploading image. The code above show two text with same font, different color and different size.
-
Hi,
Welcome to Qt Devnet.
Text element does support HTML style tags but not all of them but it certainly does which you have mentioned.
You need to set textFormat: Text.RichText property for Text element.
More info "here":http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop. -
wrote on 23 Jan 2015, 13:27 last edited by
It's work!
Thank p3c0! Thank you very much!
1/3