Unable to launch Qt Assistant

Ian Wadham iandw.au at gmail.com
Mon Jul 14 20:09:01 PDT 2014

On 15/07/2014, at 10:56 AM, Mark Brethen wrote:
> On Jul 14, 2014, at 6:22 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
>> I'm testing the FreeCAD build and discovered that the help menu returns the error message: "Unable to launch Qt Assistant (/opt/local/bin/Assistant.app/Contents/MacOS/Assistant)".  Launching Qt Assistant is done in the function startAssistant() which is found in src/Gui/Assistant.cpp. The following lines get the name of the executable and the doc path:
>> #ifdef Q_OS_WIN
>>       QString app;
>>       app = QDir::toNativeSeparators(QString::fromUtf8
>>           (App::GetApplication().GetHomePath()) + QLatin1String("bin/"));

>> #else
As a quick and dirty fix, you could include here:
       #ifdef Q_OS_MAC
             QString app = "/Applications/MacPorts/Qt4/";
>>       QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
>> #endif 
>> #if !defined(Q_OS_MAC)
>>       app += QLatin1String("assistant");
>> #else
>>       app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
>> #endif
>>       QString exe = QString::fromUtf8(App::GetApplication().getExecutableName());
>>       QString doc = QString::fromUtf8(App::Application::getHelpDir().c_str());
>>       QString qhc = doc + exe.toLower() + QLatin1String(".qhc");
>> I'm not that familiar with c++ but I believe 'QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator()' is setting the variable 'app' to /opt/local/bin. This line needs to be patched so that it finds /Applications/Macports/Qt4. How is a string used as a file path In c++?
> In other words, how is the macports variable included in the patch? 
> QString app = ${applications_dir} + QLatin1String("Qt/");

Note the extra #endif.

I don't know the "official" way to obtain the applications bundle path from Qt4-Mac.
Using the literal path as above will get you the "standard" MacPorts bundle path
for Qt4 apps, if and only if you have used MacPorts to install the apps and used
the default MacPorts locations.  So it will get you off the ground, but it is in no way
"general" to any installation of FreeCAD on any Apple OS X host machine.

Cheers, Ian W.

More information about the macports-dev mailing list