Get Started with the Qt Interface Framework Generator

This topic explains how to get started with the Qt Interface Framework Generator. The generator can generate source code from an Interface Definition Language (IDL) file. The kind of code to generate is determined by the template that you select.

The Qt Interface Framework Generator is located in the libexec/ifcodegen folder of your Qt installation. If it is not available, make sure that your configuration meets all of the prerequisites listed in the qmake configuration summary. For more details on how to configure Qt Interface Framework, see Configuration.

Basics

The generator takes an IDL file as input to generate its source code. The code snippet below shows a minimal IDL file:

module my.idl 1.0

interface MyInterface {
    property int value;
    void increment();
    signal valueIncremented(int newValue);
}

The IDL defines a new module or namespace, my.idl, in version 1.0. Inside, there is an interface called MyInterface, providing a property that stores a value and a function to increment and notify the user. Refer to the QFace IDL syntax for complete documentation on the IDL.

Using the previously defined IDL file, the frontend template can generate a library providing an implementation of MyInterface. The generated class uses the Dynamic Backend System provided by Qt Interface Framework for an abstraction of frontend and backend code.

The implementation for the class behavior is done inside a backend plugin. A basic backend plugin can be generated by using the backend simulator template. For more information on how Qt locates and loads its plugins, see How to Create Qt Plugins.

In-Depth Walkthrough

For an in-depth walkthrough, see the Qt Interface Framework Generator Tutorial, which contains step by step instructions on how to use the Qt Interface Framework module to generate a Middlware API based on a QML application.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.