From d796c9dd933ab96ec83b9a634feedd5d32e1ba3f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 8 Nov 2011 12:31:36 -0600 Subject: Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731 --- doc/html/motif-walkthrough-1.html | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 doc/html/motif-walkthrough-1.html (limited to 'doc/html/motif-walkthrough-1.html') diff --git a/doc/html/motif-walkthrough-1.html b/doc/html/motif-walkthrough-1.html new file mode 100644 index 000000000..aac0cab67 --- /dev/null +++ b/doc/html/motif-walkthrough-1.html @@ -0,0 +1,98 @@ + + + + + +Getting Started + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

Getting Started

+ + + +[ Home ] +[ Next: Preparing to Migrate the User Interface ] +

Starting with TQMotif and TQApplication +

+

To be able to use TQt, we need to create a TQApplication object. The +TQApplication class controls all the event delivery and display +management for all other TQt objects and widgets. We need to use the +TQMotif class from the TQt Motif Extension to allow TQApplication +and the XtAppContext to coexist. +

The TQApplication object must be created in the main() function. +We will need to modify todo.c to compile with a C++ compiler, so we +rename todo.c to todo.cpp. +

Next, we add the appropriate includes for the TQMotif and TQApplication +classes. +

+ +


+

Next, we create the TQMotif and TQApplication objects. We create TQMotif +with a foreign XtAppContext, and we create TQApplication with a +foreign Display. +


+

The next change is not yet necessary, but it is included to show that +the TQt Motif Extension provides a complete integration. +Normally, a Motif based program would use the XtAppMainLoop() +function to run the application's event loop. This is still possible, +but since we are migrating to the TQt toolkit, we prefer to use the +TQApplication::exec() function for running the event loop. +


+

Since we renamed todo.c to todo.cpp, we must change the +project file and rerun qmake to regenerate our Makefile. When we +build our project, there are compile and link errors: we will fix +these in the following section. +

Migrating to C++ +

+

We need to convert the code in this file to proper C++ code. +Fortunately, the changes are not too large. Most files included from +existing C projects are not C++ compatible, so we make them compatible +by wrapping them in an extern "C" block. +

+ +


+

Global C functions that are forward declared must also be wrapped into +an extern "C" block. +


+

The manageCB() function needs to be converted to proper C++. +


+

And we need to fix two invalid casts. One is in the Save() function. +


+

The other invalid cast is in the Open() function. +


+

After these changes, the project compiles and links, and the +application runs and operates correctly. +

[ Home ] +[ Next: Preparing to Migrate the User Interface ] +

+ +


+ +
Copyright © 2007 +TrolltechTrademarks +
TQt 3.3.8
+
+ -- cgit v1.2.1