Important: Please read the Qt Code of Conduct -


  • Hi, I'm actually trying to provide documentation inside one of my Qt application and I'm not able to make it working.

    I have generate qhc and qch files using doxygen, and I'm able to load this file into Qt Assistant and browse all elements contained in the qhc file.

    But now I'm trying to display this into a Qt Application using QHelpEngine, without success.
    QHelpEngine is able to load the qhc file, but QHelpEngine::indexModel() and QHelpEngine::contentModel() are empty.

    Here is my code used to test it:

    Widget::Widget(QWidget *parent)
        : QWidget(parent)
       QFileInfo fileInfo("help.qhc");
       if (fileInfo.exists()) {
           QHelpEngine* he = new QHelpEngine(fileInfo.absoluteFilePath());
           qDebug() << "Setup data: " << he->setupData();
           qDebug() << he->error();
           qDebug() << fileInfo.absoluteFilePath();
           QHelpContentWidget *contentWidget = he->contentWidget();
           QHelpIndexWidget* indexWidget = he->indexWidget();
           QSplitter* splitter = new QSplitter();
           QHelpContentModel *contentModel = he->contentModel();
           QHelpIndexModel* indexModel = he->indexModel();
           qDebug() << "Content model count: " << contentModel->rowCount();
           qDebug() << "Index model count: " << indexModel->rowCount();
           QHBoxLayout *hl = new QHBoxLayout;

    and the output:

    Setup data:  true
    Content model count:  0
    Index model count:  0

    I cannot see what I'm missing here. Any help would be appreciated.

  • Lifetime Qt Champion


    Which version of Qt are you using ?
    On which platform ?

  • @SGaist Hi,
    Qt 5.10.1
    Windows 10

  • @Gojir4
    I know nothing about this, but...

    Your code seems to be from old post , or maybe you got it from same source? Anyway, have you read through all the posts there seemingly describing your situation? Some claim to have got it working. Though I admit the final, unanswered post ( looks a lot like you..?

    Or, does the code at (a) work and (b) help you?

  • Hi @JonB ,

    You are right, this is highly inspired from the old post about the same subject. But as I didn't find any solution I made a a new one .

    Maybe I need to add the HelpBrowser class and make this connection as suggessted by your second link.

      QObject::connect(helpEngine->contentWidget(), SIGNAL(linkActivated(const QUrl &)),
    helpBrowser, SLOT(setSource(const QUrl &)));

    But I have also checked my qhc file using the sample projet Context-Sensitive Help Example and it doens't seems to work too. So I guess ther is another issue.
    I will check that tomorrow as I'm out of office now.
    Thanks for your valuable input.

  • @JonB said in QHelpEngine:

    Or, does the code at (a) work and (b) help you?

    I tried this and it almost works. Almost because only the root link from the index view is working, then I have to use links from the content view to navigate. Links under the root item (children) are not working from the index view and clicking on them add error messages in output:

    QFSFileEngine::open: No file name specified
    QTextBrowser: No document for qthelp://org.qt-project.examples.simpletextviewer/doc/./openfile.html

    When using my own documentation .qhc file, nothing is displayed. So I definitely didn't catch the logic here. I guess I will stay with Doxygen for documentation.