[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/motif/doc/walkthrough.doc:243 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>Preparing to Migrate the User Interface</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Preparing to Migrate the User Interface</h1>
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | [ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
|
---|
| 37 | [ <a href="motif-walkthrough.html">Home</a> ]
|
---|
| 38 | [ <a href="motif-walkthrough-3.html">Next: Using Qt Standard Dialogs</a> ]
|
---|
| 39 | <p> We are ready to start migrating the user interface for our project.
|
---|
| 40 | As mentioned in the introduction, we do this in steps, ensuring that
|
---|
| 41 | our application is still usable at every step of the migration process.
|
---|
| 42 | <p> The user interface can be viewed as a hierarchy; each top-level window
|
---|
| 43 | and dialog depends upon a parent (which is another top-level window or
|
---|
| 44 | dialog). When using <a href="motif-extension.html#Motif">Motif</a> <tt>XmMainWindow</tt> widgets, these should be
|
---|
| 45 | viewed as two separate entities: the <em>Main Window</em> widget with the
|
---|
| 46 | popup-menu hierarchy and the <em>View</em> widget contained in the <em>Main Window</em> widget. The <em>View</em> widget depends on the <em>Main Window</em>
|
---|
| 47 | widget.
|
---|
| 48 | <p> We begin migrating the pieces that have no dependencies, and work our
|
---|
| 49 | way up the dependency tree until all the pieces have been migrated.
|
---|
| 50 | <p> The hierarchy for this project looks something like this:
|
---|
| 51 | <p> <center><img src="motif-todo.png" alt="Motif Todo Hierarchy"></center>
|
---|
| 52 | <p> We will begin by migrating and replacing all of the dialogs, then the
|
---|
| 53 | <em>Main Window</em> widget with popup-menu hierarchy, and finally the <em>View</em> widget.
|
---|
| 54 | <p> However, we are not ready to begin just yet. The migration process can
|
---|
| 55 | be long, but it does not have to be difficult. The <em>Open</em>, <em>Save As</em>, <em>Page Delete</em> and <em>IO Error</em> dialogs use Motif <tt>XmFileSelectionBox</tt> and <tt>XmMessageBox</tt> dialogs. Qt provides similar
|
---|
| 56 | functionality with <a href="qfiledialog.html">QFileDialog</a> and <a href="qmessagebox.html">QMessageBox</a>, which we can begin
|
---|
| 57 | using immediately.
|
---|
| 58 | <p> The <em>Print</em> dialog is special, however. The <em>Print</em> dialog cannot be
|
---|
| 59 | replaced until after we have replaced the <em>View</em> widget. Qt provides
|
---|
| 60 | a complete printing mechanism with <a href="qprinter.html">QPrinter</a>, but we cannot start using
|
---|
| 61 | it until we have replaced the <em>View</em> widget.
|
---|
| 62 | <p> <h2> Removing the <em>Help</em> Dialog
|
---|
| 63 | </h2>
|
---|
| 64 | <a name="1"></a><p> The <em>Help</em> dialog is also special. Instead of replacing the <em>Help</em>
|
---|
| 65 | dialog with a custom <a href="qdialog.html">QDialog</a>, we will use the <a href="helpsystem.html">Qt
|
---|
| 66 | Help System</a> classes to provide a more advanced online help.
|
---|
| 67 | However, we cannot start using classes like <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>
|
---|
| 68 | until we replace the <em>Main Window</em> and <em>View</em> widgets.
|
---|
| 69 | <p> The help text included with the original project is very small and
|
---|
| 70 | only contains information about the <tt>XmNoteBook</tt> widget. The use of
|
---|
| 71 | tooltips and whats-this text will suffice for this example. If your
|
---|
| 72 | migration project has a large online <a href="helpsystem.html#help-system">help system</a>, we recommend looking
|
---|
| 73 | at the <a href="helpviewer-example.html">Simple HTML Help Browser</a>
|
---|
| 74 | example for information on how to build an rich text help system with
|
---|
| 75 | hypertext navigation and full printing capabilities, or using <a href="assistant.html">Qt Assistant</a>.
|
---|
| 76 | <p> Removing the existing <em>Help</em> dialog is relatively simple. We remove
|
---|
| 77 | the <tt>Xmd/Help.h</tt>, <tt>Xmd/HelpP.h</tt> and <tt>Xmd/Help.c</tt> files from our
|
---|
| 78 | project file and regenerate our <tt>Makefile</tt>.
|
---|
| 79 | <p> The code to create the <em>Help</em> menu and <em>Help</em> dialog is in <tt>todo.cpp</tt>. We remove the <tt>Xmd/Help.h</tt> include, the <tt>*help_manager</tt>
|
---|
| 80 | resource string, the <tt>help_cb()</tt> function forward declaration and the
|
---|
| 81 | <tt>help_widget</tt> global variable. We also need to remove the code that
|
---|
| 82 | creates the <em>Help</em> dialog. We will also remove the code to create
|
---|
| 83 | the <em>Help</em> menu, since this menu is now empty. Finally, we remove
|
---|
| 84 | the <tt>help_cb()</tt> function implementation.
|
---|
| 85 | <p> The <em>Help</em> dialog is now removed from our project. We cannot add
|
---|
| 86 | <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a> help at the moment, since we are still using
|
---|
| 87 | <tt>XmMainWindow</tt> for the <em>Main Window</em> widget. Once we have
|
---|
| 88 | migrated the <em>Main Window</em> and the popup-menu hierarchy, we can
|
---|
| 89 | begin using QToolTip and QWhatsThis for online help.
|
---|
| 90 | <p> [ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
|
---|
| 91 | [ <a href="motif-walkthrough.html">Home</a> ]
|
---|
| 92 | [ <a href="motif-walkthrough-3.html">Next: Using Qt Standard Dialogs</a> ]
|
---|
| 93 | <p>
|
---|
| 94 | <!-- eof -->
|
---|
| 95 | <p><address><hr><div align=center>
|
---|
| 96 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 97 | <td>Copyright © 2007
|
---|
| 98 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 99 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 100 | </table></div></address></body>
|
---|
| 101 | </html>
|
---|