Archived:Porting iPhone native (Objective-C) applications to Qt for Symbian
This article or its primary content has now been incorporated to the Porting to Qt Library
Article Metadata
Contents |
Introduction
When someone familiar with developing for iPhone (Mac Os) Os moves to developing for Symbian OS, there is a period of uncertainty about where to start. Objective-c is used for the native application development in iPhone while in Symbian OS Symbian c++ is used for this purpose. Qt is now becoming a popular among the mobile
developer because of its easy syntax and cross platform capability. Application development using Qt is capable of running on various platform like Windows, Mac-OS, Linux, Symbian. While objective-c application can not provide such a liberty.
This article is meant to provide beginning and intermediate objective-c developers with an introduction to porting applications from objective-c to Qt.
Overview of Objective-c and Qt architecture
iPhone objective-c application based on the architecture given below.
Qt Architecture Overview
Languages Used for Native Development
iPhone OS: Objective-C
Symbian OS: Symbian C++,Qt
Tools
| Qt | Objective-C | |
|---|---|---|
| IDE | Carbide C++,Qt creator | XCode |
Organization Of Source Code
| Extension | Objective-c | Extension | Qt |
|---|---|---|---|
| .h | Header file | .h | Header file |
| .m | Source file | .cpp/.c | Source file |
| .mm | Source files(if actually refer to C++ classes or features from your Objective-C code) | .cpp | Source file |
main() function comparison
Objective-C main() function
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Here actual user code is written in the UIApplicationMain function which is called as soon as application loading is completed.
Qt main() function
#include <QApplication>
#include "digitalclock.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
DigitalClock clock;
clock.showMaximized();
return app.exec();
}
Here user code is written in a separate .cpp file or can be written in the main file also.
Main difference : Qt uses a #include while objective-c uses a #import.





