首页 > 其他 > 详细

打开文件所在目录并选择该文件

时间:2015-01-31 23:02:28      阅读:301      评论:0      收藏:0      [点我收藏+]

打开文件所在目录并选择该文件

windows实现方式:
QString strTempPath = "/select,";
strTempPath = strTempPath + QDir::toNativeSeparators(strFilePath);
ShellExecuteW(NULL, TEXT("open"), TEXT("Explorer.exe"), strTempPath.utf16(), NULL, SW_SHOWNORMAL);

mac实现方式:
QStringList scriptArgs;
scriptArgs << QLatin1String("-e")
               << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
                    .arg(strFilePath);
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
scriptArgs.clear();
scriptArgs << QLatin1String("-e")
               << QLatin1String("tell application \"Finder\" to activate");
QProcess::execute("/usr/bin/osascript", scriptArgs);

打开文件所在目录并选择该文件

原文:http://www.cnblogs.com/sz-leez/p/4264801.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!