[Kde-pim] How to reference to kde api in qt creator

Martin Klapetek martin.klapetek at gmail.com
Tue Nov 6 20:41:15 GMT 2012


Hey,

On Tue, Nov 6, 2012 at 9:28 PM, Michaƫl Parchet <mparchet at sunrise.ch> wrote:

> Hello,
>
> I would like to use some existing kdepim windows in my program such as
> kadressbook main wiget (main window) and contact editor window. I have
> downloaded the source code from the master git directory  I have put the
> kdepim directory in my qt creator project directory.
>

When you want to use functions of other libraries, you need to compile the
library and install into your system. You can of course compile the library
only locally as well and then use it from your "local" folder, but that
requires passing special arguments to cmake/qmake, so it's just easier for
you to install system-wide if you don't mind having self-compiled libs in
your system folders. Having just the source present in your project
directory won't help.


> When I try to include and compile, I get this error
>
>  'KXmlGuiWindow' file not found
>
> I found this documentation.
>
> http://www.purinchu.net/kdelibs-apidocs/kdeui/html/classKXmlGuiWindow.html


This is a part of kdelibs, so you need kdelibs compiled and installed too.
Then you just do

#include <kxmlguiwindow.h>

in your source code as the doc says and then you need to link against the
proper library, which is ${KDE4_KDEUI_LIBS} for CMake, but I don't know
what variable you need to use for QMake (when using qt creator), that might
need some googling :)


> How can I use the kde api in qt-creator ?
>

Using the api is just a matter of having the libraries and their header
files installed in a path, that can be reached by the compiler. Then it's
simple #include <...> and Qt Creator should give you full autocompletition
of KDE api. You also need to add the proper libs (the compiled ones) into
your project, so the linker knows what libraries to link together.


> I develop with a mac with mac os 10.8.2. I have macport that contain a kde
> version.
>

I'm not familiar with developing on mac, so hopefully someone else will
give you more specific info if my response won't be enough :)

Cheers
-- 
Martin Klapetek | KDE Developer
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list