【发布时间】:2014-11-12 22:52:50
【问题描述】:
我在 Qt 中有一个应用程序,正在尝试使用助手寻求帮助。它在 Windows 中运行,试图使其在 Linux 上运行。使用这个example
if (process->state() == QProcess::Running)
return;
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("-collectionFile")
<< "theHelpFile.qhc"
<< QLatin1String("-enableRemoteControl");
process->start(app, args);
if (!process->waitForStarted()) {
QMessageBox::critical(this, tr("Remote Control"),
tr("Could not start Qt Assistant from %1.").arg(app));
return;
}
没有错误,我得到一个打开的窗口 - 无响应且为空。
如果我删除“-enableRemoteControl”选项,它会起作用。
跑步
/usr/bin/assistant -collectionFile theHelpFile.qhc -enableRemoteControl
使用正确的帮助集合启动助手。
我做错了什么?是否需要“-enableRemoteControl”选项?
Qt documentation 说“为了让 Assistant 监听您的应用程序,请通过传递 -enableRemoteControl 命令行选项来打开其远程控制功能。”
但是...如果没有该选项,它可以在我的应用程序中运行...并且不能使用它?
谁能解释一下为什么?
【问题讨论】:
-
也许它希望你发送一个初始命令,但这无论如何听起来像是一个错误。如果您想允许您的应用程序稍后加载帮助页面,您只需要该选项,一旦助手已经启动。因此,如果您只想启动一次,请不要使用该选项。
-
不幸的是,我必须模仿 Windows 中的行为,在那里我可以告诉助手从哪个页面开始 - 我认为只有在助手启动后才能这样做(请参阅链接问题)
标签: c++ linux qt view-helpers assistant