QHelpEngine deployment
-
I see several old threads related to this, one suggesting a bug that was supposedly fixed in Qt 5.13. Other than that I do not see solutions that work for me. I am using Qt 5.15.10 MinGW81_32 in Windows 10 and having trouble deployment an application with help files. Here is some code:
QString hlpPth = QApplication::applicationDirPath() + "/doc/BIPSHelp.qhc"; qDebug() << "Setting Help Path to " << hlpPth.toStdString().c_str(); init_msgs.append(QString("Help path %1").arg(hlpPth)); bipsHelpEngine = new QHelpEngine(hlpPth); // QUrl(InName.c_str()).fileName()); QList<QHelpLink> doclst=bipsHelpEngine->documentsForKeyword("CAL Help"); if (doclst.length()<1) { QString heerr("QHelpEngineCore setupData call failed: :\n"); heerr.append(bipsHelpEngine->error()); init_msgs.append(QString("Help ERROR %1").arg(heerr)); QMessageBox::critical(nullptr, "Help Engine Error", heerr, QMessageBox::Ok, QMessageBox::NoButton); // qDebug() << "QHelpEngineCore setupData call failed: " << heerr.toStdString().c_str(); delete bipsHelpEngine; bipsHelpEngine = 0; } else { bipsHelpEngine->documentationFileName("kcbeck.com.BIPSDacq"); init_msgs.append(QString("Help Setup OK with file %1").arg(bipsHelpEngine->documentationFileName("kcbeck.com.BIPSDacq"))); if (doclst.length()>0) { init_msgs.append(QString("Help found the document (%1) for CAL Help %2").arg(doclst.length()) .arg(doclst[0].url.fileName())); QByteArray fd = bipsHelpEngine->fileData(doclst[0].url); init_msgs.append(QString("CAL Help has data size %1").arg(fd.length())); } }
The HelpEngine gets initialized fine and works when running in the build folder, but after deploying, it does not. The variable
init_msgs
gets written to a file on program startup. Here is the content of the file after running from the build folder:Help path D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qhc Help Setup OK with file D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qch Help found the document (1) for CAL Help CalHelp.html CAL Help has data size 15288 Found an INI file D:\USERS\KEN BECK\DOCUMENTS\BIPSINI\DALLAS_BXB Found a library paths D:/kcbdev/bips_svn/BIPS10/plugins D:/kcbdev/bips_svn/BIPS10/plugins D:/kcbdev/bips_svn/BIPS10/plugins/platforms platforms plugins D:/kcbdev/bips_svn/BIPS10 BIPSMain closing at 29-Sep-2022:12:07:19
And here is the output when running from the install folder:
Help path C:/Program Files (x86)/KCBeck/BIPS_10/doc/BIPSHelp.qhc Help ERROR QHelpEngineCore setupData call failed: : Found an INI file D:\USERS\KEN BECK\DOCUMENTS\BIPSINI\DALLAS_BXB Found a library paths C:/Program Files (x86)/KCBeck/BIPS_10/plugins C:/Program Files (x86)/KCBeck/BIPS_10/plugins C:/Program Files (x86)/KCBeck/BIPS_10/plugins/platforms platforms plugins C:/Program Files (x86)/KCBeck/BIPS_10 BIPSMain closing at 29-Sep-2022:12:08:51
As you can see, after the line
QList<QHelpLink> doclst=bipsHelpEngine->documentsForKeyword("CAL Help");
the document does not load, but there is also no error from the QHelpEngine.
I do distributed Qt5Sql.dll to the deployed folder (n issue in one of the previous posts).
I have tried to remove the 'read-only' flag from the doc folder where the .qhc is located, but in windows 10 that does not seem to do anything.
What do I do to make this work in a deployed application? -
I would say that there's something off indeed.
You should check the bug report system to see if there's something related.
-
Hi,
Since you use the QtSql module you should also deploy the corresponding plugin(s).
Did you use windeployqt to deploy your application ?
-
Thanks for quick response. I do run windepployqt before collecting items to submit to DeployMaster (Just Great Software, I have been using this to deploy my app for 10+ years!) to build the install package for users. And the sqldrivers folder gets distributed with all the other folders in the plugins folder. I just tried adding plugins\sqldrivers explickity to the library paths, but that did not work.
Is there a way to put this .qhc file into the application as a resource? I am using cmake to build this project, what command would I use there if this is possible? Then maybe I would not have this issue? -
Here's a new interesting development. I used the 'Advanced' in the setup application that I send to users to change the install folder from "C:\Program Files (x86)\KCBeck\BIPS_10" to a path with no spaces, c:\Pgms\KCBeck\BIPS_10 and things work! So, is it because the path had no spaces or because the install folder was not set to read-only by Windows (it seems I can't change that setting, when I do, it just reverts back to read-only).
-
Another development- given that the program seemed to work installed in a path with no spaces, I decided to try putting quotes around the path, with the install location the standard windows "C:\Program Files (x86)\KCBeck\BIPS_10", then it does not work AND now I get an error message from the HelpEngineCore after trying to open one of the help files. Here is a snippet from my log file:
Help path "D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qhc" Help ERROR QHelpEngineCore setupData call failed: : Cannot open collection file: D:/kcbdev/bips_svn/BIPS10/"D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qhc"
Note the quotes around the path that get submitted to
bipsHelpEngine = new QHelpEngine(hlpPth); // QUrl(InName.c_str()).fileName());
The SAME program run from the development folder that has no spaces also does not work and gives the following log file (note again the quotes around the path to help)
Help path "D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qhc" Help ERROR QHelpEngineCore setupData call failed: : Cannot open collection file: D:/kcbdev/bips_svn/BIPS10/"D:/kcbdev/bips_svn/BIPS10/doc/BIPSHelp.qhc"
Bottom line: when I put quotes around the path string, the system looks like it APPENDS this string to the current working folder! AND this is the only case where I get an error message from the HelpEngine. Are there a couple bugs here?
-
I would say that there's something off indeed.
You should check the bug report system to see if there's something related.
-
Thanks again for response. There does indeed seem to be a relevant bug report dating to Qt 5.12 in 2020. But that report gave me an idea to try, which is to have my installer put the .qhc file in a folder that a) has no spaces in path; and b) the users have read/modify rights to the file (c:\Pgms\KCBeck\BIPS10). That seems to work as a work-around, at least on my computer, I will have to wait to see if it works for my customers in a few days. Looks like it may have been fixed in Qt 6.0, which I am working up to.