You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
6.0 KiB
102 lines
6.0 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/motif/doc/walkthrough.doc:243 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>Preparing to Migrate the User Interface</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<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>
|
|
|
|
|
|
|
|
[ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
|
|
[ <a href="motif-walkthrough.html">Home</a> ]
|
|
[ <a href="motif-walkthrough-3.html">Next: Using Qt Standard Dialogs</a> ]
|
|
<p> We are ready to start migrating the user interface for our project.
|
|
As mentioned in the introduction, we do this in steps, ensuring that
|
|
our application is still usable at every step of the migration process.
|
|
<p> The user interface can be viewed as a hierarchy; each top-level window
|
|
and dialog depends upon a parent (which is another top-level window or
|
|
dialog). When using <a href="motif-extension.html#Motif">Motif</a> <tt>XmMainWindow</tt> widgets, these should be
|
|
viewed as two separate entities: the <em>Main Window</em> widget with the
|
|
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>
|
|
widget.
|
|
<p> We begin migrating the pieces that have no dependencies, and work our
|
|
way up the dependency tree until all the pieces have been migrated.
|
|
<p> The hierarchy for this project looks something like this:
|
|
<p> <center><img src="motif-todo.png" alt="Motif Todo Hierarchy"></center>
|
|
<p> We will begin by migrating and replacing all of the dialogs, then the
|
|
<em>Main Window</em> widget with popup-menu hierarchy, and finally the <em>View</em> widget.
|
|
<p> However, we are not ready to begin just yet. The migration process can
|
|
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
|
|
functionality with <a href="qfiledialog.html">QFileDialog</a> and <a href="qmessagebox.html">QMessageBox</a>, which we can begin
|
|
using immediately.
|
|
<p> The <em>Print</em> dialog is special, however. The <em>Print</em> dialog cannot be
|
|
replaced until after we have replaced the <em>View</em> widget. Qt provides
|
|
a complete printing mechanism with <a href="qprinter.html">QPrinter</a>, but we cannot start using
|
|
it until we have replaced the <em>View</em> widget.
|
|
<p> <h2> Removing the <em>Help</em> Dialog
|
|
</h2>
|
|
<a name="1"></a><p> The <em>Help</em> dialog is also special. Instead of replacing the <em>Help</em>
|
|
dialog with a custom <a href="qdialog.html">QDialog</a>, we will use the <a href="helpsystem.html">Qt
|
|
Help System</a> classes to provide a more advanced online help.
|
|
However, we cannot start using classes like <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>
|
|
until we replace the <em>Main Window</em> and <em>View</em> widgets.
|
|
<p> The help text included with the original project is very small and
|
|
only contains information about the <tt>XmNoteBook</tt> widget. The use of
|
|
tooltips and whats-this text will suffice for this example. If your
|
|
migration project has a large online <a href="helpsystem.html#help-system">help system</a>, we recommend looking
|
|
at the <a href="helpviewer-example.html">Simple HTML Help Browser</a>
|
|
example for information on how to build an rich text help system with
|
|
hypertext navigation and full printing capabilities, or using <a href="assistant.html">Qt Assistant</a>.
|
|
<p> Removing the existing <em>Help</em> dialog is relatively simple. We remove
|
|
the <tt>Xmd/Help.h</tt>, <tt>Xmd/HelpP.h</tt> and <tt>Xmd/Help.c</tt> files from our
|
|
project file and regenerate our <tt>Makefile</tt>.
|
|
<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>
|
|
resource string, the <tt>help_cb()</tt> function forward declaration and the
|
|
<tt>help_widget</tt> global variable. We also need to remove the code that
|
|
creates the <em>Help</em> dialog. We will also remove the code to create
|
|
the <em>Help</em> menu, since this menu is now empty. Finally, we remove
|
|
the <tt>help_cb()</tt> function implementation.
|
|
<p> The <em>Help</em> dialog is now removed from our project. We cannot add
|
|
<a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a> help at the moment, since we are still using
|
|
<tt>XmMainWindow</tt> for the <em>Main Window</em> widget. Once we have
|
|
migrated the <em>Main Window</em> and the popup-menu hierarchy, we can
|
|
begin using QToolTip and QWhatsThis for online help.
|
|
<p> [ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
|
|
[ <a href="motif-walkthrough.html">Home</a> ]
|
|
[ <a href="motif-walkthrough-3.html">Next: Using Qt Standard Dialogs</a> ]
|
|
<p>
|
|
<!-- eof -->
|
|
<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>Qt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|