|
This tutorial based on Richard J. Moore KDE tutorial.
Download the source files for this tutorial: examples.tar.gz.
-
Create the new project, with the name, for example 'edit':

-
Enter the name of target (edit) and set type of target to 'C++ executable':

-
Now, to import existing files from examples.tar.gz archive to this project, the best way - is to use 'Disk' folder.
As shown on screenshot below, select in directory tree the location of extracted sources from 'example3' directory.
Select (using Ctrl) the main.cpp and edit.cpp files. And Drag'n'Drop them (using mouse button 2) to target 'edit':

-
On drop, the next dialog will be appear. The files are copying (Project Specific button is on) to 'Sources' directory of current target (Destignation path). RCS versions would be created (Revision Control button).

-
Now, select edit.h and Drag'n'Drop it to 'edit' target.
The prevous dialog will be popped up again.
Checkin 'Add as include' button to add this file to special 'Includes' folder, and change the 'Destignation path' to '$(TARGET_DIR)/Includes'.

-
For this project we need special preprocessed by Qt Meta Object Compiler temporary source. It's name - edit.moc.
To create it - press button. Select the target 'Type' to 'Empty' and enter the name of newly created target: edit-dir/Includes/edit.moc.
So compound name is needed for two things:
- edit-dir - put this file to directory layout of target 'edit';
- Includes - put this file to includes directory - for good search it as include;

-
For this target (edit.moc) we need to create a dependency from 'edit.h'.
For this, move cursor in dependency tree to 'edit.moc' and press button.
Select in edit-dir/Includes file 'edit.h' and check out 'Project Specific' button - in order not to copy 'edit.h' to layout of 'edit.moc'.

-
Now, we need to setup Target actions for this target.
For this, move selection on this target and press ALT-T.
Enter the make action for this target, as shown on next image:

-
At this point the creation of dependency tree is over.
But to compile this target we need to add yet some information.
In Tools options (called by button):
- In GNU C Compiler / Preprocessor Option / Include Directory Search add the paths
to Qt and KDE includes (for example /usr/lib/qt/include and /opt/kde/include)
- In Link Editor / Linker Options / Library Directory Search add the paths
to X, Qt and KDE libraries (for example /usr/X11/lib, /usr/lib/qt/lib and /opt/kde/lib)
- In Link Editor / Linker Options / Used Libraries add the list of used
libraries (kdeui, kdecore, qt, Xext, X11)
- To find all dependences of sources from headers - select Actions -> Collect All Includes,
or press Ctrl-A
- For this project, we need the define EDIT_VERSION_STRING to be the string define.
Using the tools options you cannot do it (yes, this is a bug),
but using default convertions - can. So, press ALT-C, and select the .cpp.o convertion,
and change it as shown below:

-
At this point the project ready to compile.
For this, move selection to main target in project (edit) and press button.
The next error log would be popped up:

-
If you make all right, on double click you'll get simply editor:

-
Now, you of course want to add something to this editor. To make
some changes in sources or header you need to move one or all your
sources to Working Area:

-
You can edit all this files using Integrated Smart Editor (SMED):
|