Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.8
Description
We're using Qt 5.12.8 , the issue occurs on both Windows and Linux and under my testing, the key is either the file in question is not owned by the current user or the folder(s) about the file in question is not owned by the user.
Listed below is a simple example of the issue. When you toggle the setting g_qsHelpFilePath, you can get the test to work or fail, under the call helpEngine->linksForIdentifier but, it looks like it fails well before this call.
PS - this code worked in QT 5.6.2
#include <QProcess>
#include <QFileInfo>
#include <QApplication>
#include <QMessageBox>
#include "QtHelp/QHelpEngineCore"
//static members initializations
static QProcess* g_pAsstProcess = nullptr;
static QString g_qsHelpFilePath("e:\\hped\\builds\\sr\\doc
ads.qhc"); // Works
//static QString g_qsHelpFilePath("z:\\hped\\builds\\sr\\devXXX\\rgdevelop\\debug\\prod\\doc
ads.qhc"); // Failing
static QString g_qsAssistantPath("e:\\AdsWrk\\myProdCpy\\bin\\Help
assistant.exe");
//Internal functions
static bool is_assistant_running()
{
if (!g_pAsstProcess)
return false;
return g_pAsstProcess->state() == QProcess::Running;
{color:#000000}}
int main(int argc, char* argv[])
{
QApplication aTestApp(argc, argv);
QStringList args;
g_pAsstProcess = new QProcess(qApp);
g_pAsstProcess->start(g_qsAssistantPath, args);
if (!is_assistant_running())
{
QMessageBox msgBox(QMessageBox::Critical, QString("Assistant"), QString("Failed to run %1\n").arg(g_qsAssistantPath),
QMessageBox::Ok);
msgBox.exec();
}
QFile hFile(g_qsHelpFilePath);
if (!hFile.open(QIODevice::ReadOnly))
{
QMessageBox msgBox(QMessageBox::Critical, "Help system problem",
QString("Failed to open file: %1\n").arg(hFile.fileName()));
msgBox.exec();
}
QHelpEngineCore* helpEngine = new QHelpEngineCore(g_qsHelpFilePath);
if (!helpEngine->setupData())
{
QMessageBox msgBox(QMessageBox::Critical, "Help system problem",
QString("The help system failed to initialze using the file: %1\n").arg(helpEngine->collectionFile()));
msgBox.exec();
}
QMap<QString, QUrl> links;
links = helpEngine->linksForIdentifier("Home");
auto count=links.count();
if (count == 0)
{
QMessageBox msgBox(QMessageBox::Critical, "Help system problem",
QString("The help links not found under: %1\n").arg(helpEngine->collectionFile()));
msgBox.exec();
}
return true;
{color:#000000}}