1

There is a real-time communication tool written in QML, and the message is transmitted in html format.

simple code:

Rectangle{
    width:300
    height: 300

    Rectangle{ // simple bubble

        anchors.centerIn: parent
        width: parent.width-100
        height: parent.height-100
        color:"#f0f0f0"
        radius: 10

        TextEdit {  //simple message show

            anchors.fill: parent
            readOnly: true
            selectByMouse: true
            clip: true
            text: "<!DOCTYPE html>
                    <html>
                    <head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head>
                        <body style=\"font-family:Geneva,Helvetica,Arial,sans-serif; font-size: 12px;\">
                            this is an image:
                            <img alt=\"\" src=\"file:/local/image.png\" />
                        </body>
                    </html>
                "
            textFormat: Text.RichText
        }
    }
}

And my question is how to get a clicked image from a BubbleChatWidget?

like: click action

Similar question:here

When I reference Telegram (web), I found that Telegram messages would not have words and pictures together. link

Community
  • 1
  • 1
陈晓龙
  • 17
  • 3

1 Answers1

2

You migth parse the text beforehand, and wrap each image in a link <a ...>...</a>.

This will give you the possibility to use the linkActivated(link)-signal to register the click.

See the documentation: