Chapter 3. Using Qt Designer's Value Editors

Table of Contents
Shared Pixmaps
ListBox and ComboBox
ListView (Tree View)
TextEdit
Table
IconView

Qt Designer 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 Edit menu item on the pop up menu. If you click 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-Apply, or, close the dialog and click the Undo toolbar button (or press Ctrl+Z). If you undo too much you can always click Redo (or press Ctrl+Y). First we'll briefly describe the Edit Pixmap Collection dialog since this is used by many of the value editors.

Shared Pixmaps

Figure 3-1. Edit Pixmap Collection Dialog

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

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

If you create a widget which has an iconSet or pixmap property you can click the ellipsis button next to the pixmap to invoke the Edit Pixmap Collection dialog through which you can select a pixmap for the widget. 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 the section called ListBox and ComboBox "ListBox".)

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