PDA

View Full Version : Qt Assistant Qt Assistant as Custom Help Viewer



UVV
22nd January 2010, 03:55
Hi,
I use Qt Assistant as Custom Help Viewer.
I call it from my application like in the example:


...
if (!proc)
proc = new QProcess();

if (proc->state() != QProcess::Running) {
QString app = QCoreApplication::applicationDirPath() +
QDir::separator();
#if !defined(Q_OS_MAC)
app += QLatin1String("assistant");
#else
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
#endif

QStringList args;
args << QLatin1String("-collectionFile")
<< QCoreApplication::applicationDirPath()
+ QDir::separator()
+ QLatin1String("helpfile.qhc")
<< QLatin1String("-enableRemoteControl");

proc->start(app, args);
...

If I don't close a documentation tab in the Assistant, i.e. just close the Assistant, and then use my Help button several times in a row I've got several empty tabs like in an attached image.
How can I get rid of it?
Thanks in advance.

wysota
22nd January 2010, 11:05
Did you think about going through the QAssistantClient class?

UVV
22nd January 2010, 11:42
I stopped at the beginning of its description, which says "This class is obsolete" :)

wysota
22nd January 2010, 13:42
It is, because now we have the much better QtHelp module but QAssistantClient is closest to what you are trying to do right now. Your current approach is much more obsolete than using QAssistantClient ;)

UVV
22nd January 2010, 13:55
Qt documentation says otherwise:


This class is obsolete and only required when using the old Qt Assistant, now called assistant_adp. If you want to use the new Qt Assistant as a remote help viewer, simple create a QProcess instance and specify assistant as its executable.

wysota
22nd January 2010, 14:42
Well... true.

I just had a look at your code again, make sure the collection file you are trying to call exists. Also make a test where you don't pass the collection though the commandline but rather register it first against Qt Assistant.