[Qt-creator] Using Qt Creator for legacy ObjectiveC++ project

Henry Skoglund fromqt at tungware.se
Wed Feb 28 23:29:54 CET 2018


Hi,

reading some recent posts about reusing Qt Creator for other project 
flavors than Qt/C++, on a lark I decided to try it on my 6 year old 
ObjectiveC++ LOB app (about 20K SLOC) and it's working great.

I inserted a .pro file with some HEADERS += and SOURCES += in the 
directory, doubleclicked on it and voila, I can use Qt Creator to edit 
those old .mm files (I need to rescale the UI for iPhone X and stuff 
like that). It's a relief not having to work in Xcode, the current 
version 9.2 sometimes feels like waiting for Deep Thought to answer.


A few things in case someone else endeavors to do the same: to get 
IntelliSense to work with all the NSxxx types (which is great, then Qt 
Creator can auto-expand [myString stringByAppendingString:myOtherString] 
and other similar API calls for you) you need to get #includes like 
these up and running:

#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import <MessageUI/MessageUI.h>

because Qt Creator will complain: "not found". I think Xcode does some 
tweaking with the include paths into /Applications/Xcode to get those 
#includes to work, here's what I did:

inserted this in the pro file:

INCLUDEPATH = 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
# (you gotta love Apple for those "simple" directory trees)

and created these symbolic links inside the XCode.app:

cd 
/Applications/Xcode.app/Contents/Developer/Platform/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
sudo ln -s CoreData.framework/Headers CoreData
sudo ln -s Foundation.framework/Headers Foundation
sudo ln -s MessageUI.framework/Headers MessageUI
sudo ln -s UIKit.framework/Headers UIKit
sudo ln -s UserNotificaitons.framework/Headers UserNotifications

Those will probably vanish when Xcode 9.3 or 10.0 arrives, but they're 
easy to reapply.


The code model still complains about some minor things in XCode's files, 
currently I have these 2:

"expecting a type" for NSComparator in NSArray.h in line 74:
- (NSArray<ObjectType> *)sortedArrayUsingComparator:(NSComparator 
NS_NOESCAPE)cmptr API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), 
tvos(9.0));

"nullability specifier _Nullable" cannot be applied to non-pointer type 
'uuid_t' (aka 'unsigned char [16]') in NSUUID.h line 26:
- (instancetype)initWithUUIDBytes:(const uuid_t _Nullable)bytes;

but I can click that green "Minimize" button in the top right corner to 
hide those errors and carry on working anyway.


Finally, got one question:
who's Uncle Bob? (he's listed as one of the Code Model's configurations :-)

Rgrds Henry




More information about the Qt-creator mailing list