1.编写号html格式的帮助文档
2.创建helpDoc.qhp文件
<?xml version="1.0" encoding="GB2312"?>
<QtHelpProject version="1.0">
<namespace>HMIHelpDoc</namespace>
<virtualFolder>doc</virtualFolder>
<filterSection>
<toc>
<section title="一级节点1" ref="11111.html"/>
<section title="一级节点2" ref="22222.html"/>
<section title="一级节点3" ref="33333.html">
<section title="二级节点1" ref="66666.html"/>
<section title="二级节点2" ref="444444.html"/>
</section>
</toc>
<keywords>
<keyword name="key1" id="key1" ref="1111.html"/>
<keyword name="key2" id="key2" ref="2222.html"/>
</keywords>
<files>
<file>11111.html</file>
<file>22222.html</file>
<file>333333.html</file>
<file>images/*.png</file>
<file>style/*.css</file>
</files>
</filterSection>
</QtHelpProject>
3.编写helpDoc.qhcp文件,名字随意
<?xml version="1.0" encoding="GB2312"?>
<QHelpCollectionProject version="1.0">
<assistant>
<title>我的帮助文档</title>
<applicationIcon>images/doc.png</applicationIcon>
<cacheDirectory></cacheDirectory>
<homePage>qthelp://qhp中的namespace节点/qhp中的virtualFolder节点/index.html</homePage>
<startPage>qthelp://qhp中的namespace节点/qhp中的virtualFolder节点/index.html</startPage>
<aboutMenuText>
<text>aboust</text>
</aboutMenuText>
<aboutDialog>
<file>about.txt</file>
<icon></icon>
</aboutDialog>
<enableDocumentationManager>false</enableDocumentationManager>
<enableAddressBar>false</enableAddressBar>
<enableFilterFunctionality>false</enableFilterFunctionality>
</assistant>
<docFiles>
<generate>
<file>
<input>helpDoc.qhp</input>
<output>helpDoc.qch</output>
</file>
</generate>
<register>
<file>helpDoc.qch</file>
</register>
</docFiles>
</QHelpCollectionProject>
3.生成,新建一个docs文件夹将html文件,上面创建的文件放里边,创建一个bat文件与docs同级,bat内容如下:
cd /d %~dp0
echo register my help ...
del ./docs/helpDoc.qch
del ./docs/helpDoc.qhc
qhelpgenerator ./docs/helpDoc.qhp -o ./docs/helpDoc.qch
assistant -register ./docs/helpDoc.qch
qcollectiongenerator ./docs/helpDoc.qhcp -o ./docs/helpDoc.qhc
assistant -collectionfile ./docs/helpDoc.qhc
echo -------------over----------------
pause
需要将qhelpgenerator,qcollectiongenerator.exe 路径添加到path 或者 拷贝到bat所在目录,拷贝更方便。
4.可以创建个assistant.exe的快捷方式,添加命令行参数 -collectionfile ./docs/helpDoc.qhc 方便查看