I develop a Qt application for windows, and the help file was generated in qch format with the qhc collection file. The help was embedded in the application using QHelpEngine. The help files are put in the same folder as the application executable, and this works well for dev builds.
But when we deploy the application in "Program Files" using a WiX installer, the documentation works but the search function fails, and I get a warning:
virtual void fulltextsearch::clucene::QHelpSearchIndexWriter::run(): Failed because of CLucene exception.
On the dev build, it seems that CLucene create some index files in the help file folder. Here it cannot, since the help file is in the installation folder, and the standard user cannot write there.
Is the error related to missing index file creation rights? How can I make CLucene write to the User folder instead?
Thanks
I found the solution by looking into assistant source code.
CLucene always writes its cache to the same folder as the .qhc
Qt Assistant handles this by not opening the main qhc directly. It copies it to the user profile (Under windows, in
C:\User\Username\appdata\Local\assistant) updating the.qchpaths accordingly, and then open this user specific file.I implemented the same approach and it works like a charm. You don't even have to deploy a
qhcin the installer, you can directly create one by callingQHelpEnginewith a path which does not exists, and register theqchfiles usingregisterDocumentationSo the best way I have found is:
QHelpEnginewith the path of a .qhc file which may not exist, but in a folder which exists and is writable. I useQStandardPaths::CacheLocationfor this. Qt will create a .qhc file if required, or open it again.engine->registeredDocumentations()engine->registerDocumentationHere is my code with a single qch file: