KDE Application Tutorials: Creating KDE Applications

Next Previous Table of Contents

### 4. Creating KDE Applications

This handbook will try to teach you KDE/Qt application design by creating an example application step-by-step. The major intention is to gain a certain understanding how two of the most important ideas of graphical user interface programming work: the document-view model and the multiple document interface (MDI) model.

By this, you will also get a good idea of concepts that are coming up ahead: KDE 2 and the Qt 2.1 library, bringing new enhancements and technology to the programmer's hands that will improve application design and widen the possibilities that are open to use. Keywords such as widget themes, Inter-Process Communication and embedded applications are popularly talked about and will allow even more than one can think about right now.

Therefore, KDevelop 1.1, still based on KDE 1.1.x, provides developers some of the most requested possibilities: developing applications for KDE 2, while still running a stable desktop environment. This also implies that this tutorial will be based on a KDE 2 application that already makes use of Qt-2.1, offering a solution for the mentioned MDI model - which we provide as a ready-to-go frame application. During this tutorial you will get a clear insight on how it works and this will also make it much easier to understand the document-view model as well - which is hard to understand even for advanced programmers. That will help you create other type of applications, which use the document-view model even if they only contain one window and you wouldn't obviously see a need for it. But let's just go inside it - you will see what's coming up on you and how easy it actually is.

The further chapters of the tutorial cover the following several steps:

- installing KDE 2 (libraries) and setting up KDevelop to create KDE 2 applications.
- understanding the basic concepts of MDI and document-view model.
- creating the generic framework for KScribble and explaining the concept of the framework.
- implementing the document class, who will provide the interface to read and write the document data as well as maintaining the document.
- implementing the view class to visualize the data. This class also takes over the interaction with the user.
- adding dialogs to set the pen width and color of the pen to draw with, including their integration into the toolbar and menubar
- changing the view from the default `QWidget` inheritance to a scrollable view.

The tutorial example itself is based on the code found in the scribble example application that comes with the Qt library. The source of the original example can also be found within the Qt documentation, section examples.

Next Previous Table of Contents