Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

[Previous: Qt Designer's Widget Editing Mode] [Contents] [Next: Using Containers in Qt Designer]

Qt Designer's Palette Editor

Although most widget properties can be edited from within Qt Designer's property editor, some complex properties require more comprehensive editing facilities. For rich text, for example, the needs of many form designers can be met by the editor that can be accessed via the form's task menu. Similarly, an editor for widget palettes requires a sophisticated editor that can allow designers to access the full range of options provided by QPalette.

Editing a Palette

The Edit Palette Dialog presents an overview of the entries in the palette above a preview of a sample widget containing many common widgets. By default, the palette entries are set to the default colors or brushes for the designer's platform, and the preview shows how the sample widget will look when using the active group of palette entries.

The Tune Palette group box allows each of the palette entries to be edited individually; simply click on an entry to open the brush editor. Alternatively, you can click the Quick button to choose a single color for the widget background that will be applied to the whole palette.

When the Compute Details radio button is selection, the list of palette entries shows only the active palette entries for the widget. Select the Show Details button to reveal the inactive and disabled palette entries; this also enables them to be edited individually.

The radio buttons in the Preview group box can also be toggled to show the effects of each group of colors in the palette on the sample widget.

Editing a Brush

Each entry in the palette is drawn using a brush, making it possible for widgets to be customized with patterns, gradients, and textures instead of plain colors.

As well as a set of predefined brushes, the brush editor enables different types of effects to be used for the brush that is currently being edited.

The Color Pattern... button is used to access the Edit Color Pattern dialog, enabling the color, level of transparency, and type of pattern to be chosen.

When clicked, the Gradient... button opens the Edit Gradient dialog, which provides control over the type of gradient and colors used.

The Texture... button opens a standard dialog to enable an image to be chosen for the brush's texture.

Editing a Color Pattern

The Edit Color Pattern dialog presents a series of predefined patterns, a set of controls for modifying the color of the currently selected pattern, and a preview group box to help designers obtain the desired result.

Colors can be specified using either RGB (red, green, blue) or HSV (hue, saturation, and value) components. The level of transparency of the pattern can be modified by changing the alpha component.

Editing a Gradient

The Edit Gradient dialog provides options to enable gradients to be specified, taking into account the type of gradient required, the number of color stops used, and the overall transparency of the gradient.

The preview in the top-left corner of the dialog allows certain gradient-specific parameters to be set, such as the focal point of a radial gradient. These can also be specified using the conventional controls alongside the preview.

The central part of the dialog contains a gradient editor that provides a series of handles for the color stops defined for the gradient. You can select a color stop by clicking on it, enabling its color and level of transparency to be modified using the same color controls used in the pattern editor.

Each color stop can also be dragged around to change its position in the gradient; the positions of color stops can be fine-tuned with the Position spin box, which accepts values between 0 and 1.

If many color stops are used, and it becomes difficult to select individual ones, you can use the controls beneath the gradient editor to zoom into the specific part of the gradient you are interested in. The Zoom All button zooms out just far enough to ensure that all color stops are visible; if all color stops are already visible, this button will be automatically disabled.

Choosing a Texture

Textures are chosen using a standard Qt Designer Find Icon dialog. Images can be opened from specific locations in the filing system or they can be referenced via a resource file.

[Previous: Qt Designer's Widget Editing Mode] [Contents] [Next: Using Containers in Qt Designer]


Copyright © 2006 Trolltech Trademarks
Qt 4.2.0-snapshot-20060701