Results 1 to 2 of 2

Thread: Accesing Images in a html doc stored as QResource file

  1. #1
    Join Date
    Oct 2014
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Accesing Images in a html doc stored as QResource file

    Hi all,
    I have a .qrc file in which i have stored a html file and few images in the same folder. The html file uses these images to display them. I'am setting this html document in a QTextbrowser. I am loading the html file using the sethtml() function. But i'm unable to load the images in the document. How do i get the images to be displayed? Here is my code:

    QFile htmlString(":/pathtohtml");
    QImage preview(":/img.png");

    if(htmlString.open( QIODevice::ReadOnly))
    {
    textbrowser->setHtml(htmlString.readAll());
    }

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,553
    Thanks
    13
    Thanked 1,580 Times in 1,509 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Accesing Images in a html doc stored as QResource file

    Answer here

    Cross posting is not helpful.

Similar Threads

  1. Replies: 2
    Last Post: 27th April 2011, 08:43
  2. Why the images from the HTML file is not loaded??
    By rleojoseph in forum Qt Programming
    Replies: 8
    Last Post: 2nd March 2011, 12:29
  3. qresource file alias problem with svg
    By giotto in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2008, 16:59
  4. GIF or MNG images for use in html for QTextBrowser
    By manojmka in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2008, 17:30
  5. getting images out of html
    By hijinks in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 00:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.