Question

In my Qt application we can open a help file (chm) by doing the following:

QDesktopServices::openUrl(QUrl::fromLocalFile(_PathToTheCHMFile));

This seems to be the suggested way of doing things. And it has worked up until now.

However, the documentation team has now changed how the chm files work. Now we are referencing a "master" file which only contains references to other chm files. The directory structure of the chm files is as follows:

 master.chm
 SUBDIR/
     -> child1.chm
     -> child2.chm
      ...

If open the master.chm file with hh.exe (the default tool in windows), everything looks perfect. However, from my Qt application, the help file opens, but there are no sub topics, just the root node.

I assume this is a search path issue, and it can't resolve the relative paths. There doesn't seem to be any way to configure the openURL call to run from a certain directory, or anything like that.

Thanks in advance

Was it helpful?

Solution

If you need to be able to access those elements properly, then you may need to change your applications current directory on the fly.

http://qt-project.org/doc/qt-4.8/qdir.html#details

http://qt-project.org/doc/qt-4.8/qdir.html#setCurrent

If that doesn't work, you may want to look into using QProcess::startDetached

http://qt-project.org/doc/qt-4.8/qprocess.html#startDetached

and specifying the working directory to be exactly where your master.chm is located.

You may want to specify some command-line arguments, too.

http://www.help-info.de/en/Help_Info_HTMLHelp/hh_command.htm

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top