Importing and Including

Last updated 4 months ago

Step 1 - Add to project sources

MauiKit supports qmake and cmake

Importing - Statically linking

To statically add MauiKit to your project using qmake, you need to clone the MauiKit repository inside you project's root folder, and then the project's [project-name].pro should look like this :

[project-name].pro
linux:unix:!android { message(Building for Linux )
} else:android {
message(Building for Android)
include($$PWD/3rdparty/kirigami/kirigami.pri)
} else {
message(“Unknown configuration”)
}
include($$PWD/mauikit/mauikit.pri)

This will include MauiKit as a sub-module. It is recommended to only do this to deploy your project to other systems besides GNU Linux, like Android, Mac OS X, WIndows, etc...

MauiKit works on top of Kirigami and so it depends on it. If you plan to deploy your app on a device running Android you will also need to add the Kirigami submodule.

MauiKit's mauikit.pri file creates a useful definition named STATIC_MAUIKIT, you can make use of this definition in your project source code to differentiate when deploying to different systems.

Including - Framework

For GNU Linux the best way to make use of MauiKit is to install it system wide.

After building and installing MauiKit you can now include it in your project to start making use of it.

To include MauiKit with cmake:

find_package(MauiKit REQUIRED)

To use it with qmake you need to include the MauiKit shared library into your project .pro file:

LIBS += -lMauiKit

You can skip to the third step if you installed MauiKit system wide.

Step 2 - Include MauiKit Header File

This step is only necessary if you are statically linking MauiKit into your project.

Include the MauiKit header file as follows :

#include “mauikit.h”

Then, register MauiKit Components :

MauiKit::getInstance().registerTypes();

Step 3 - Import MauiKit QML Controls

On your QML files you now can import the Maui Kit controls as follows :

import org.kde.mauikit 1.0 as Maui

You’re ready to start creating your next convergent application using MauiKit