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-4.html | 102 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 doc/html/motif-walkthrough-4.html (limited to 'doc/html/motif-walkthrough-4.html') diff --git a/doc/html/motif-walkthrough-4.html b/doc/html/motif-walkthrough-4.html new file mode 100644 index 00000000..5b105665 --- /dev/null +++ b/doc/html/motif-walkthrough-4.html @@ -0,0 +1,102 @@ + + + + + +Using Custom TQDialogs + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

Using Custom TQDialogs

+ + + +[ Previous: Using TQt Standard Dialogs ] +[ Home ] +[ Next: Using Existing Dialogs with TQMotifDialog ] +

After we have replaced the standard dialogs, we move onto the custom +dialogs. This project has a single custom dialog: the Page Edit +dialog. +

Instead of writing the code ourselves, we use TQt Designer to design our dialog. +Designing a custom dialog is beyond the scope of +this document: see the TQt Designer Manual if you're unfamiliar +with TQt's visual design tool. +

Replacing the Page Edit Dialog +

+

The custom TQDialog description for the Page Edit dialog is saved +as pageeditdialog.ui. We add this file to the project file by +adding the line +

+FORMS = pageeditdialog.ui
+
+ +to the .pro file, and regenerate the Makefile. The uic +utility generates the code for our custom TQDialog, which is then +compiled and linked into our application. (uic is invoked +automatically from makefiles generated from .pro files.) +

We need to pass the top-level TQMotifWidget as the client_data +argument to the EditPage function, which we will use as the parent +for our new PageEditDialog. We do this the same way as we have +done for the Open and Save As dialogs in todo.cpp. +

+ +


+

The EditPage() function is implemented in actions.cpp. We start +by adding the includes needed for the PageEditDialog and TQLineEdit. +

+ +


+

In the EditPage() function, We create the PageEditDialog, set +the initial values of the three TQLineEdit widgets with values from the +current page and execute the dialog. +

+    ...
+
+ +

At this point in the code, the page properties should be modified. The +code to do this is in the DoEditPage() function. We move the +contents of DoEditPage() to this point and remove the DoEditPage() function completely. +

The Page struct defined in page.h stores strings in char* +arrays. Since the PageEditDialog and the data it contains will be +destroyed when we return from this function, we need to convert the +unicode TQString data into a TQCString in the local encoding and +duplicate it with qstrdup(). +


+

The same process must be done for the minorTab text: +


+

... and for the majorTab text: +


+

[ Previous: Using TQt Standard Dialogs ] +[ Home ] +[ Next: Using Existing Dialogs with TQMotifDialog ] +

+ +


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