We have moved to a new Sailfish OS Forum. Please start new discussions there.
1 | initial version | posted 2017-11-27 08:03:05 +0200 |
The origin image url is https://sailfishos.org/wp-content/uploads/2015/09/HOME.jpg
The image shows on Sailfish X with Qml Label tag: TIM图片20171127135440.jpg
My test code is:(or you can use this demo https://github.com/0312birdzhang/label-show-image-demo)
Label {
anchors{
margins: Theme.paddingMedium
horizontalCenter: parent.horizontalCenter
}
text: "Some Text<br/><img src=\"https://sailfishos.org/wp-content/uploads/2015/09/HOME.jpg\" />"
.replace(/<img src=\"([^<>"]*)\".*?>/g,"<img src=\"$1\" width="+( Screen.width - Theme.paddingMedium*2 )+"/>");
color: Theme.highlightColor
textFormat: Text.RichText
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.WordWrap
linkColor:Theme.primaryColor
}
2 | No.2 Revision |
The origin image url is https://sailfishos.org/wp-content/uploads/2015/09/HOME.jpg
The image shows on Sailfish X with Qml Label tag:
TIM图片20171127135440.jpg
My test code is:(or you can use this demo https://github.com/0312birdzhang/label-show-image-demo)
Label {
anchors{
margins: Theme.paddingMedium
horizontalCenter: parent.horizontalCenter
}
text: "Some Text<br/><img src=\"https://sailfishos.org/wp-content/uploads/2015/09/HOME.jpg\" />"
.replace(/<img src=\"([^<>"]*)\".*?>/g,"<img src=\"$1\" width="+( Screen.width - Theme.paddingMedium*2 )+"/>");
color: Theme.highlightColor
textFormat: Text.RichText
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.WordWrap
linkColor:Theme.primaryColor
}