We are using Qt-Help in our projects, but I'm really not satisfied with the formatting of the Qt-Help inside the Qt-assistant. It looks really ugly compared to the formatting of the HTML-files inside my Firefox.
One of the reasons might be, that the Qt-assistant ignores javascript in its rendering.
Therefore I tried to implement a very simple testrunner, that should display the contents of a QHC-file.
#include <iostream>
#include <QApplication>
#include <QDebug>
#include <QDialog>
#include <QHBoxLayout>
#include <QHelpContentWidget>
#include <QHelpEngine>
#include <QWebEngineView>
int main(int argc, char** args) {
QApplication app(argc, args);
auto help = new QHelpEngine("./data/MyHelp.qhc");
help->contentWidget()->show();
QObject::connect(help->contentWidget(), &QHelpContentWidget::linkActivated, [&](const QUrl &link) {
QDialog dialog;
auto helpContent = new QWebEngineView;
helpContent->load(link);
dialog.setLayout(new QHBoxLayout);
dialog.layout()->addWidget(helpContent);
dialog.exec();
});
app.exec();
}
Unfortunately, the QWebEngineView
will not find QUrl
link of the QHC-file.
How can I configure QWebEngineView
, so that it will look for the resource inside the QHC-file? It is also necessary, that all images and other externals resources inside the HTML help files are found.
Maybe the class QWebEngineUrlSchemeHandler
could be of some help.