Important: Please read the Qt Code of Conduct -

Can't render image in TextEdit rich format

  • I'm new in qtquick. using QTQuick 1.1; I try to render an image using a TextEdit widget.
    TextEdit {
    id: messageText
    text: "Hello <img />"
    readOnly: true
    with this code I get a fake image, but not what I expect. (a kind of small 'document like' icone)

    when I change TextEdit by Text, my image is rendered but In this case the text is not selectionable.
    Is it a TextEdit bug or do I something wrong ?

  • Please surround your code in Code tags.

    Here's a working example:

    @import QtQuick 2.0

    width: 200
    height: 200
    color: "grey"

    TextEdit {
        id: messageText
        text: "Hello <img ></img>"
        textFormat: Text.RichText
        readOnly: true


    EDIT: Apparently the forum doesn't like HTML tags, so here's what I've put inside the img tag:

    src="file:///E:/leaf.jpg" width="42" height="42"

Log in to reply