Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can't render image in TextEdit rich format
Forum Updated to NodeBB v4.3 + New Features

Can't render image in TextEdit rich format

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 785 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mfred2013
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lucijan
      wrote on last edited by
      #2

      Please surround your code in Code tags.

      Here's a working example:

      @import QtQuick 2.0

      Rectangle
      {
      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"

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved