Results 1 to 3 of 3

Thread: QHelpEngine does not display images

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QHelpEngine does not display images

    Hello all,

    I'm using a QHelpEngine to display my help files (html files) in my custom QTextBrowser. I have generated my help.qch and help.qhc files correctly (I presume) since I verified it using the assistant: assistant -collectionFile help.qhc and indeed my html page was displayed as expected including the .gif image that was present in the html page.

    Now I'm trying to display the same content in my application and again I can display the html file but now my image is lost and is replaced with the image_broken_icon.

    In short, my implementation of QHelpEngine with QTextBrowser does not display the images that are present in the html files that I'm loading in the qtextbrowser.
    Any insights would be greatly appreciated!

    This is the part of the code where I load the html file:

    Qt Code:
    1. void HelpBrowser::setSource(const QUrl &url) {
    2. if (helpEngine != 0) {
    3. QByteArray helpData = helpEngine->fileData(url);
    4. // show the documentation to the user
    5. if (!helpData.isEmpty()) {
    6. setHtml(QLatin1String(helpData));
    7. }
    8.  
    9. int anchorPos = url.toString().indexOf(QChar('#'));
    10. if (anchorPos >= 0){
    11. QString anchor = url.toString().mid(anchorPos+1);
    12. scrollToAnchor(anchor);
    13. }
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    Thank you for your help,
    Laura

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

    Default Re: QHelpEngine does not display images

    Have you deployed the Qt gif image plugin with your application?

  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QHelpEngine does not display images

    Hello again,

    Thanks for the suggestion! I checked this by trying to load a .gif image at another part of my application and it worked fine. So that wasn't the problem. I then used process monitor (windows) and tried to see where my application is trying to load the image files from. Apparently, I had misunderstood that my image file is also part of the help.qch file. That's not the case. I could load my html files correctly when I placed my images folder in the directory of the executable.

    Best,
    Laura

Similar Threads

  1. How to display DDS images?
    By jamsession in forum Qt Programming
    Replies: 5
    Last Post: 12th June 2013, 22:18
  2. Using QWebView together with QHelpEngine
    By JPNaude in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2012, 10:26
  3. Using QHelpEngine
    By dima1000 in forum Newbie
    Replies: 1
    Last Post: 23rd January 2011, 00:48
  4. QHelpEngine, cannot open qhc file
    By hirti in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2010, 15:05
  5. Display images and move them
    By AL in forum Qt Programming
    Replies: 5
    Last Post: 11th February 2010, 17:49

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.