\chapter Reference: Value Editors

\index Value Editors
\QD provides value editors for some widgets which allow you to set
default values for particular instances. In this chapter we'll explain
how to use the value editors. All value editors are invoked using the
same techniques: either double click the widget or right click the
widget and click the \Menu Edit menu item on the
pop up menu. If you click \Button Apply in any of the
value editor dialogs the settings are applied to the widget in the form.
If you want to revert your changes you can either change the settings in
the value editor dialog and re-\Button Apply, or, close
the dialog and click the \Button Undo toolbar button (or
press \Key {Ctrl+Z}). If you undo too much you can always
click \Button Redo (or press \Key {Ctrl+Y}).
First we'll briefly describe the \Dialog {Edit Image Collection} dialog
since this is used by some of the value editors.

\section1 Shared Pixmaps

\index Adding!Pixmaps
\index Pixmaps!Edit Image Collection Dialog
\index Edit Image Collection
\img chooseapixmap.png
\caption Edit Image Collection Dialog

The first version of \QD kept static pixmaps (icons) in each form's
\index .cpp
\File .cpp file. This was inefficient if the same pixmaps
were required in several different forms. \QD now creates a 
file, in which it places a single copy of each pixmap used in the
application.

To add pixmaps to the application click
\Menu {Edit|Pixmap Collection} to invoke the \Dialog {Edit Image Collection}
dialog. Any pixmaps already in the project are shown in the icon view.
You can add additional pixmaps by clicking \Button Add which will pop
up a file dialog through which you can choose a pixmap.

If you create a widget which has an \Property iconSet or \Property
pixmap property you can click the ellipsis button to invoke the
\Dialog {Edit Image Collection} dialog through which you can select a
pixmap for the widget. The ellipsis button appears when you click in
the Value part of the Properties list by a \Property pixmap or
\Property iconSet property. Some widgets can hold multiple pixmaps,
for example a list box can hold both pixmaps and text. The list box's
value editor can be used to add pixmaps as required. (This is
described in \l {ListBox and ComboBox}.)

If you really want to store pixmaps in a particular form rather than in
the images file you can do so: right click the form,
then click \Menu {Form Settings}; click 'Save Inline', then click \OK.

\section1 ListBox and ComboBox

\index Value Editors!ListBox
\index Value Editors!ComboBox
\index Edit List Box
\img listbox-editor.png
\caption Edit List Box Dialog

\index Deleting!ListBox Items
\index Deleting!ComboBox Items
\index Adding!ListBox Items
\index Adding!ComboBox Items
This value editor allows us to hard-code list items in
\Widget {ComboBox}es and \Widget {List Box}es. We can always
change them at runtime. A list item consists of some text or a pixmap or
both. Items are added by clicking the \Button {New Item} button and
deleted by clicking \Button {Delete Item}. The order of items can be
changed by clicking an item in the list to select it and clicking the up
and down blue arrows to move the selected item. If you want a pixmap
click the ellipsis button which will pop up the \Dialog {Edit Image Collection} dialog. You can either choose one of the pixmaps shown or
click \Button Add to add one from somewhere in your filesystem. To
remove a pixmap click the item, then click the scissors button. The same
value editor is used for list boxes and combo boxes.

\section1 ListView (Tree View)

\index Value Editors!ListView
\index Tree View!ListView
\index Edit List View
\img listview-editor.png
\caption Edit List View Dialog

\index Deleting!ListView Items
\index Adding!ListView Items
This editor allows us to hard-code columns and list view items in
\Widget {List View}s. We can
change the list view dynamically in code. A list
view consists of one or more columns of data. The first column may have
a tree structure with items having sub-items and so on. The dialog
consists of two tabs, the Items tab where we can add, edit and delete
items and move them within the list view, and the Columns tab where we
name the columns we require.

We'll describe the Columns tab first. To add a new column click the
\Button {New Column} button and enter a name in the Text
line edit. You can add a pixmap to the column by clicking the ellipsis
button and choosing a pixmap from the
\Dialog {Edit Image Collection} dialog. The scissors button is used to
delete the pixmap, and the blue up and down arrow buttons are used to
move the highlighted column up and down in the column list.

The Items tab is used to add items. To add a top-level item click the
\Button {New Item} button. To add a sub-item click the item
that you want to be the sub-item's \e parent then click
\Button {New Subitem}. The Text line edit is used to enter
the item's text. Since there may be more than one column the Column spin
box is used to choose which column the text you enter will go into.
Items can also have pixmaps which are added by clicking the ellipsis
button and choosing a pixmap. They can be deleted by clicking the scissors
button. Items and sub-items can be deleted by clicking them, then
clicking the \Button {Delete Item} button. The up and down
blue arrow buttons  move the selected item up and down amongst the other
items with the same parent. The right and left blue arrow buttons are
used to move an item up and down in the hierarchy, e.g. to make a
sub-item into a top-level item click the sub-item then click the left
blue arrow button.

\section1 TextEdit

\index Value Editors!TextEdit
\index Text
\img textedit-editor.png
\caption Text Dialog

This widget is a multi-line editor (superseding
\Class {QMultiLineEdit}), which can display either plain
text or rich text. The dialog presents a text edit in plain text mode.
You can enter rich text by using HTML tags and attributes, for example,
\code
<h2>Text Edit</h2>
<p align="center">
The Text Edit widget supports <b>rich</b>
<font color="ff0000">text</font>.</p>
\endcode

Block level tags like headings, aligned paragraphs, ordered and
unordered lists are all available. Inline tags like bold, italic, big,
small and font are also supported. Tables, hypertext links and images
may also be used.
Full information on the tags and attributes that \Widget {Text Edit}
supports is given in the online \link http://doc.trolltech.com/qstylesheet.html QStyleSheet \endlink
documentation.

\section1 Table

\index Value Editors!Table
\index Edit Table
\index Deleting!Table Columns
\index Deleting!Table Rows
\index Adding!Table Columns
\index Adding!Table Rows
\img edit-table-dialog.png
\caption Edit Table Dialog

This dialog is used to set up the characteristics of a \Widget Table; it
is \e not a value editor. The \Dialog {Edit Table} dialog is used to
specify how many columns and rows the table should have and to label the
rows and columns. All these characteristics can be changed in code. The
left hand part of the dialog shows a preview of the table, the right
hand part contains two tabs, the Columns tab and the Rows tab. Columns
are added by clicking the \Button {New Column} button. A column may have
a textual label entered in the Label line edit and a pixmap. The pixmap
is inserted by clicking the ellipsis button and choosing the pixmap you
want. You can delete the pixmap by clicking the scissors button. The
columns can be reordered by clicking a column in the column list and
then clicking the blue up and down arrow buttons. To delete a column
click it in the column list then click \Button {Delete
Column}.

The Rows tab is used to add rows. It works in the same way as the
columns tab. Click \Button {New Row} to add a row and
change its label in the Label line edit. Rows can also have a pixmap and
may be reordered in exactly the same way as columns. The contents of
cells must be inserted through code.

\section1 IconView

\index Value Editors!IconView
\index Edit Iconview
\index Deleting!Iconview Items
\index Adding!Iconview Items
\img iconview-editor.png
\caption Edit Iconview Dialog

This dialog is used to add icons with text labels to an
\Widget IconView. New
items are added by clicking \Button {New Item}, then typing
in their text in the Text line edit. Items can also be added or deleted
in code. You can either use the default icon or choose your own by
clicking the ellipsis button to invoke the
\Dialog {Edit Image Collection} dialog. The
pixmap can be deleted by clicking the scissors button, and the item can
be deleted by clicking it then clicking \Button {Delete Item}.
