laura7s
20th November 2015, 16:56
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
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