Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextEdit not displaying images
Qt 6.11 is out! See what's new in the release blog

QTextEdit not displaying images

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.2k 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.
  • Xena_oX Offline
    Xena_oX Offline
    Xena_o
    wrote on last edited by
    #1

    hello,

    i am trying to display pictures in html inside a QTexEdit but they are not displaying, instead i see a small grey document icone!

    i checked the image url , it is displaying in the web browser, so it is not the url, url is correct.

    i set the html to QTextEdit with setHtml, the html is fully correct, something like :
    <html><head></head><body><img scr="(image url here)" /></body></html>

    why it is not displaying the images ?

    artwawA 1 Reply Last reply
    0
    • Xena_oX Xena_o

      hello,

      i am trying to display pictures in html inside a QTexEdit but they are not displaying, instead i see a small grey document icone!

      i checked the image url , it is displaying in the web browser, so it is not the url, url is correct.

      i set the html to QTextEdit with setHtml, the html is fully correct, something like :
      <html><head></head><body><img scr="(image url here)" /></body></html>

      why it is not displaying the images ?

      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      @Xena_o most likely image can't be loaded. HTML support is somewhat limited https://doc.qt.io/qt-5/richtext-html-subset.html
      Is this image a local or remote file? I can't find it now in the docs but (and I might be wrong here, mind you) I think resources as images in this subset have to be local...

      For more information please re-read.

      Kind Regards,
      Artur

      Christian EhrlicherC 1 Reply Last reply
      2
      • artwawA artwaw

        @Xena_o most likely image can't be loaded. HTML support is somewhat limited https://doc.qt.io/qt-5/richtext-html-subset.html
        Is this image a local or remote file? I can't find it now in the docs but (and I might be wrong here, mind you) I think resources as images in this subset have to be local...

        Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @artwaw said in QTextEdit not displaying images:

        I think resources as images in this subset have to be local...

        correct :)

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • Xena_oX Offline
          Xena_oX Offline
          Xena_o
          wrote on last edited by
          #4

          @artwaw @Christian-Ehrlicher
          thank you
          image is remote https
          looks like need to download it first and set it as a local picture.

          1 Reply Last reply
          1

          • Login

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