It happens often when for integration purposes or for making easy way to navigate to files you need to have such action “Show in Finder” on mac or “Show in Explorer” on windows. Well, the code is pretty simple:
#ifdef Q_WS_MAC
QStringList args;
args << "-e";
args << "tell application \"Finder\"";
args << "-e";
args << "activate";
args << "-e";
args << "select POSIX file \""+filePath+"\"";
args << "-e";
args << "end tell";
QProcess::startDetached("osascript", args);
#endif
#ifdef Q_WS_WIN
QStringList args;
args << "/select," << QDir::toNativeSeparators(filePath);
QProcess::startDetached("explorer", args);
#endif