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.
tqt3/doc/html/designer-manual-14.html

145 lines
17 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/tools/designer/book/chap-wizards.leaf:3 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Reference: Wizards</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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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><p align="right">[<a href="designer-manual-13.html">Prev: Reference: Dialogs</a>] [<a href="designer-manual.html">Home</a>] [<a href="designer-manual-15.html">Next: Reference: Windows</a>]</p>
<h2 align="center">Reference: Wizards</h2>
<a name="reference-wizards"></a><h3><a name="1"></a>Introduction</h3>
<p>In <em>TQt Designer</em>, some of the toolbars, menu options and templates invoke wizards to take you step-by-step through particular tasks. In this chapter we explain each <em>TQt Designer</em> wizard.</p>
<h3><a name="2"></a>Main Window Wizard</h3>
<p>The Main Window Wizard is invoked by clicking the Main Window form template in the <a href="designer-manual-13.html#3-1">New File Dialog</a>. This wizard helps you to create a main window with actions, menu options and toolbars.</p>
<p align="center"><img align="middle" src="qd-mainwinwzd.png" width="658" height="418">
</p>
<h4><a name="2-1"></a>Choose Available Menus and Toolbars</h4>
<p>The 'Choose available menus and toolbars' wizard page appears first. It presents three categories of default actions, File Actions, Edit Actions and Help Actions. For each category you can choose to have <em>TQt Designer</em> create menu items, toolbar buttons and signal/slots connections for the relevant actions. You can always add or delete actions, menu items, toolbar buttons and connections later. Check or uncheck the checkboxes to reflect your preferences.</p>
<p>Click <b>Next</b> to move on to the next wizard page.</p>
<p align="center"><img align="middle" src="qd-mainwinwzdpage2.png" width="658" height="418">
</p>
<h4><a name="2-2"></a>Setup Toolbar</h4>
<p>The 'Setup Toolbar' wizard page is used to populate a toolbar with actions from each of the default action categories. Click the Category combobox to select which set of actions you wish to work on. The Actions listbox lists the actions available for the current category. The Toolbar listbox lists the toolbar buttons you want to create. Click the blue left and right arrow buttons to move actions into or out of the Toolbar list box. Click the blue up and down arrow buttons to move actions up and down within the Toolbar list box. Note that the '&lt;Separator&gt;' item in the Actions list box may be moved to the Toolbar list box as often as required and will cause a separator to appear in the finished toolbar.</p>
<p>Click <b>Back</b> if you want to return to the 'Choose available menus and toolbars' wizard page. Click <b>Finish</b> to populate the main window and to exit the wizard. Click <b>Cancel</b> on any of the wizard pages to leave the wizard without making any changes.</p>
<h3><a name="3"></a>Data Table Wizard</h3>
<p>The Data Table Wizard is automatically invoked by clicking the datatable widget and placing it on the form. The datatable widget is used to create tabular views of database data.</p>
<p align="center"><img align="middle" src="qd-datatablewzd.png" width="585" height="421">
</p>
<h4><a name="3-1"></a>Choose the Database and Table</h4>
<p>The 'Choose the Database and Table' wizard page appears first. The available databases are displayed in the 'Database Connection' listbox. Choose a connection by clicking it. If there are no connections listed in the listbox, click <b>Setup Database Connections</b> to invoke the <a href="designer-manual-13.html#5-3">Edit Database Connections Dialog</a>. The 'Table' listbox shows all the tables and views that are available through the selected database connection. Select a table or view by clicking it.</p>
<p>Click <b>Next</b> to move on to the next wizard page.</p>
<p align="center"><img align="middle" src="qd-datatablewzdpage2.png" width="585" height="421">
</p>
<h4><a name="3-2"></a>Displayed Fields</h4>
<p>The 'Displayed Fields' wizard page is used to select fields that will be displayed in the table. By default, every field except the table or view's primary key, is initially placed in the 'Displayed Fields' list. Click the blue left and right arrow buttons to move fields from the 'Available Fields' listbox and into or out of the 'Displayed Fields' listbox. Click the blue up and down arrow buttons to move fields up and down within the 'Displayed Fields' listbox. The order in which fields appear in the 'Displayed Fields' listbox is the order they are shown in the Data Table, with the top-most field being in the left-most column.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Choose the Database and Table' wizard page.</p>
<p align="center"><img align="middle" src="qd-datatablewzdpage3.png" width="585" height="421">
</p>
<h4><a name="3-3"></a>Table Properties</h4>
<p>The 'Table Properties' wizard page is used to set the Data Table's initial editing options. Check the 'Read-Only' checkbox to prevent records from being edited, deleted or added. Check the checkboxes in the 'Confirmations' section to force the user to confirm their changes. By default users must confirm deletions. Click 'Allow column sorting' to allow the user to sort the data by clicking a column's header (which displays the field name).</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Displayed Fields' wizard page.</p>
<p align="center"><img align="middle" src="qd-datatablewzdpage4.png" width="585" height="456">
</p>
<h4><a name="3-4"></a>SQL</h4>
<p>The 'SQL' wizard page is used to apply filters and sorts to the data in the table. Click the 'Filter' line edit and enter a valid SQL <tt>WHERE</tt> clause without the WHERE keyword. The filter applies to the data shown in the table.</p>
<p>To sort the available fields in the table, click the blue left and right arrow buttons to move fields from the 'Available Fields' listbox into or out of the 'Sort By' listbox. Click the blue up and down arrow buttons to move fields up and down within the 'Sort By' listbox. Click the <b>A-Z</b> button to change the sort order of the selected field in the 'Sort By' listbox from ascending to descending and vice versa.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Table Properties' wizard page.</p>
<p align="center"><img align="middle" src="qd-datatablewzdpage5.png" width="585" height="421">
</p>
<h4><a name="3-5"></a>Finish</h4>
<p>The 'Finish' wizard page is used to select auto-editing and to leave the wizard. If you want user edits, e.g. inserts and updates, to be automatically applied when the user navigates to another record, check the 'AutoEditing' checkbox. If 'AutoEditing' is unchecked, users must press <b>Enter</b> to confirm their edit before moving to another record, or their edit will be lost.</p>
<p>Click <b>Finish</b> to create the datatable widget with all of the options you selected in the wizard. Click <b>Back</b> if you want to return to the 'SQL' wizard page. Click <b>Cancel</b> on any of the wizard pages to leave the wizard without making any changes.</p>
<h3><a name="4"></a>Data Browser Wizard</h3>
<p>The Data Browser wizard is automatically invoked by clicking the DataBrowser widget and placing it on the form. The DataBrowser widget is used to create a form view of database data.</p>
<p align="center"><img align="middle" src="qd-databrowserwzd.png" width="585" height="421">
</p>
<h4><a name="4-1"></a>Choose the Database and Table</h4>
<p>The 'Choose the Database and Table' wizard page appears first. The available databases are displayed in the 'Database Connection' listbox. Choose a connection by clicking it. If there are no connections listed in the listbox, click <b>Setup Database Connections</b> to invoke the <a href="designer-manual-13.html#5-3">Edit Database Connections Dialog</a>. The 'Table' listbox shows all the tables and views that are available through the selected database connection. Select a table or view by clicking it.</p>
<p>Click <b>Next</b> to move on to the next wizard page.</p>
<p align="center"><img align="middle" src="qd-databrowserwzdpage2.png" width="585" height="421">
</p>
<h4><a name="4-2"></a>Displayed Fields</h4>
<p>The 'Displayed Fields' wizard page is used to select fields that will be displayed in the table. Click the blue left and right arrow buttons to move fields from the 'Available Fields' listbox and into or out of the 'Displayed Fields' listbox. Click the blue up and down arrow buttons to move fields up and down within the 'Displayed Fields' listbox.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Choose the Database and Table' wizard page.</p>
<p align="center"><img align="middle" src="qd-databrowserwzdpage3.png" width="585" height="421">
</p>
<h4><a name="4-3"></a>Navigation and Editing</h4>
<p>The 'Navigation and Editing' wizard page is used to create navigation and editing buttons.</p>
<p>Check the 'Include Navigation Buttons' checkbox to include navigation buttons. In the 'Navigation section, click 'Previous' to display the 'Previous' button on the form. This option allows you to navigate to the previous record in the table. Click 'Next' to display the 'next' button on the form. This button allows you to navigate to the next record in the table. Click 'First' to display the 'First' button on the form. This option allows you to navigate to the first record in the table. Click 'Last' to display the 'Last' button on the form. This button allows you to navigate to the last record in the table.</p>
<p>Click the 'Include Edit Buttons' checkbox to include editing buttons. In the 'Editing' section, check the 'Insert' checkbox to create an 'Insert' button for adding new records. Check the 'Update' checkbox to create an 'Update' button for updating existing records. Check the 'Delete' checkbox to create a 'Delete' button for deleting records.</p>
<p>The navigation buttons, and 'Update' and 'Delete' buttons will work without retquiring any code. Since most database designs expect new records to be created with a unique key the 'Insert' button will not work. This can easily be fixed by generating the key in a slot connected to the <tt>TQDataBrowser::beforeInsert()</tt> signal.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Displayed Fields' wizard page.</p>
<p align="center"><img align="middle" src="qd-databrowserwzdpage4.png" width="585" height="456">
</p>
<h4><a name="4-4"></a>SQL</h4>
<p>The 'SQL' wizard page is used to apply filters and sorts to the data in the table. Click the 'Filter' line edit and type a valid SQL <tt>WHERE</tt> clause without the WHERE keyword. The filter applies to the data shown in the table.</p>
<p>To sort the available fields in the table, click the blue left and right arrow buttons to move fields from the 'Available Fields' listbox into or out of the 'Sort By' listbox. Click the blue up and down arrow buttons to move fields up and down within the 'Sort By' listbox. Click the <b>A-Z</b> button to change the sort order of the selected field in the 'Sort By' listbox from ascending to descending and vice versa.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Navigation and Editing' wizard page.</p>
<p align="center"><img align="middle" src="qd-databrowserwzdpage5.png" width="585" height="421">
</p>
<h4><a name="4-5"></a>Layout</h4>
<p>The 'Layout' wizard page is used to design the layout of the database browser. To choose the number of columns the form will use, click the 'Number of Columns' spinbox. To make labels appear to the left of the data entry fields, click the 'Labels to left' radio button. To make labels appear above the data entry fields, click the 'Labels on top' radio button.</p>
<p>Click the 'Create layout for fields' checkbox to arrange all fields inside of a box layout. Click the 'Create layout for buttons' checkbox to arrange all buttons inside of a box layout. Click 'Create layout for all' to create a box layout for the whole widget.</p>
<p>You can always break the layouts and redo them later if you change your mind.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'SQL' wizard page.</p>
<p align="center"><img align="middle" src="qd-databrowserwzdpage6.png" width="585" height="421">
</p>
<h4><a name="4-6"></a>Finish</h4>
<p>The 'Finish' wizard page is used to select auto-editing and to leave the wizard. If you want user edits, e.g. inserts and updates, to be automatically applied when the user navigates to another record, check the 'AutoEditing' checkbox. If 'AutoEditing' is unchecked, users must press <b>Enter</b> to confirm their edit before moving to another record, or their edit will be lost. This property can be changed later if desired.</p>
<p>Click <b>Finish</b> to create the databrowser widget with all of the options you selected in the wizard. Click <b>Back</b> if you want to return to the 'Layout' wizard page. Click <b>Cancel</b> on any of the wizard pages to leave the wizard without making any changes.</p>
<h3><a name="5"></a>Data View Wizard</h3>
<p>The Data View wizard is automatically invoked by clicking the dataview widget and placing it on the form. The Dataview widget is used to create a read-only form view of database data.</p>
<p align="center"><img align="middle" src="qd-dataviewwzd.png" width="585" height="421">
</p>
<h4><a name="5-1"></a>Choose the Database and Table</h4>
<p>The 'Choose the Database and Table' wizard page appears first. The available databases are displayed in the 'Database Connection' listbox. Choose a connection by clicking it. If there are no connections listed in the listbox, click <b>Setup Database Connections</b> to invoke the <a href="designer-manual-13.html#5-3">Edit Database Connections Dialog</a>. The 'Table' listbox shows all the tables and views that are available through the selected database connection. Select a table or view by clicking it.</p>
<p>Click <b>Next</b> to move on to the next wizard page.</p>
<p align="center"><img align="middle" src="qd-dataviewwzdpage2.png" width="585" height="421">
</p>
<h4><a name="5-2"></a>Displayed Fields</h4>
<p>The 'Displayed Fields' wizard page is used to select fields that will be displayed in the table. Click the blue left and right arrow buttons to move fields from the 'Available Fields' listbox and into or out of the 'Displayed Fields' listbox. Click the blue up and down arrow buttons to move fields up and down within the 'Displayed Fields' listbox.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Choose the Database and Table' wizard page.</p>
<p align="center"><img align="middle" src="qd-dataviewwzdpage3.png" width="585" height="421">
</p>
<h4><a name="5-3"></a>Layout</h4>
<p>The 'Layout' wizard page is used to design the layout of the data view. To choose the number of columns the form will use, click the 'Number of Columns' spinbox. To make labels appear to the left of the data entry fields, click the 'Labels to left' radio button. To make labels appear above the data entry fields, click the 'Labels on top' radio button.</p>
<p>Click <b>Next</b> to move on to the next wizard page. Click <b>Back</b> if you want to return to the 'Displayed Fields' wizard page.</p>
<p align="center"><img align="middle" src="qd-dataviewwzdpage4.png" width="585" height="421">
</p>
<h4><a name="5-4"></a>Finish</h4>
<p>The 'Finish' wizard page is used to create the wizard once you have selected all the option you want on the previous wizard pages.</p>
<p>Click <b>Finish</b> to create the databrowser widget with all of the options you selected in the wizard. Click <b>Back</b> if you want to return to the 'Layout' wizard page. Click <b>Cancel</b> on any of the wizard pages to leave the wizard without making any changes.</p>
<!-- eof -->
<p align="right">[<a href="designer-manual-13.html">Prev: Reference: Dialogs</a>] [<a href="designer-manual.html">Home</a>] [<a href="designer-manual-15.html">Next: Reference: Windows</a>]</p>
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>