Next Previous Table of Contents

### 2. Getting Started

Getting Started- that means, you should have set up KDevelop to work correctly first. Ensure you have access to the Qt online reference documentation by the "Help" menu or the according book in the documentation tree. When looking a the first page of the Ot documentation, you will see that it contains a link to a section "Tutorials" and "Examples". Under "Tutorials", you will find a 14-step introduction into using the Qt library to build applications. On the other hand, "Examples" will lead you to a list of example programs that Qt includes and takes for example usage reference in certain classes. Now, if you are an absolute beginner, you should be comfortable with the idea behind Qt- providing a library that offers:

- a base application class (`QApplication`)
- a widget library for graphical user interfaces
- a set of additional helper classes for graphics, file and data handling
- the signal-slot mechanism for object communication
- event controlling by event loops and virtual methods

If that doesn't tell you anything right now, you should read about the Qt library in The KDevelop Programming Handbook where the basics for a Qt application are described in detail. There, you will also find and introduction about the difference between a Qt and a KDE application, which is not much at the first level of the Qt tutorial step.

Now, to learn about Qt first would be a good start for programming KDE applications as well, so we will create a project that will produce the tutorial applications after editing.

To do this, start with opening KDevelop and select "Project"-"New" from the menubar. The application wizard opens and you have to select which type of project you want to build. For Qt applications, you would choose the Qt application, but we will use the mini-KDE project to build our examples. The reason is simple: the Qt tutorials don't contain much code, and by choosing the Qt application in the application wizard, we would have to do a lot of changing on the provided code to create the "true" examples.

But as the mini-KDE application only consists of an empty main window but also checks for the Qt library and header files, it will fit for our purposes and doesn't require much changes.

When entering the next wizard page, we have to enter the project-specific information. There, we can leave out any KDE-specific additions such as a mini-icon and a main icon, documentation etc. We just fill in the information that will be useful for building a suitable base for the tutorials. As the structure of the tutorial steps builds the next step on the previously created code, we can start with `MyWidget` as the project name. This will already build us the base class that is needed in chapter 4, so we don't have to care for that later. As we want to start with the first tutorial step, we will use '1' as the project number, which we can increase later when moving to the next step.

Then, fill in the other required information such as your name, email address and project directory. That would be all we need and we can flip to the next page. Insert your header for the project's header file here or use the given example. The same is done with the 4th page, where the same has to be set for the source files. Finally, the last page is entered, where you have to press "Create" to build the project. If the button is not available, start at the first page again and make sure you didn't miss to insert any required information.

If everything went OK, the project has been build and the messages window in the application wizard will have "READY" at it's last line. Select "Exit" to finish the wizard.

When looking at the treeview on the left, you will see that the project alreay includes a class "MyWidget"- this is because we chose this to be the application name. Further, when opening "Functions" in the classviewer's "Globals" folder, you will see that the application already contains a `main()` function where the execution will start.

Now the application is already set up. You could do an "Execute" or "Make", but as we want to create the tutorial applications, we can go ahead and change the code first to create our tutorial examples- which we'll do in the next step.

Next Previous Table of Contents