[Solved]Using Qt from a Xcode project
Currently I'm working on the development of a plugin for ProTools (a software for audio processing), which have a couple o Xcode templates to start a new plugin. Since Qt offers tools for GUI development, I would like to include Qt in the Xcode project to develop our user interface.
Since the original template (for xcode) have a lot of configurations I was thinking that it is easier to import Qt ui source into the current xcode project, but I'm not sure how can I do that.
I have tested porting new a Qt project to Xcode, and it is working, but the problem is that I wanted to use Qt in a existing Xcode project.
Have somebody any hint?
Thanks in advance for your help!
I did not try that myself, but basically it boils down to:
- add your Qt installation to the list of include paths (something like
- add the QtXXX frameworks from "/usr/local/Trolltech/Qt-4.7.3/libs" to the list of linked frameworks
It may be sufficient to add the frameworks, as they contain the headers too.
thanks for your response.
I added the core and gui frameworks, but the problem is the preprocessing staff, where moc objects are created, etc...
Since I want to use widgets, i create some clases with the QT_OBJECT macro, but i got errors durinf building because some directives are not directly supported.
The xcode template of qmake generates a separate makefile for the moc and uic steps and calls that before the actual run.
You might look at the output of
qmake -spec macx-xcode project.pro
It's in the directory project.xcodeproj, there are two files qt_makeqmake.mak and qt_preprocess.mak in it that handle this stuff.
You may want to add your own rules though.
I`m going to check that and then I post results or doubts...
Thanks a lot!
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
@qmake -spec macx-xcode@
creates a project I can open with Xcode 3.2 but not 4.2 (with the latter, it either crashes, or seems to be entirely empty)…
There's a known incompatibility between Qt/qmake and XCode 4. Digia (Qt Commercial) has a patch, but as far as I know it didn't make it into 4.8.0. With Qt 4 in open governance, chances are better that is integrated soon.
I followed the instructions to get a Qt 32 Bit version to work together with the Pro Tools Plugin SDK in Xcode 3. Now I have problems with drawing into the Plugin window, too. I tried to use the QMacNativeWidget class but that does only work with an individual carbon window like in the example code. The special plugin window which is created by Pro Tools has always some buttons on the top and I couldn't create a Qt Widget below or display some text with carbon in it.
How did you reach your goal to use Qt in an RTAS Plugin?