KDE Frameworks

Revision as of 07:12, 25 May 2019 by Jucato (Talk | contribs) (Added a quick start guide)

Jump to: navigation, search
Konqui frameworks cropped.png

The KDE Frameworks, currently version 5 or KF5, is a collection of 80 libraries that are built on top of the Qt application framework and provides everything from utility classes to asynchronous and network-transparent I/O to additional data model and widgets to desktop-centric integration. If Qt itself doesn't provide a certain functionality or feature, chances are, there's a KDE Framework for that.

While KF5 does serve as the most basic building blocks of KDE software, they can be used by any Qtx application just like any third-party Qt add-on library. Just like any other KDE software, KF5 uses and favors a CMake build system but all frameworks support QMake as well. Many frameworks are available on multiple desktop operating systems such as Linux and Windows and are even available on Android. Be sure to check each framework's documentation for their supported platforms.

Guarantees and License

KDE, of course, takes software quality seriously but even more so when it comes to KF5. The Frameworks come with quality promises and to make sure you won't need to wait for your favorite bug to get fixed, a new version is released monthly. And since it's free software developed in an open environment, anyone can participate or comment on its development.

The current version of KDE Frameworks is 5.58.0. Please see the release announcement for more information.

The KDE Frameworks are also released under the permissive LGPL or BSD/MIT licenses, making them ideal and usable for any type of software.


Each of the KDE Frameworks has a Tier and a Type, as you will see in the API documentation. While not critical to using the frameworks, this organization can help developers in determining the frameworks' dependencies.

Tiers group the frameworks according to what they link to during compilation.

  • Tier 1 Frameworks can depend only on Qt official frameworks or other system libraries;
  • Tier 2 Frameworks can depend only on Tier 1 Frameworks, Qt official frameworks, or other system libraries;
  • Tier 3 Frameworks can depend only on other Tier 3 Frameworks, Tier 2 Frameworks, Tier 1 Frameworks, Qt official frameworks, or other system libraries.

Types, on the other hand, refer to the framework's runtime dependencies:

  • Functional Frameworks cannot have runtime dependencies. KArchive, for example, can be used as-is as a drop-in library.
  • Integration Frameworks can have optional runtime dependencies and aim at integrating with the underlying OS/Platform. Solid needs other runtime components to deliver hardware information on different platforms.
  • Solutions have mandatory runtime dependencies to function. KIO, the KDE I/O framework, requires certain daemons to offer a network-transparent virtual filesystem.

Quick Start Guide

How easy is it to use KDE Frameworks 5? Just as easy as using any Qt widget or adding any C++ library to your project. You don't even have to switch away from QMake if that's your cup of tea. Here's one very quick and dirty example of how simple it is to use a framework.

The example below is written just for demonstration purposes and does not reflect proper coding practices or conventions. For more in-depth examples, please check our Tutorials section.

Step 1: Install the Framework you need

For this example, we'll be using the KDatePicker widget from the KWidgetsAddons framework. On KDE Neon/Ubuntu/Debian, it's as simple as:

sudo apt install libkf5widgetsaddons-dev

Adjust according to your Linux distro's packaging system, of course. If you want the latest version of the framework and it isn't available from your distro, you will have to get it from the source (Git or tarball) and build it yourself. Check out the KDE Community's handy guide to building KDE software from source.

Step 2: Add the Framework to your Project

Add the Framework's name, properly capitalized, in your QMake project file just like you would any other Qt module.

TARGET = kdatepicker-example

QT += core widgets KWidgetsAddons

SOURCES += main.cpp

If you're already using CMake as your build system of choice, you'll want to also grab the Extra CMake Modules made by the KDE community to provide modules and macros to make finding and linking to Frameworks so much easier.

Step 3: Use the Framework

KDatePicker, like many other widgets from KDE Frameworks, behave just like any Qt widget. As such, you can simply slot them in or use them in Qt projects with no problem at all. Here is a contrived example where selecting a date from the calendar widget displays its string representation on the label beside it.

#include <KDatePicker>

#include <QApplication>
#include <QLabel>
#include <QHBoxLayout>

int main(int argc, char* argv[])
    QApplication app(argc, argv);
    QWidget* window = new QWidget;

    QLabel* dateLabel = new QLabel(QDate::currentDate().toString());
    KDatePicker* datePicker = new KDatePicker;

    QObject::connect(datePicker, &KDatePicker::dateSelected, [=] (const QDate &dateSelected) { dateLabel->setText(dateSelected.toString()); });

    QHBoxLayout* layout = new QHBoxLayout;


    return app.exec();

Just build the project as normal and that's it! Welcome to the wonderful world of KDE-powered software!


You can find the API documentation of the Frameworks on api.kde.org.


Getting help

  1. Double-check the api
  2. Try to debug your application [with LINK to how to debug (on community?)]
  3. ask for help on #kde-devel or <mailinglist>
  4. Open a bug on <>

Content is available under Creative Commons License SA 4.0 unless otherwise noted.