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:
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 -
Hi
its most likely something with path. where images are and where QTextBrowser
looks for them. -
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 -
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?