Re: Strong language about Cocoa and Qt
Re: Strong language about Cocoa and Qt
- Subject: Re: Strong language about Cocoa and Qt
- From: Neil Earnshaw <email@hidden>
- Date: Thu, 3 Jul 2003 21:29:03 +0100
What do you need to do to use Project Builder to build Qt apps? I
didn't
notice anything on that in the Qt docs. Any pointers would be
appreciated.
The following applies to the GPL'ed Qt/X11 version for Mac OS X. I.e
the old one that doesn't look like Cocoa and that runs as an X app. It
has been some time since I last worked on the app in question so I
might have forgotten something but, here goes...
PB can automate the production of your moc's. Write a makefile to
generate your moc's and add it to Source folder in the Files tab. Mine
looked like this:
# Make to .moc's for GraphTool
MOCS = GraphToolController.moc \
GraphDialog.moc \
GraphCreator.moc \
GraphEditor.moc \
GraphViewController.moc \
NodeDialog.moc \
NodeCreator.moc \
NodeEditor.moc \
LinkDialog.moc \
LinkCreator.moc \
LinkEditor.moc
all: $(MOCS)
.SUFFIXES : .moc .h
.h.moc:
moc -o $*.moc $<
Tell PB that you want the make file run when it does a build. Select
the Target tab, then the target you want to build. You'll see 'Build
Phases' in the tree. Right click on Build Phases and select New Build
Phase > New Shell Script Build Phase. This will insert a shell script
phase, make sure it is the first element in the list of build phases.
Put your call to make in the Script field. My script field contains:
# make the .moc's
make
PB needs to know about the Qt libraries. Return to the Files tab and
right click on the External Frameworks and Libraries folder. Select
Add Frameworks... Navigate your way to /usr/local/lib (or where ever
you put the libraries) and pick the Qt dylib you want to use. Mine is
libqt-mt.3.0.5.dylib.
PB needs to know where Qt's header files are. Select the Targets tab,
then your target and open the settings folder. Select Search Paths and
add /usr/local/lib/qt3 to the Headers section. Add /usr/local/lib to
the Libraries section if it isn't already there.
When I tried to run my Qt executable from within PB it wouldn't work.
It couldn't connect to the X server because it didn't have a value for
DISPLAY. I spent weeks building in PB then nipping out to an Xterm to
test the application. Then a friend told me to look at
http://developer.apple.com/qa/qa2001/qa1067.html where I found out how
to set environment variable so that an exe spawned by PB can get them.
(Of course, you still have to have the X server running.)
At the moment I'm trying to re-implement the same app as a native Cocoa
Obj-C application. It is hard going but I'm starting to get it. The
Qt version took 5 days to build, and I'd never used Qt before. The
Cocoa version has taken at least a solid month of effort. The first
three and a half weeks were spent learning and getting very frustrated.
The last two days have been great because a big chunk of the
Document-MVC stuff has suddenly crystalized and code is pouring out -
I'm in the zone at last.
When I've got the Cocoa version working I'll try it with the new Qt/Mac
OS X 'native' version. Perhaps I'l be asking you for some help then :-)
Hoe this is useful,
-Neil
Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.