300 likes | 417 Views
Cross Platform Development Focusing on Trolltech QT. By: Gabriel Johnson. Overview. Why do Cross Platform Development? Advantages and Disadvantages Design Issues Tools QT Overview QT Features Signals and Slots Class Library Designer. Cross Platform Development Focusing on Trolltech QT.
E N D
Cross Platform DevelopmentFocusing on Trolltech QT By: Gabriel Johnson
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform DevelopmentFocusing on Trolltech QT By: Gabriel Johnson Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Why Cross Platform? • The computing world is becoming increasingly diverse • With the right tools it can be painless • Open up product to new markets • Open up product to new users Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Advantages • New Target Market • Support Existing Customers • Choice • Code Quality • Financial Reasons • It’s Cool and Gives Warm Fuzzies Cross Platform Development
Disadvantages • Cost of Training • Cost of Purchasing • Testing Time • Managing Multiple Releases • Dependent on Tools Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Design Considerations • Language • Use Standards-Based Persistent Storage • Make Business Logic Abstract • Closer to the User Means Less Portability • Use XML for Standardized, Interoperable Communications between Subsystems • Avoid Hiding The Power of a Specific Platform in the Name of Portability Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Design Issues • Individual Compilers • Follow language Standards • Avoid Compiler Macros or Functions • Individual Platforms • Platform Specific Libraries are Necessary Cross Platform Development
Example MyCreateDialogBox() { if (this is a Windows machine) { call the Windows library CreateDialog() function; } else if (this is a Mac) { call the Mac library's dialog creation function; } else if (this is a UNIX box) { call the X Window System's dialog creation function; } } Cross Platform Development
Design Issues • Individual Compilers • Follow language Standards • Avoid Compiler Macros or Functions • Individual Platforms • Platform Specific Libraries are Necessary • Platform Idiosyncrasies Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Tools • WxWidgets • Java • Python • MONO • QT Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
QT Overview • Qt is a complete C++ application development framework, including • A comprehensive C++ class library • RAD GUI development tool • Internationalization tool Cross Platform Development
QT Overview • QT is Cross Platform • The Qt API and tools are consistent across all supported platforms • Consequence for users and customers • OS Choices Include • Windows® 95 through Server 2003 • Mac OS® X • Linux and embedded Linux • AIX, BSD/OS, FreeBSD, HP-UX, IRIX, NetBSD, OpenBSD, Solaris, Tru64 UNIX Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Application Application Application Qt/X11 lib Qt/Windows lib Qt/Mac lib Unix or Linux MS Windows MacOS QT Features • Qt provides a platform-independent encapsulation of the local window system and operating system • The Qt API is identical on every platform, applications are compiled to native executables • Result: Write once, compile everywhere Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Signals and Slots • Unique inter-object communication mechanism, provides • Type-safe callback between objects • Facilitates loose coupling / encapsulation • Sender and receiver does not ”know about” each other • 1-to-many, many-to-1 communication between objects • Fully Object-oriented Cross Platform Development
Signals and Slots Cross Platform Development
Signals and Slots class Foo : public QObject { Q_OBJECT public: Foo(); int value() const { return val; } public slots: void setValue( int ); signals: void valueChanged( int ); private: int val; }; Cross Platform Development
Signals and Slots void Foo::setValue( int v ) { if ( v != val ) { val = v; emit valueChanged(v); } } Cross Platform Development
Signals and Slots Foo a, b; connect(&a,SIGNAL(valueChanged(int)), &b, SLOT(setValue(int))); b.setValue( 11 ); a.setValue( 79 ); b.value(); Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development
Class Library • GUI Toolkit Classes • Full API to easily create the GUI • Complete set of GUI controls • Native look & feel • OS encapsulation Classes • File & directory handling • Date & time • Registry / preferences • Networking • Process handling • Threading • Dynamic library loading Cross Platform Development
Class Library • SQL Database Classes • Database operations • Database-independent API • DB-aware widgets • Utility Classes • String and regular expressions • Text and binary I/O • Collections • XML I/O • Integration and Migration Classes • OpenGL • ActiveX • Netscape Plugins Cross Platform Development
Overview • Why do Cross Platform Development? • Advantages and Disadvantages • Design Considerations • Design Issues • Tools • QT Overview • QT Features • Signals and Slots • Class Library • Designer Cross Platform Development