<li><p>Start Page- This property specifies which page <em>TQt Assistant</em> should initially display when the profile is used. Usually, this is the HTML file which contains the documentation's table of contents. This property also describes the default location to go to when pressing the home button in <em>TQt Assistant</em>'s main user interface. The start page is specified relative to the location of the profile. The property name is <tt>startpage</tt></p>
<li><p>About Menu Text- This property describes the text that appears in the <b>Help</b> menu, e.g. About Application. The property name is <tt>aboutmenutext</tt></p>
<li><p>About URL- This property can be used to point to an HTML file that describes the contents in the About dialog that is opened for the <b>Help</b> menu, e.g. About Application. The url is specified relative to the location of the profile. The property name is <tt>abouturl</tt></p>
<li><p><em>TQt Assistant</em> Documentation- This property describes the location of the <em>TQt Assistant</em> documentation. This is retquired since <em>TQt Assistant</em> provides self help, such as the full text search help and the <em>TQt Assistant</em> Manual option in the <b>Help</b> menu. The location is a directory relative to the location of the profile. The property name is <tt>assistantdocs</tt>.</p>
<li><p><em>TQt Assistant</em> Documentation- This property describes the location of the <em>TQt Assistant</em> documentation. This is required since <em>TQt Assistant</em> provides self help, such as the full text search help and the <em>TQt Assistant</em> Manual option in the <b>Help</b> menu. The location is a directory relative to the location of the profile. The property name is <tt>assistantdocs</tt>.</p>
</ul><p>To define a profile, one needs to specify a <em>TQt Assistant</em> Document Profile, usually abbreviated <tt>.adp</tt>. The profile is an extension of the Documentation Content File described above. We add a <tt>profile</tt> tag containing <tt>property</tt> tags to the format.</p>
<p>An example of a document profile file is shown below:</p>
<p>This manual presents <em>TQt Designer</em>, a tool for designing and implementing user interfaces built with the TQt multiplatform GUI toolkit. <em>TQt Designer</em> makes it easy to experiment with user interface design. At any time you can generate the code retquired to reproduce the user interface from the files <em>TQt Designer</em> produces, changing your design as often as you like. If you used an earlier version you will find yourself immediately productive in the new version since the interface is very similar. And you will also find new widgets and new and improved functionality which have been developed as a result of your feedback.</p>
<p>This manual presents <em>TQt Designer</em>, a tool for designing and implementing user interfaces built with the TQt multiplatform GUI toolkit. <em>TQt Designer</em> makes it easy to experiment with user interface design. At any time you can generate the code required to reproduce the user interface from the files <em>TQt Designer</em> produces, changing your design as often as you like. If you used an earlier version you will find yourself immediately productive in the new version since the interface is very similar. And you will also find new widgets and new and improved functionality which have been developed as a result of your feedback.</p>
<p><em>TQt Designer</em> helps you build user interfaces with layout tools that move and scale your widgets (<em>controls</em> in Windows terminology) automatically at runtime. The resulting interfaces are both functional and attractive, comfortably suiting your users' operating environments and preferences. <em>TQt Designer</em> supports TQt's signals and slots mechanism for type-safe communication between widgets. <em>TQt Designer</em> includes a code editor which you can use to embed your own custom slots inside the generated code. Those who prefer to separate generated code from hand crafted code can continue to use the subclassing approach pioneered in the first version of <em>TQt Designer</em>.<!-- index Controls!Widgets --></p>
<p>The manual introduces you to <em>TQt Designer</em> by leading you through the development of example applications. The first seven chapters are tutorials, each designed to be as self-contained as possible. Every chapter, except the first three, assumes that you are familiar with the material in chapters two and three which cover the basics of building a TQt application with <em>TQt Designer</em>. Here's a brief overview of the chapters:</p>
<ul><li><p>Chapter one, <ahref="designer-manual-2.html">Quick Start</a>, is a fast hands-on tutorial that takes you through the creation of a short, simple dialog application. The aim of this chapter is to give you a feel for how <em>TQt Designer</em> works, with explanations and details deferred to later chapters.</p>
<li><p>Chapter two, <ahref="designer-manual-3.html">Creating a Main Window Application</a>, introduces <em>TQt Designer</em> and takes you step by step through the creation of a small but fully functional application. Along the way you will learn how to create a main window with menus, toolbars and a status bar. Most of the application's implementation will be covered, but the custom dialogs are deferred until chapter three. In the course of this chapter you will use the form and property editors to customize the application. You'll also learn how to use TQt's signals and slots mechanism and <em>TQt Designer</em>'s built-in code editor to make the application functional. We will also explain how to use <tt>qmake</tt> to generate a Makefile so that you can compile and run the application.</p>
<li><p>In chapter three, <ahref="designer-manual-4.html">Creating Dialogs</a>, we will create the custom dialogs retquired by the main window application created in chapter two. In addition to demonstrating various ways of creating dialogs, you will also learn how to lay out forms using the layout tools.</p>
<li><p>In chapter three, <ahref="designer-manual-4.html">Creating Dialogs</a>, we will create the custom dialogs required by the main window application created in chapter two. In addition to demonstrating various ways of creating dialogs, you will also learn how to lay out forms using the layout tools.</p>
<li><p>Chapter four, <ahref="designer-manual-5.html#the-designer-approach">The Designer Approach</a>, provides information on the <em>TQt Designer</em> approach to developing applications, and explains some of the rationale behind <em>TQt Designer</em>.</p>
<li><p>Chapter five, <ahref="designer-manual-6.html">Subclassing and Dynamic Dialogs</a>, will show you how to subclass a form; this allows you to clearly separate the user interface from the underlying code that implements its functionality. Additional information on <tt>qmake</tt> and <tt>uic</tt> is included in this chapter. This chapter will also explain how you can dynamically load dialogs from<!-- index .ui --><tt>.ui</tt> files into your application using <ahref="qwidgetfactory.html">TQWidgetFactory</a> and how to access the widgets and sub-widgets of these dialogs.</p>
<li><p>Chapter six, <ahref="designer-manual-7.html">Creating Custom Widgets</a>, explains how you can create your own custom widgets. Both the simple method, that was introduced with the first version of <em>TQt Designer</em>, and the new more powerful method using plugins, are explained.</p>
</ul><p>The remaining chapters provide reference material that explains <em>TQt Designer</em>'s <ahref="designer-manual-11.html#reference-menu-options">menu options</a>, <ahref="designer-manual-12.html#reference-toolbar-buttons">toolbars</a>, <ahref="designer-manual-10.html#reference-key-bindings">key bindings</a>, <ahref="designer-manual-13.html#reference-dialogs">dialogs</a>, <ahref="designer-manual-14.html#reference-wizards">wizards</a>, and <ahref="designer-manual-15.html#reference-windows">windows</a> in detail.</p>
<h3><aname="2"></a>What You Should Know</h3>
<p>This manual assumes that you have some basic knowledge of C++ and the TQt GUI toolkit. If you need to learn more about C++ or TQt there are a vast number of C++ books available, and a small but increasing number of TQt books. TQt comes with extensive online documentation and many example applications that you can try.</p>
<p>The Enterprise Edition of TQt includes the TQt SQL module. In <ahref="designer-manual-8.html">Creating Database Applications</a> we demonstrate how to build SQL applications with <em>TQt Designer</em>; this chapter retquires some knowledge of SQL and relational databases.</p>
<p>The Enterprise Edition of TQt includes the TQt SQL module. In <ahref="designer-manual-8.html">Creating Database Applications</a> we demonstrate how to build SQL applications with <em>TQt Designer</em>; this chapter requires some knowledge of SQL and relational databases.</p>
<h3><aname="3"></a>What's New in <em>TQt Designer</em> for TQt 3.0?</h3>
<p>This version of <em>TQt Designer</em> has a great deal more functionality than its predecessor. For example, the code for custom slots can be edited directly in <em>TQt Designer</em>; main windows with actions, toolbars and menus can be created; layouts that incorporate splitters can be used; and plugins allow you to package any number of custom widgets and make them available to <em>TQt Designer</em>. Many other enhancements have been incorporated, from small improvements in the user interface to improved efficiency, for example the ability to share pixmaps across all the forms in an application.</p>
<p>This version of <em>TQt Designer</em> introduces project files which make it easy to switch between all the forms in an application, and to maintain a common set of database settings and images. Although subclassing is fully supported, writing code directly in <em>TQt Designer</em> offers a number of benefits which are covered in <ahref="designer-manual-5.html#the-designer-approach">The Designer Approach</a> chapter. A new library, <tt>libtqui</tt>, has also been introduced which allows you to load dialogs dynamically at runtime from <em>TQt Designer</em>'s <tt>.ui</tt> files. This allows you to provide your application's users with considerable interface customizability without them needing to use C++.</p>
<p>Click <b>Edit|Slots</b> to invoke the <em>Edit Functions</em> dialog. Use this dialog to edit or create slots and functions which are used in conjunction with signals to provide communication between objects.</p>
<p>When this dialog is invoked, all existing slots and functions are shown in the listview. The column headers Function, Return Type, Specifier, Access, Type, and In Use provide details about each function that is listed. Click on any of the column headers to sort the functions. To create a new function, click the <b>New Function</b> button. The new function has a default name that you should replace by typing the new name in the 'Function' line edit. The 'Return Type' is also a default that can be changed by typing in the line edit. To change the 'Specifier' or 'Access', click the combobox and choose the retquired specifier or access. To change the type of a function (function or slot), click the Type combobox. To remove a function, click the function you want to delete, and then click the <b>Delete Function</b> button.</p>
<p>When this dialog is invoked, all existing slots and functions are shown in the listview. The column headers Function, Return Type, Specifier, Access, Type, and In Use provide details about each function that is listed. Click on any of the column headers to sort the functions. To create a new function, click the <b>New Function</b> button. The new function has a default name that you should replace by typing the new name in the 'Function' line edit. The 'Return Type' is also a default that can be changed by typing in the line edit. To change the 'Specifier' or 'Access', click the combobox and choose the required specifier or access. To change the type of a function (function or slot), click the Type combobox. To remove a function, click the function you want to delete, and then click the <b>Delete Function</b> button.</p>
<p>Click <b>OK</b> to save all changes made to the functions. Click <b>Cancel</b> to leave the dialog without making any changes to the functions.</p>
<aname="dialog-view-connections"></a><h4><aname="4-2"></a>View and Edit Connections Dialog</h4>
<p>Click <b>Edit|Form Settings</b> to invoke the <em>Form Settings</em> dialog. Use this dialog to save the form's settings, pixmap, and layout properties.</p>
<h5><aname="4-3-1"></a>Settings</h5>
<p>In the Settings section, you can change or add the name of the class that will be created by typing in the 'Class Name' line edit. Note that the default name is the form name, but it can be changed. You can also enter text to the 'Comment' and 'Author' line edits or leave them blank, since they are not retquired.</p>
<p>In the Settings section, you can change or add the name of the class that will be created by typing in the 'Class Name' line edit. Note that the default name is the form name, but it can be changed. You can also enter text to the 'Comment' and 'Author' line edits or leave them blank, since they are not required.</p>
<h5><aname="4-3-2"></a>Pixmaps</h5>
<p>The default (for projects) is 'Project Imagefile'. This is the recommended option. Images are handled automatically, with <em>TQt Designer</em> storing the images in a subdirectory, and <tt>uic</tt> producing code that contains the images and the necessary supporting code. Each image is stored just once, no matter how many forms it is used in.</p>
<p>If you do not want <em>TQt Designer</em> to handle the images, (or are not using a project) choose either 'Save Inline' or 'Use Function'. 'Save Inline' saves the pixmaps in the <tt>.ui</tt> files. The disadvantage of this approach is that it stores images in the forms in which they're used, meaning that images cannot be shared across forms. Click 'Use Function' to use your own icon-loader function for loading pixmaps. Type the function's name (with no signature) in the 'Use Function' line edit. This function will be used in the generated code for loading pixmaps. Your function will be called with the text you put in the pixmap property (e.g. the image name) whenever an image is retquired.</p>
<p>If you do not want <em>TQt Designer</em> to handle the images, (or are not using a project) choose either 'Save Inline' or 'Use Function'. 'Save Inline' saves the pixmaps in the <tt>.ui</tt> files. The disadvantage of this approach is that it stores images in the forms in which they're used, meaning that images cannot be shared across forms. Click 'Use Function' to use your own icon-loader function for loading pixmaps. Type the function's name (with no signature) in the 'Use Function' line edit. This function will be used in the generated code for loading pixmaps. Your function will be called with the text you put in the pixmap property (e.g. the image name) whenever an image is required.</p>
<h5><aname="4-3-3"></a>Layouts</h5>
<p>Click the 'Default Margin' spinbox or the 'Default Spacing' spinbox to change the default layout settings of the current form.</p>
<p>To use the functions in the generated code to dynamically retrieve values for the layout's default margin and spacing, check the Use Functions chechbox. In the Margin and Spacing line edits, specify the function names (no signatures or parantheses) which should be used to retrieve the margin and spacing.</p>
<p>The <em>Edit Custom Widgets</em> dialog is invoked by clicking <b>Tools|Custom|Edit Custom Widgets</b>. Use this dialog to create custom widgets.</p>
<p>Custom widgets are created in code. They may contain a combination of existing widgets but with additional functionality, slots and signals, or they may be written from scratch, or a mixture of both. A custom widget is often a specialization (subclass) of another widget or a combination of widgets working together or a blend of both these approaches. If you simply want a collection of widgets in a particular configuration it is easiest to create them, select them as a group, and copy and paste them as retquired within <em>TQt Designer</em>. Custom widgets are generally created when you need to add new functionality to existing widgets or groups of widgets. To add create a new widget, click the <b>New Widget</b> button. You will find more information about adding new widgets in the 'Definitions Section'. To load a file which contains descriptions of custom widgets, click the <b>Load Descriptions</b> button. Clicking this button invokes the <em>Open Dialog</em>. To save the descriptions of the listed custom widgets, click the <b>Save Descriptions</b> button, which invokes the <em>Save As Dialog</em>. To delete a widget, click the widget in the listbox and then click the <b>Delete Widget</b> button.</p>
<p>Custom widgets are created in code. They may contain a combination of existing widgets but with additional functionality, slots and signals, or they may be written from scratch, or a mixture of both. A custom widget is often a specialization (subclass) of another widget or a combination of widgets working together or a blend of both these approaches. If you simply want a collection of widgets in a particular configuration it is easiest to create them, select them as a group, and copy and paste them as required within <em>TQt Designer</em>. Custom widgets are generally created when you need to add new functionality to existing widgets or groups of widgets. To add create a new widget, click the <b>New Widget</b> button. You will find more information about adding new widgets in the 'Definitions Section'. To load a file which contains descriptions of custom widgets, click the <b>Load Descriptions</b> button. Clicking this button invokes the <em>Open Dialog</em>. To save the descriptions of the listed custom widgets, click the <b>Save Descriptions</b> button, which invokes the <em>Save As Dialog</em>. To delete a widget, click the widget in the listbox and then click the <b>Delete Widget</b> button.</p>
<p>Click <b>Close</b> to leave the Edit Custom Widgets dialog.</p>
<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 '<Separator>' item in the Actions list box may be moved to the Toolbar list box as often as retquired and will cause a separator to appear in the finished toolbar.</p>
<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 '<Separator>' 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><aname="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>This tag is only relevant to Windows users.</p>
<p>If you have a class that retquires some Windows-specific export macro, e.g. for classes in a DLL that need to be declared like this: <tt>class win_specific_declaration_goes_here Class</tt>, you can use the <tt><exportmacro></tt> tag. (In standard TQt we use the <tt>Q_EXPORT</tt> macro, e.g. <tt>class Q_EXPORT TQWidget</tt>.) If you use this tag you must also:</p>
<p>If you have a class that requires some Windows-specific export macro, e.g. for classes in a DLL that need to be declared like this: <tt>class win_specific_declaration_goes_here Class</tt>, you can use the <tt><exportmacro></tt> tag. (In standard TQt we use the <tt>Q_EXPORT</tt> macro, e.g. <tt>class Q_EXPORT TQWidget</tt>.) If you use this tag you must also:</p>
<oltype=1><li><p><ahref="designer-manual-16.html#1-11">include</a> the file which contains the macro definition;</p>
<li><p>add the export macro to the form -- this is achieved by entering the macro's name in the 'export macro' sub-property of the form's name property.</p>
</ol><p>Following these steps will ensure that <ahref="uic.html">uic</a> will create the correct <tt>class YOUR_MACRO Form</tt> declarations.</p>
<blockquote><palign="center"><em>Main Window Wizard- Choosing menus and toolbars</em></p></blockquote>
<li><!-- index Creating Toolbars --><!-- index Toolbars, Creating --><!-- index Toolbar Buttons!Adding --><!-- index Adding!Toolbar Buttons --><!-- index Separator!Menu item --><!-- index Separator!Toolbar button --><p>The <em>Setup Toolbar</em> wizard page is used to populate a toolbar with actions from each of the default action categories. The Category combobox is used to select which set of actions you wish to choose from. The Actions list box lists the actions available for the current category. The Toolbar listbox lists the toolbar buttons you want to create. The blue left and right arrow buttons are used to move actions into or out of the Toolbar list box. The blue up and down arrow buttons are used to move actions up and down within the Toolbar list box. Note that the '<Separator>' item in the Actions list box may be moved to the Toolbar list box as often as retquired and will cause a separator to appear in the finished toolbar.</p>
<li><!-- index Creating Toolbars --><!-- index Toolbars, Creating --><!-- index Toolbar Buttons!Adding --><!-- index Adding!Toolbar Buttons --><!-- index Separator!Menu item --><!-- index Separator!Toolbar button --><p>The <em>Setup Toolbar</em> wizard page is used to populate a toolbar with actions from each of the default action categories. The Category combobox is used to select which set of actions you wish to choose from. The Actions list box lists the actions available for the current category. The Toolbar listbox lists the toolbar buttons you want to create. The blue left and right arrow buttons are used to move actions into or out of the Toolbar list box. The blue up and down arrow buttons are used to move actions up and down within the Toolbar list box. Note that the '<Separator>' 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>Copy the New, Open, and Save Actions to the Toolbar list box. Copy a <Separator> to the Toolbar list box. Change the Category to Edit and copy the Cut, Copy, and Find actions to the Toolbar list box. Click <b>Next</b> and then click <b>Finish</b>.</p>
<p>Click <b>File|Save</b> and save the form as <tt>mainform.ui</tt>.</p>
<!-- index Code Editing --><!-- index Subclassing --><!-- index Forward declarations --><!-- index Includes --><!-- index Adding!Code --><!-- index Adding!Forward declarations --><!-- index Adding!Includes --><!-- index Adding!Class variables --><!-- index Class variables --><!-- index Deleting!Forward declarations --><!-- index Deleting!Includes --><!-- index Deleting!Class variables --><!-- index Forms!Forward declarations --><!-- index Forms!Class variables --><!-- index Forms!Code editing --><!-- index Forms!destructor --><!-- index Forms!constructor --><p>In the original version of <em>TQt Designer</em> if you wanted to provide code for a form you had to subclass the form and put your code in the subclass. This version fully supports the subclassing approach, but now provides an alternative: placing your code directly into forms. Writing code in <em>TQt Designer</em> is not quite the same as subclassing, for example you cannot get direct access to the form's constructor or destructor. If you need code to be executed by the constructor create a slot called<!-- index init() --><tt>void init()</tt>; if it exists it will be called from the constructor. Similarly, if you need code to be executed before destruction create a slot called<!-- index destroy() --><tt>void destroy()</tt>. You can also add your own class variables which will be put in the generated constructor's code, and you can add forward declarations and any includes you retquire. To add a variable or declaration, right click the appropriate item, e.g. Class Variables, then click <b>New</b> then enter your text, e.g. <tt>TQString m_filename</tt>. If one or more items exist, right click to pop up a menu that has New, Edit and Delete options. If you want to enter multiple items, e.g. multiple include files or multiple data members, it is easiest to right click in the relevant section, then click <b>Edit</b> to invoke an Edit dialog. To edit code, just click the name of a function to invoke the code editor. Code editing and creating slots are covered later in the chapter.</p>
<!-- index Subclassing --><p>If you subclass the form you create your own<!-- index .cpp --><tt>.cpp</tt> files which can contain your own constructor, destructor, functions, slots, declarations and variables as your retquirements dictate. (See <ahref="designer-manual-6.html#1">Subclassing</a> for more information.)</p>
<!-- index Code Editing --><!-- index Subclassing --><!-- index Forward declarations --><!-- index Includes --><!-- index Adding!Code --><!-- index Adding!Forward declarations --><!-- index Adding!Includes --><!-- index Adding!Class variables --><!-- index Class variables --><!-- index Deleting!Forward declarations --><!-- index Deleting!Includes --><!-- index Deleting!Class variables --><!-- index Forms!Forward declarations --><!-- index Forms!Class variables --><!-- index Forms!Code editing --><!-- index Forms!destructor --><!-- index Forms!constructor --><p>In the original version of <em>TQt Designer</em> if you wanted to provide code for a form you had to subclass the form and put your code in the subclass. This version fully supports the subclassing approach, but now provides an alternative: placing your code directly into forms. Writing code in <em>TQt Designer</em> is not quite the same as subclassing, for example you cannot get direct access to the form's constructor or destructor. If you need code to be executed by the constructor create a slot called<!-- index init() --><tt>void init()</tt>; if it exists it will be called from the constructor. Similarly, if you need code to be executed before destruction create a slot called<!-- index destroy() --><tt>void destroy()</tt>. You can also add your own class variables which will be put in the generated constructor's code, and you can add forward declarations and any includes you require. To add a variable or declaration, right click the appropriate item, e.g. Class Variables, then click <b>New</b> then enter your text, e.g. <tt>TQString m_filename</tt>. If one or more items exist, right click to pop up a menu that has New, Edit and Delete options. If you want to enter multiple items, e.g. multiple include files or multiple data members, it is easiest to right click in the relevant section, then click <b>Edit</b> to invoke an Edit dialog. To edit code, just click the name of a function to invoke the code editor. Code editing and creating slots are covered later in the chapter.</p>
<!-- index Subclassing --><p>If you subclass the form you create your own<!-- index .cpp --><tt>.cpp</tt> files which can contain your own constructor, destructor, functions, slots, declarations and variables as your requirements dictate. (See <ahref="designer-manual-6.html#1">Subclassing</a> for more information.)</p>
</blockquote>
<h4><aname="4-3"></a>Adding Custom Actions</h4>
<p>We want to provide the user with actions that are specific to our application. We want to provide the ability to switch between the two views we will be offering, and allow the user to add colors and set their preferred options. We'll prepare the way by creating a new menu for the view options and by adding a separator to the toolbar.</p>
<h4><aname="6-5"></a>Editing the Code: Setting Up</h4>
<p>There is quite a lot of code to include in the application, but this does not mean that a lot of typing is retquired! All the code is reproduced here so, if you're reading an electronic copy, you can simply cut and paste. If you're reading a print copy, all the code is provided in <tt>/tools/designer/examples/colortool</tt>; simply open the relevant <tt>.ui.h</tt> files and copy and paste from there into your own version of the project.</p>
<p>There is quite a lot of code to include in the application, but this does not mean that a lot of typing is required! All the code is reproduced here so, if you're reading an electronic copy, you can simply cut and paste. If you're reading a print copy, all the code is provided in <tt>/tools/designer/examples/colortool</tt>; simply open the relevant <tt>.ui.h</tt> files and copy and paste from there into your own version of the project.</p>
<blockquote>
<palign="center"><b> Cutting & Pasting Into the Code Editor</b></p>
<p>If you cut and paste code from this manual, because we've indented the code for readability, the code will be over-indented in <em>TQt Designer</em>. This is easily solved. Simply select the function containing the pasted code (either with the mouse, or <b>Shift+Arrow</b>s) and press <b>Tab</b>: this will make <em>TQt Designer</em> fix the indentation. Note that you must select the <em>entire</em> function, including its name and parameters.</p>
<p>This function is at the heart of the application. It visually presents the data to the user. If the table is "dirty" (e.g. if the user has added or deleted colors in the icon view, or has opened a color file) we will populate the table. We start by deleting the contents of every cell. Next we change the number of rows to equal the number of colors in the colors map. For each color we want to display a little square that shows the color, so we create a pixmap of the retquired size.</p>
<p>This function is at the heart of the application. It visually presents the data to the user. If the table is "dirty" (e.g. if the user has added or deleted colors in the icon view, or has opened a color file) we will populate the table. We start by deleting the contents of every cell. Next we change the number of rows to equal the number of colors in the colors map. For each color we want to display a little square that shows the color, so we create a pixmap of the required size.</p>
<p>We now create an iterator for our colors map, and iterate over every color. The colors map has the user's color names as its keys, and <ahref="qcolor.html">TQColor</a> instances as values. We retrieve the color and fill our pixmap with that color. We then set the "Name" column (column <tt>COL_NAME</tt>), to have the color's name (<tt>it.key()</tt>) and the pixmap we've just filled with that color. <ahref="qcolor.html">TQColor</a>'s <tt>name()</tt> function returns a string that is the hex representation of a color, e.g. "#12AB2F"; we retrieve this and set the second ("Hex") column to this value.</p>
<p>If the user wants to see if which colors are web colors we create a <ahref="qchecktableitem.html">TQCheckTableItem</a>, and check it if it is a web color. (We'll cover <tt>isWebColor()</tt> shortly.) We then insert this <ahref="qchecktableitem.html">TQCheckTableItem</a> into the "Web" column.</p>
<p>Having populated the table we call <tt>adjustColumn()</tt> to ensure that each column is just wide enough to show its widest entry, and show or hide the "Web" column depending on the user's preference.</p>
<p>This is the second revision of this function. Now we only exit if the user has had the opportunity to save any unsaved changes. (We'll make a third and final version of this function later, when we deal with saving user settings.)</p>
<p>Try making and running the program. If you have <tt>rgb.txt</tt> on your system try loading it and saving it under a new name for testing purposes. If you don't have this file, save the standard colors and use those. In the next section we'll cover adding and deleting colors so that you can create your own color files. (If it doesn't build see the <ahref="designer-manual-4.html#6">Troubleshooting</a> section.)</p>
<h4><aname="6-28"></a>Editing the Code: The Edit Options</h4>
<p>Adding a new color, finding a color and handling user options all retquire custom dialogs, so we'll defer them until chapter three when we deal with dialogs.</p>
<p>Adding a new color, finding a color and handling user options all require custom dialogs, so we'll defer them until chapter three when we deal with dialogs.</p>