We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2017-11-27 08:03:05 +0200

[Bug]Qml Label with images not correctly shown on xperia phones

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
        }

[Bug]Qml Label with images not correctly shown on xperia phones

The origin image url is https://sailfishos.org/wp-content/uploads/2015/09/HOME.jpg

image description

The image shows on Sailfish X with Qml Label tag: TIM图片20171127135440.jpgimage description

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
        }