The Edit Custom Widgets Dialog

Figure 7-4. The Custom Widgets dialog

This dialog lets you create descriptions for custom widgets; i.e., widgets that are not included in Qt but that you have written yourself or purchased from a third-party manufacturer. You can invoke it by selecting Tools/Custom/Edit Custom Widgets. The unlabeled list box to the left always shows the list of custom widgets known to Qt Designer.

New Widget

Click on this button to start the description of a new custom widget. Qt Designer will create a new description with some default values for a widget class called MyCustomWidget.

Delete Widget

Deletes the description for the currently selected custom widget.

Load Descriptions

Loads a file with descriptions for custom widgets. Chapter 10 explains the format of these files.

Save Descriptions

Saves the descriptions for the custom widgets to a file. Chapter 10 explains the format of these files.

The Definitions Tab Page

On this tab page, you specify some general properties of the custom widget, like how the class is called and how it should be represented in Qt Designer.

Class

Fill in the class name of the custom widget in this field.

Headerfile

Fill in the name of the header file for the custom widget class in this field. By clicking on the button labeled ... next to the entry field, you can bring up a file selection dialog to make selection of the header file name easier. Finally, in the combo box next to the button, you can select whether the header file should be included globally (by surrounding the filename with <> in the include statement) or locally (by surrounding the filename with "").

Pixmap

In the row labeled pixmap, the pixmap that Qt Designer uses to represent your custom widget (in the menu and in the toolbar) is displayed. By default, the Qt logo is used, but you can select another pixmap by clicking on the button labeled ....

Size Hint

In this row, you can specify the size hint for the custom widget; i.e., the size at which the widget displays best. If there is no such size for your widget, or the size hint can only be computed dynamically because it is dependent on runtime characteristics, leave the default -1, -1 here.

Size Policy

In this row, you can specify the horizontal and vertical size policies for the custom widget. For an explanation of the possible values, please see the Qt Reference Documentation.

The Signals Tab Page

On this tab page, you specify the signals of your custom widget. The central, unlabeled list box lists all the signals together with their parameters.

New Signal

Click on this button to insert a new signal entry. By default, the signal will be called signal and will have no parameters.

Delete Signal

Clicking on this button removes the currently selected signal from the list.

Signal

In this edit field, you can edit the name and the parameter types of the currently selected signal. Just fill in the name of the signal and write the parameter types in parentheses.

The Slots Tab Page

On this tab page, you specify the slots of your custom widget. The central, unlabeled list box lists all the slots together with their parameters and their access specifiers.

New Slot

Click on this button to insert a new slot entry. By default, the slot will be called slot, and it will have no parameters and the access specifier public.

Delete Slot

Clicking on this button removes the currently selected slot from the list.

Slot

In this edit field, you can edit the name and the parameter types of the currently selected slot. Just fill in the name of the slot and write the parameter types in parentheses.

Access

Here you can specify the access specifier of the slot, either public or protected.

The Properties Tab Page

On this tab page, you specify the properties of your custom widget. The central, unlabeled list box lists all the properties together with their types.

New Property

Click on this button to insert a new property entry. By default, the property will be called property and will have the type String.

Delete Property

Clicking on this button removes the currently selected property from the list.

Property

In this edit field, you can edit the name of the currently selected property. Just fill in the name of the property.

Type

Here you can specify the type of the property. The following types are available: String (a Unicode string), CString (an 8-bit string), StringList (a list of Unicode strings), bool Int, UInt, Font, Color, Rect, Point, Size, Pixmap, Palette, SizePolicy, and Cursor.