Chapter 4. Extending Kommander

Creating Kommander Widgets

With Kommander you can create new widgets based on non-Kommander widgets fairly easily. The approach is to derive your new Kommander widget class from the Qt™/KDE widget which you wish to integrate with Kommander, and then also from the KommanderWidget class. Overriding methods from this class gives the Kommander widget its functionality.

Most of the code of a Kommander widget is just template code. Therefore, you can use the widgetgenerator.kmdr Kommander dialog to generate most the Kommander widget code for you. All you have to do is fill in the important parts relating to your widget like any state information, widget text etc.

Let's say we want to create a new line edit widget for Kommander, based on the KDE widget KLineEdit. Using the Kommander widget generator dialog, we get something like this in the outputted header file: