使用基于Qt的应用程序从Finder打开文件? [英] Opening files from Finder with a Qt-based application?

查看:363
本文介绍了使用基于Qt的应用程序从Finder打开文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,对于Cocoa应用程序,你应该实现 [[NSApp delegate] application:openFile:] 或类似的东西,允许你的应用程序打开文件double

Apparently, for Cocoa applications, you're supposed to implement [[NSApp delegate] application:openFile:] or something like that to allow your application to open files double clicked in Finder.

如何使用Qt实现此功能,因为要打开的文件的名称不会在命令行传递?

How do you achieve this functionality using Qt, as the name of the file to be opened is not passed on the command line?

推荐答案

QFileOpenEvent( Qt4 / Qt5 )应该做的。

QFileOpenEvent (Qt4/Qt5) should do the trick.

另请参阅 https:// doc .qt.io / archives / qq / qq18-macfeatures.html

这篇关于使用基于Qt的应用程序从Finder打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆