Opening files from Finder with a Qt-based application?

烈酒焚心 提交于 2019-12-24 00:45:47

问题


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.

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


回答1:


QFileOpenEvent (Qt4/Qt5) should do the trick.

Also see https://doc.qt.io/archives/qq/qq18-macfeatures.html



来源:https://stackoverflow.com/questions/3451280/opening-files-from-finder-with-a-qt-based-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!