Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get QHelpIndexModel from QHelpEngine?



  • Dear all,

    I would like to get all index list from QHelpEngine. I tried like that but empty return.
    What's wrong with that code?

    @QHelpEngine *engine = new QHelpEngine(QString fileName);
    engine->setupData();
    qDebug()<<engine->filterAttributes; //return all filter attributes
    qDebug()<<engine->indexModel()->stringList(); //empty string list return(error)@

    Thanks



  • @ qDebug()<<Engine->indexModel()->isCreatingIndex(); // return true
    connect(Engine->indexModel(),SIGNAL(indexCreated()),this,SLOT(slotIndexCreate())); //not connect@

    Plz Help
    Thanks



  • What's the output of the connect statement? Qt prints on stderr (or stdout) a message with a description of the problem if a connect fails.



  • No error message from connect statement. But no call to SLOT.
    Is there any wrong with SIGNAL producer, Engine->indexModel()?
    I can't get also
    @qDebug()<<engine->indexModel()->stringList();@

    Thanks a lot



  • Maybe a race condition: The help search indexe runs in a separate thread. It could be that the indexing has been finished after your call of isCreatingIndex() (that's why that one returns true) and before the connect statement finishes. That's why the emitted signal is not delivered.



  • So, how can I get indexModel from QHelpEngine?
    I try like that but get nothing.
    @Model = Engine->indexModel();
    Widget = Engine->indexWidget();
    newWidget->setModel(Model);
    addWidget(Widget); // no data show
    addWidget(newWidget); // no data show@

    Thanks



  • Sorry
    @connect(Engine->indexModel(),SIGNAL(indexCreated()),this,SLOT(slotIndexCreate())); // connect
    qDebug()<<Engine->indexModel()->stringList(); //empty "()" return@

    Thanks



  • Does your help collection load in qt assistant?



  • No, I just don't load help collection in qt assistant.
    I directly load like that.

    @QHelpEngine *engine = new QHelpEngine(QString fileName);@

    So, am I need to load help collection file first?

    Thanks



  • You can check whether your help collection is prepared correctly by loading it into Qt Assistant. This way you make sure the data you try to load is sane.


Log in to reply