Hi,
I am working in Qt4.4.
I am trying to show a custom html page in Qt's Assistant.
As per information in Qt Assistant, I am using QProcess to achieve the same.
when I try to show some html page, I get this standard 404 - "The page could not be found" error after assistant gets launched.
The html page I am trying to show is existing for sure in the path given to "SetSource".
Following is the code. I am not sure what am I missing here.
As a matter of fact, I get this page not found error if I try to load an html page from Qt's Assistant documentation for example,
path = "C:/Qt/4.4.0/doc/html/templates.html".
Please let me know whats wrong with my code ...
Can anyone pls tell me also, if it is possible to add my application specific help contents to the existing help contents in the Qt Assistant?
For Ex:
"Qt Assistant Manual"
" QMake Manual"
......
"MyApplication Manual"
Kindly Let me know.
void MainWindow::showHelp()
{
// Check if assistent is already running
if (d
->process
->state
() == QProcess::Running) return;
// start the process bt giving assistent path as argument
#if !defined(Q_OS_MAC)
#else
#endif
// Launch the assistant
d->process->start(app, args);
if (!d->process->waitForStarted())
{
tr("Could not start Qt Assistant from %1.").arg(app));
return;
}
// Show the desired page : THE PROBLEM IS HERE
sendCommand(command);
}
void MainWindow
::sendCommand(const QString &cmd
) {
if (d
->process
->state
() != QProcess::Running) return;
if (!d->process->isWritable() || d->process->bytesToWrite() > 0)
{
QMessageBox::information(this,
"ERROR",
"Unable to send request: Assistant is not responding.");
return;
}
return;
}
void MainWindow::showHelp()
{
// Check if assistent is already running
if (d->process->state() == QProcess::Running)
return;
// start the process bt giving assistent path as argument
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
#if !defined(Q_OS_MAC)
app += QLatin1String("assistant");
#else
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
#endif
QStringList args;
args << QLatin1String("-enableRemoteControl");
// Launch the assistant
d->process->start(app, args);
if (!d->process->waitForStarted())
{
QMessageBox::critical(this, tr("Remote Control"),
tr("Could not start Qt Assistant from %1.").arg(app));
return;
}
// Show the desired page : THE PROBLEM IS HERE
QString command = QLatin1String("SetSource ") + "C:/demos/temp.html";
sendCommand(command);
}
void MainWindow::sendCommand(const QString &cmd)
{
if (d->process->state() != QProcess::Running)
return;
if (!d->process->isWritable() || d->process->bytesToWrite() > 0)
{
QMessageBox::information(this,"ERROR","Unable to send request: Assistant is not responding.");
return;
}
QTextStream str(d->process);
str << cmd << QLatin1Char('\0') << endl;
return;
}
To copy to clipboard, switch view to plain text mode
Best Regards
Bookmarks