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. QHelpEngine does not display images
QtWS25 Last Chance

QHelpEngine does not display images

Scheduled Pinned Locked Moved Solved General and Desktop
qtextbrowserimage displayqhelpengine
4 Posts 3 Posters 2.4k Views
  • 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.
  • L Offline
    L Offline
    laura7s
    wrote on 20 Nov 2015, 16:34 last edited by laura7s
    #1

    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:

    void HelpBrowser::setSource(const QUrl &url) {
       if (helpEngine != 0) {
    	QByteArray helpData = helpEngine->fileData(url);
    	// show the documentation to the user
    	if (!helpData.isEmpty()) {
    		setHtml(QLatin1String(helpData));
    	}
    
    	int anchorPos = url.toString().indexOf(QChar('#'));
    	if (anchorPos >= 0){
    		QString anchor = url.toString().mid(anchorPos+1);
    		scrollToAnchor(anchor);
    	}
      }
    }
    

    Thank you for your help,
    Laura

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Nov 2015, 19:12 last edited by
      #2

      Hi
      its most likely something with path. where images are and where QTextBrowser
      looks for them.

      http://www.walletfox.com/course/qhelpengineexample.php

      1 Reply Last reply
      0
      • L Offline
        L Offline
        laura7s
        wrote on 23 Nov 2015, 14:53 last edited by
        #3

        Hello again,

        Thanks for the suggestion! I 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

        1 Reply Last reply
        1
        • V Offline
          V Offline
          ValentinMichelet
          wrote on 16 Dec 2015, 10:24 last edited by
          #4

          I encountered the same issue, but since QtAssistant displays images without telling it where to find them, how does it manage to find them? It has to be somewhere in the qch file, right?

          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