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-10.html | 106 +++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 doc/html/motif-walkthrough-10.html (limited to 'doc/html/motif-walkthrough-10.html') diff --git a/doc/html/motif-walkthrough-10.html b/doc/html/motif-walkthrough-10.html new file mode 100644 index 000000000..0d09bc569 --- /dev/null +++ b/doc/html/motif-walkthrough-10.html @@ -0,0 +1,106 @@ + + + + + +Continuing Development + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

Continuing Development

+ + + +[ Previous: Replacing the Print Dialog ] +[ Home ] +

We have not tquite finished with the migration to TQt, even though our +project does not use Motif any more. TQt provides many useful features +that we can begin using immediately. Some of the most interesting +ones are presented below as a guide for where to start extending your +existing projects. +

Using Unicode +

+

Support for internationalization is very easy +with TQt. Using TQString instead of char* for storing text gives +us support for most of the written languages around the world. Our Page and Options structs look much simpler now. +

+ +


+


+

All functions that use the Page and Options structs need to be +updated to use TQString properly. Since TQString is also an implicitly shared class, we no longer have to do any memory management with our +strings. We can remove all occurences of the qstrdup() function, +and we never need to use new or delete when done with a string. +TQString will allocate and delete data when needed. +

Here are the MainWindow::fileOpen() and MainWindow::pageChange() +functions from mainwindow.ui.h. Notice that the code no longer +uses delete or qstrdup() when storing text. +

+ +


+

+    ...
+
+ +


+

Almost all of the functions in our application are affected by this +change. In most cases, we end up removing more code than we are +adding. To keep the size of this walkthrough reasonable, we've only +shown a small portion of the retquired changes, since the changes are +very similar to those shown above. +

Writing Platform-Independent Code +

+

TQt provides many input and output classes. We +can use these in MainWindow::readDB() and MainWindow::saveDB(). +Currently, these functions use functions only found on UNIX machines. +Using TQFile and TQTextStream removes this dependency on UNIX, and we can +begin building and testing our application on Microsoft Windows and +Apple Mac OS X. +

The platform-independent versions of the MainWindow::readDB() and +MainWindow::saveDB() functions can be found in the io.cpp file. +

Designing a Modern User Interface +

+

Since we used the TQt Designer to design the Main Window +widget, we can extend the interface easily. We can use some of the +more advanced features of TQMainWindow, which includes dockable +toolbars. Adding these is simple with the TQt Designer. The +final version of our project includes a toolbar, which provides tquick +access to the Open, Save, Print, New Page and Delete to Trash actions. +

The possibilities are endless. An Edit menu, with the common Cut, Copy and Paste actions, could be added in a relatively +short period of time. As our project expands to other platforms, we +could add menus and dialogs that allow us synchronize todo lists +between a normal desktop computer and a handheld device running with +TQt/Embedded. +

[ Previous: Replacing the Print Dialog ] +[ Home ] +

+ +


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