PDA

View Full Version : Launching Qt Assistant from code on Mac



dmateer
9th June 2010, 23:09
The recommended way (http://doc.qt.nokia.com/4.6/assistant-custom-help-viewer.html) of launching Qt Assistant as a custom help viewer is to start a process. The example on that page works great for Linux, but how does one achieve this on Mac, where the Qt Assistant is in an app bundle? Right now I am doing this:



QStringList args;
args << QLatin1String("-collectionFile")
<< helpPath_
<< QLatin1String("-enableRemoteControl");

#ifdef Q_WS_MAC
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/Assistant.app/Contents/MacOS/Assistant");
#else
QString app = QLatin1String("assistant");
#endif

process_->start(app, args);
process_->waitForStarted();


This is working, but seems very hackish and fragile to me. Is there a cross-platform way of doing this? If not, is that the recommended way of launching an application within an app bundle as a process? Is the internal folder structure of a Mac app bundle stable?

Thanks for any pointers.

ABBAPOH
10th June 2010, 08:54
"open Assistant.app" ? however i don't know how to pass arguments to Assistant in that case (man open)

dmateer
10th June 2010, 15:48
Well, I gave that a try, but the QProcess doesn't seem to "hang on," so the remote control commands get orphaned. I tried using the -W parameters as well, but it didn't make a difference.