September 23, 2011

zither zither
Lab Rat
148 posts

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?

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

Thanks

9 replies

September 28, 2011

zither zither
Lab Rat
148 posts

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

Plz Help
Thanks

September 29, 2011

Volker Volker
Ant Farmer
5428 posts

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.

September 29, 2011

zither zither
Lab Rat
148 posts

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

  1. qDebug()<<engine->indexModel()->stringList();

Thanks a lot

September 29, 2011

Volker Volker
Ant Farmer
5428 posts

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.

September 29, 2011

zither zither
Lab Rat
148 posts

So, how can I get indexModel from QHelpEngine?
I try like that but get nothing.

  1. Model  = Engine->indexModel();
  2. Widget = Engine->indexWidget();
  3. newWidget->setModel(Model);
  4. addWidget(Widget);     // no data show
  5. addWidget(newWidget);     // no data show

Thanks

September 29, 2011

zither zither
Lab Rat
148 posts

Sorry

  1. connect(Engine->indexModel(),SIGNAL(indexCreated()),this,SLOT(slotIndexCreate()));  // connect
  2. qDebug()<<Engine->indexModel()->stringList();  //empty "()" return

Thanks

September 30, 2011

Volker Volker
Ant Farmer
5428 posts

Does your help collection load in qt assistant?

September 30, 2011

zither zither
Lab Rat
148 posts

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

  1. QHelpEngine *engine = new QHelpEngine(QString fileName);

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

Thanks

September 30, 2011

Volker Volker
Ant Farmer
5428 posts

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.

 
  ‹‹ Validating an XML file with a schema file      deleting objects with mixed ScriptOwnership ››

You must log in to post a reply. Not a member yet? Register here!