WidgetsWidgets
The building blocks of a &kommander; dialog are the widgets. They are like any other widget in the &Qt; and &kde; libraries except they have some extra functionality that allows them to have a text association. Text is associated with a state of the widget or its populate slot. The number of states depends on the widget. If a widget only has one state, that state is called default.
The main dialog has two special states for &kommander; text. They are Initialization and Destroy. These are run when the dialog is initialized and when it is destroyed. These protect against what is know as race problems on open and mean that you do not require any special procedures on close to manage housekeeping.In case of using a MainWindow based application (created with &Qt; Designer), there are no Initialization and Destroy states, instead the initialize and destroy signals can be used to get information when is the application constructed or closed
Below are the standard &kommander; widgets. Each of them has numerous functions, you can learn about them by looking at the widget functions in the Function Browser. Many of them have signals and slots as well, documentation about these methods can be found in the &Qt; and &kde; API documentation. Each &kommander; widget has a note about its base widget.
Label
A simple widget that contains a piece of text. This widget lets you set a pixmap too.
See the QLabel documentation to learn more about text labels in &Qt;.
PixmapLabel
A simple widget that contains an image or text label. The pixmap to display is set in the pixmap property. The text is set in the text property. Only one of these properties can be set at the same time (I think, I can't get the editor to set both at the same time). If scaledContents is set to true the image will be scaled to fit the size of the widget. The format of the text can be set with the textFormat property.
See the QLabel documentation to learn more about text labels in &Qt;.
LineEdit
A LineEdit widget is a one line text editor. It allows the user to enter and modify a single line of text. Initial text for the editor can be set in the text property. The widget can be set to read-only with the readOnly property. There are 3 modes for the widget, Normal, NoEcho, and Password. The mode is set with the echoMode property.
LineEdit has one state, default.
The widget text for LineEdit is the text contained in the editor.
See the KLineEdit documentation to learn more about text labels in &kde;.
TextEdit
A simple multi-line text editor.
See the KTextEdit documentation to learn more about multiline text edit in &kde;.
TextBrowser
A simple reach text browser with hyperlink navigation.
See the KTextBrowser documentation to learn more about it.
ListBox
A ListBox widget provides a list of selectable items. Normally one or no items are selected. This behavior can be changed with the selectionMode property. Items are added to the ListBox using the edit window.
A ListBox has only one state, default.
The widget text for a ListBox is the items contained in the ListBox. @selectedWidgetText will return only the items that are currently selected.
See the KListBox documentation to learn more about it.
ComboBox
ComboBox is a selection widget that combines a button and a pop-up menu. It shows the user's current choice from a list of options in minimal space. Items are added to the list using the edit window. If the editable property is set to true the user can enter arbitrary strings.
ComboBox has one state, default.
The widget text for a ComboBox is the text of the selected item.
See the KComboBox documentation to learn more about it.
TreeWidget
A widget that provides a list in the form of a tree structure. You can add child items and multi-column data. The current limitation is that you cannot modify columns. To add a child node use / as a separator. To add column data use the escaped tab \t character between columns.
See the KListView documentation to learn more about it.
Table
A table widget that support different widgets in its cells.
See the QTable documentation to learn more about it.
ExecButton
A button that when clicked executes its text association. The label on the button is set with the text property. Output from the text association (how to say that) will be echoed to stdout if the writeStdout property is set to true. The button can be the default action for the dialog if the default property is set to true.
ExecButton has one state, default.
There isn't widget text associated with ExecButton.
See the KPushButton documentation to learn more about it.
CloseButton
A button that when clicked, executes its text association and then closes the dialog. The label on the button is set with the text property. Output from the text association (how to say that) will be echoed to stdout if the writeStdout property is set to true. The button can be the default action for the dialog if the default property is set to true.
CloseButton has one state, default.
There isn't any widget text associated with a CloseButton.
See the KPushButton documentation to learn more about it.
Konsole
A widget that captures the output of scripts in a text browser. The default state is executed and the output of those commands (internal or external) are shown in the widget.
FileSelector
The FileSelector widget combines a LineEdit with a button when clicked will present the user with dialog for the selection of files/folders. The file/folder selected is stored in the LineEdit. The type of the FileSelector is set with the selectionType property. Available types are Open, Save, and Directory. Multiple files/folders can be selected if the selectionOpenMutliple property is set to true. A caption for the FileChooser can be set with the selectionCaption property. This is display as the window title of the dialog. If a caption isn't specified, the type of selection will be display in the title. The files displayed in the dialog can be limited using the selectionFilter property.
FileSelector has one state, default.
The widget text for a FileSelector is the text contained in the LineEdit (the file chosen by the user).
CheckBox
A button that can be checked on and off. It can also be semi-checked if the tristate property is set to true. The label associated with the CheckBox is set in the text property. Setting the checked property will have the CheckBox initially checked.
A CheckBox has 3 states, checked, semichecked, and unchecked.
The widget text for a CheckBox is the value from the text property.
See the KCheckBox documentation to learn more about it.
RadioButton
A button that can be checked or unchecked, usually used in the ButtonGroup to make an exclusive choice. A label associated with the button can be set in the text property. A button can be initialized to checked by setting the checked property to true. If all RadioButtons in a ButtonGroup have the checked property set to true, then the last button will be the one that is checked.
RadioButton has 2 states checked and unchecked.
There is no widget text associated with a RadioButton.
See the KRadioButton documentation to learn more about it.
ButtonGroup
A container to organize buttons into a group. An optional title can be set using the title property. The frame can be adjusted with the lineWidth property. The button group can be set to exclusive by setting the exclusive property to true. This means when one toggle button is clicked all other toggle buttons will be set to off with the exception of radio buttons that are always mutual exclusive even if the group is non-exclusive. Radio buttons can be set to non-exclusive using the radioButtonExclusive property. (I am not so sure that this property actually works.)
ButtonGroup has one state, default.
The widget text for a ButtonGroup is the text associations for each of the buttons in the order they appear in the ButtonGroup.
GroupBox
A container widget that holds other widgets. The frame is adjusted with the lineWidth property. A title can be added by setting the title property.
GroupBox has one state, default.
The widget text for GroupBox is the text associations of each of the widgets it contains combined. They will be in the order they appear inside of the GroupBox.
TabWidget
A widget that provides multiple tabs each may contain other widgets.
See the KTabWidget documentation to learn more about it.
SpinBoxInt
A widget that allows the user to change a integer value by either press up and down arrows or entering a value into the box. Minimum and maximum values for the widget can be set with the minValue and maxValue properties. The specialValueText property is used to set a text value that will be displayed instead of the minimum value.
This widget has only one state, default.
The widget text for a SpinBoxInt is the currently displayed integer.
See the QSpinBox documentation to learn more about it.
Slider
A widget that provides horizontal or vertical slider.
See the QSlider documentation to learn more about it.
RichTextEditor
This widgets provides a text editor that allows for simple text formatting.
RichTextEditor has one state, default.
The widget text for RichTextEditor is the text contained in the editor in rich text format. Selected text can be returned with @selectedWidgetText.
StatusBar
A widget to display status information, usually used at the bottom of the dialogs.
See the KStatusBar documentation to learn more about it.
ProgressBar
A widget to display progress information.
See the KProgress documentation to learn more about it.
ScriptObject
This is a pseudo-widget, it does not appear when the dialog is run. It can be though about as a function. A ScriptObject holds code that can be executed anytime from the dialog by calling its execute function. Arguments can be passed to the ScripObject with the above method and accessed inside the ScriptObject as @Self.item(0), @Self.item(1), etc. if using the old style parsing or Self.item(0, Self.item(1), etc. with the new parser.
Signals can be connected to the execute function as well, as it acts also as a slot.
Timer
This is a pseudo-widget, it does not appear when the dialog is run. It can be used to perform an action after a specified time once, or regularly. Set the timeout interval in milliseconds, choose if it should run once (singleShot) or not. Connect its timeout signal to a slot, which will be executed once the specified time passes.
The timer is not started by default, run the execute function to start it.
See the QTimer documentation to learn more.
DatePicker
A widget used to select a date. The default date can be set in the date property or with the setText function in ISO format: YYYY-MM-DD.
The widget text is the currently displayed date.
See the KDatePicker documentation to learn more.
New in Kommander 1.3.
AboutDialog
This is a pseudo-widget, it does not appear when the dialog is run. It stores information about the application, the authors, the license. Shows the about dialog
when the execute function is called.
The initialize function must be called before anything else, including the execute function.New in Kommander 1.3.
FontDialog
A pseudo-widget, that can be used to get a font selection dialog. The default font can be set with the setFont function, and the selected font's properties retrieved with the family, pointSize, bold, italic functions. The dialog is shown when the execute function is called.
New in Kommander 1.3.
PopupMenu
A pseudo-widget, that can be used to display a menu. Use the insert... functions to add menu entries. Whenever the user clicks on a menu entry, the specified executeWidget's execute function will be run. It is possible to connect the menu entries to the popupmenu's own execute function, in which case the text assigned to the default state is run. When adding menu items you can assign an index to them and handle the all the items on a menu in the menu widget as the request passes this index back. To see how this works look at the current example keyvaluecombo.kmdr included with this release. To find it look on the tools menu of the editor for the examples dialog.
To show the menu, use popup slot. Usually this is connected to another widget's contextMenuRequested signal.A menu can contain other PopupMenu submenus.New in Kommander 1.3.
ToolBox
A container widget, like TabWidget. It has several pages, each page can hold other widgets.
This widget has an editor bug that does not affect it's use in execution, but does affect it's use in the editor. If you try to add pages in the editor it will become unreadable. Don't do this. If you want to use the ToolBox please use fill the widget on the fly using the addWidget command. If there is time an example will be added to the 1.3 release, or check the web site.See the QToolBox documentation to learn more about it.New in Kommander 1.3.