K Desktop Environment

11.3. Adding Widgets

After specifying the dialogs or widgets class and filenames, you are ready to start creating the widget and filling it with contents. Adding low-level widgets to your dialog is a very easy task. Just select the widget you want to add from the "Widgets" tabulator on the left by a single click over the according widget icon. The widget will then be laid on the left upper corner of the currently opened main widget. An added widget then gets the default size of 100x30 pixels on the editor view. To move a widget, click over it to activate the drawing frame, which is displayed in dark grey with hot spots on the corners and on the center of the top, bottom, left and right sides of the widget. A cross-cursor indicates that the widget can be moved. To move it, press the left mouse button and keep it pressed. then move the widget with your mouse to the place you want to have it displayed later.

To resize a widget, move your mouse cursor over one of the hot spots of the already activated item. The mouse cursor then changes to a double-arrow indicating the directions, in which resizing can be done. Press the left mouse button and hold it pressed. The widget item will change it's size when the mouse is moved to the direction indicated by the cursor.

Further, the widget editor contains a lot of context menus to help you coordinate your work. Those are available over all items in the widgets tabulator and give you a quick help message window that shows the class name of the selected widget with a short description. Over a selected widget, the context menu shows the class name of the selected item and offers:

After setting the size and position, you can edit the preferences for the selected item on the Preferences window.

11.3.1. The Widgets Tabulator

The widgets tab represents the available widgets you can place on the dialog. If you want information about a certain widget, press the right mouse button over a widget icon and select "Quick-Help" from the popup-menu. Mind that the dialog editor automatically determines, if your project type is Qt-only or KDE. This prevents you from using KDE-widgets in a Qt application.

After you selected a widget item, it is placed with default sizes and values on the editing window and marked selected by a frame and darkened corners. To resize a widget, move your mouse over one of the dark spots and your cursor will change to display which resizing directions are possible. Then press the mousebutton and move the mouse while holding it. When you're finished with resizing the widget, release the mouse. While resizing, the statusbar displays the current position of the item by X and Y values and the current size by W(Width) and H(Height) values.

11.3.2. The Dialogs Tabulator

The dialogs tabulator is intended to let you open your project's dialogs by a mouseclick. As the dialog's structure is saved in a *.kdevdlg file within the directory that contains the generated files, only those dialog definition files are shown. Also mind that you don't delete these definition files.

On selecting a dialog, it will be shown as by the state it was saved in the last editing step in the Widget-Editor view.

11.3.3. The Items Tabulator

The Items tabulator lets you have an overview over the currently present widget items of the dialog hierarchically. This means, that, as your background represents the parent of all widgets within the dialog, it is shown on top of the tree. The children of the main dialog are then listed in the next tree-level.

On selecting an item, it gets marked in the editor view, as well as the properties are shown in the properties window. Using the items view is sometimes important if your widgets behavior depends on the parent-child relationship.