Qt Designer's Widget Editing ModeIn the Widget Editing Mode, objects can be dragged from the main window's widget box to a form, edited, resized, dragged around on the form, and even dragged between forms. Object properties can be modified interactively, so that changes can be seen immediately. The editing interface is intuitive for simple operations, yet it still supports Qt's powerful layout facilities. To create and edit new forms, open the File menu and select New Form... or press Ctrl+N. Existing forms can also be edited by selecting Open Form... from the File menu or pressing Ctrl+O. At any point, you can save your form by selecting the Save From As... option from the File menu. The UI files saved by Qt Designer contain information about the objects used, and any details of signal and slot connections between them. Editing A FormBy default, new forms are opened in widget editing mode. To switch to Edit mode from another mode, select Edit Widgets from the Edit menu or press the F3 key. Objects are added to the form by dragging them from the main widget box and dropping them in the desired location on the form. Once there, they can be moved around simply by dragging them, or using the cursor keys. Pressing the Ctrl key at the same time moves the selected widget pixel by pixel, while using the cursor keys alone make the selected widget snap to the grid when it is moved. Objects can be selected by clicking on them with the left mouse button. You can also use the Tab key to change the selection. ### Screenshot of widget box, again The widget box contains objects in a number of different categories, all of which can be placed on the form as required. The only objects that require a little more preparation are the Container widgets. These are described in further detail in the Using Containers in Qt Designer chapter.
When a widget is selected, normal clipboard operations such as cut, copy, and paste can be performed on it. All of these operations can be done and undone, as necessary. The following shortcuts can be used:
All of the above actions (apart from cloning) can be accessed via both the Edit menu and the form's context menu. These menus also provide funcitons for laying out objects as well as a Select All function to select all the objects on the form. Widgets are not unique objects; you can make as many copies of them as you need. To quickly duplicate a widget, you can clone it by holding down the Ctrl key and dragging it. This allows widgets to be copied and placed on the form more quickly than with clipboard operations.
Qt Designer allows selections of objects to be copied, pasted, and dragged between forms. You can use this feature to create more than one copy of the same form, and experiment with different layouts in each of them. The Property EditorThe Property Editor always displays properties of the currently selected object on the form. The available properties depend on the object being edited, but all of the widgets provided have common properties such as objectName, the object's internal name, and enabled, the property that determines whether an object can be interacted with or not.
Certain properties are treated specially by the property editor:
Dynamic PropertiesThe property editor can also be used to add new dynamic properties to both standard Qt widgets and to forms themselves. Since Qt 4.4, dynamic properties are added and removed via the property editor's toolbar, shown below. To add a dynamic property, clcik on the Add button . To remove it, click on the Remove button instead. You can also sort the properties alphabetically and change the color groups by clickinig on the Configure button . The Object Inspector
|