开发者

How to open a particular file with my QT application on Mac when i double click the file?

I'm finding no way how to open a specific file format which can be opened by my Qt app automatically(when i double click 开发者_运维知识库the file).Please let me know how to do this. Thanks!


You need to set up your Information Property List file (Info.plist) in your application bundle to identify files that can be opened by your app. See http://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html

Specifically, set the CFBundleDocumentTypes key: add items, the file extension and the role of your application (does it edit, view, etc the file).

After you have done this, finder will need to reload the plist. Then you will be able to choose to open files of that type with your application.

In your application, you will need to subclass QApplication and set up a response for QEvent::FileOpen. More information on doing that was given in Qt Quarterly Issue 18.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜