• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. The KDE Frameworks
  3. KDeclarative
  • KDE Home
  • Contact Us

Quick Links

Skip menu "KDeclarative"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Dependencies
  • Related Pages

Class Picker

About

Provides integration of QML and KDE Frameworks

Maintainer
Marco Martin
Supported platforms
FreeBSD, Linux, MacOSX, Windows
Community
IRC: #kde-devel on Freenode
Mailing list: kde-frameworks-devel
Use with CMake
find_package(KF5Declarative)
target_link_libraries(yourapp KF5::Declarative)
Use with QMake
QT += KDeclarative 
Clone
git clone git://anongit.kde.org/kdeclarative.git
Browse source
KDeclarative on cgit.kde.org

KDeclarative

KDeclarative

Integration of QML and KDE work spaces

Introduction

KDeclarative provides integration of QML and KDE work spaces. It's comprises two parts: a library used by the C++ part of your application to intergrate QML with KDE Frameworks specific features, and a series of QML imports that offer bindings to some of the Frameworks.

KDeclarative library

KDeclarative exposes 3 namespaced classes: KDeclarative::KDeclarative, KDeclarative::QmlObject, KDeclarative::ConfigPropertyMap

KDeclarative::KDeclarative

The KDeclarative class is used to manipulate the QQmlEngine instance used by the application and to get some informations about the platform, that influences the behavior of the QML components.

In order to use it, create an instance of KDeclarative. You will need a pointer to a QQmlEngine, and call both setDeclarativeEngine(engine) and setupContext() on your instance. You need to call setupEngine(engine) at least once on the engine as well.

KDeclarative::setupEngine(engine);  // if not done elsewhere
KDeclarative::KDeclarative decl;
decl.setDeclarativeEngine(engine);
decl.setupContext();

This will add the following things to the engine:

  • Use a KIOAccessManagerFactory instead of the stock QQmlNetworkAccessManagerFactory
  • Add a QML icon provider, that makes possible for the Image {} element to load images using the scheme "image:/"
  • Use the given engine for this context.
  • Set a new rootContextObject() that exposes all the i18n() functions from the KI18n framework. They will be available in the global QML context: just call i18n() from anywhere in your QML code.

KDeclarative::QmlObject

KDeclarative::ConfigPropertyMap

This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 01:54:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal