问题
I am using Qt 4.6
so do C++.
I have a User Manual (.chm
) for my application which has the help required for the users to run the application. Now I want this help to be integrated into my application, so that when the user selects for help from the application, the user manual will be opened with the corresponding help page displayed. In this way I can make use of the already available manual and users will find easy to probe through the document. (since it is familiar)
The user manual file is in the .chm
format which has corresponding search keywords, which can be used to display the corresponding page when selected from the application. Just similar to F1
help in any of the windows application.
Is it possible to do this in Qt or C++? Or
What are the other ways through which the help can be integrated in the application?
Any pointers regarding this are welcome..
回答1:
Yes, it's possible. The help system infrastructure was designed to integrate with normal Win32 development in Visual Studio, but this is not technically necessary. Basically you just call HtmlHelp(GetDesktopWindow(), "Yourhelp.chm", HH_HELP_CONTEXT, IDYourCurrentContext);
.
回答2:
The more Qt
way of Help Integration can also be done which is as follows.
The chm files are always opened by the hh.exe
So,
QProcess::execute("hh.exe D:/Manual.chm");
can be used to open the Manual.chm
file from the application.
The command
QProcess::execute("hh.exe D:/Manual.chm::page1.htm");
will open the chm file
with the page1.htm loaded. This will be helpful to load a specific help page in the chm file
.
The only thing we must be aware in this approach is that we must have known the file name of the web pages (here page1.htm
) previously..
Hope this one also helps... :)
回答3:
QDesktopServices::openUrl() would be even more Qt way. Then you do not need to specify hh.exe but rely instead on the system file associations to use proper application. Hence - portability, the key thing behind Qt stuff.
回答4:
try using libCHMxx or CHM lib along with Qt help system (see this sample)
来源:https://stackoverflow.com/questions/3351511/help-integration-in-qt-c-application