Developing QT applications in Xcode?

泪湿孤枕 提交于 2019-11-30 19:07:26

Google shows up many pages, but this Qt4 with Xcode page appeared at first glance to be a fairly definitive resource. However, it was last changed in 2006.

Please check out: http://qt-project.org/doc/qt-5/macosx.html

There is a much more recent Qt Developer Network forum post that seems to have good info in it. Specifically, this reply from August 19, 2011 gives a complete recipe.


Update 25/05/2016:

The first two links are now dead, and not archived due to robots.txt.

However, I've updated the link to the forum post.

And here's a copy of emiguel's answer. It is now 5 years old, so I don't know how current it still is.

Hi,

To solve my problem I did the following.

First I`m going to have a subproject in Qt that mantains the graphical interface, I created this project as a C++ library, so I could include this in the main project.

The main project is a C++ project in Xcode (which is a plugin template with a lot of configurations).

Second, I ported the Qt project to Xcode using the spec macx-xcode parameter.

Third, having both projects in Xcode, I can attatch the library (in Qt) to the main project. To do this, right click in the xcode project and click in the "existing file..." option, select the xcodeproj file from the Qt project. Finally add the library to the linkage phase, this is done by dragging the lib file, wich is under the xcodeproj file, to the "Targets" section in the "Link binary with Libraries".

Fourth, import the Qt framewoks to the main project, to do that, right click in the main project, click in add a existing framework, select the Qt features used by the project (ex. QtSDK/lib/QtCore.framework)

And finally, add the header and library paths in the main project. Click in project menu->project settings, set the header search paths option with the Qt headers (ex QtSDK/include//) and the library search paths (ex QtSDK/lib//**).

That's all, now I can instantiate my own Qt widgets from the C++ project.

Note: I have to do an additional step because my target was i386 and the downloaded Qt version were 64 bit, so I downloaded the sources and compiled it for i386.

Now I have another problems about drawing inner the plugin... but I think that will be for another post.

Thanks a lot for your help

Finally, current information on building Qt in Xcode is available in Qt for OS X - which is too long to copy here, and will be maintained and updated by Qt...

I think this link might answer your question, or provide good information for those seeking an answer to this question:

http://qt-project.org/doc/qtcreator-3.0/creator-developing-ios.html

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