C

Entry point to Qt Quick Ultralite application

Initializing Qt Quick Ultralite from main()

To start the graphical part of your application you need to call Qul::initPlatform(), create a Qul::Application object in your main() or a task function and then call the Qul::Application::exec() function.

Qul::initPlatform() initializes hardware for Qt Quick Ultralite and the event loop starts when you call Qul::Application::exec().

For example, if the main item defined in QML is called MainScreen, main.cpp on bare metal could contain the following:

#include "MainScreen.h"

#include <qul/application.h>
#include <qul/qul.h>

int main()
{
    Qul::initPlatform();
    Qul::Application app;
    static MainScreen item;
    app.setRootItem(&item);
    app.exec();
    return 0;
}

Or when using FreeRTOS main.cpp could be:

#include "MainScreen.h"

#include <qul/application.h>
#include <qul/qul.h>

#include <cstdio>
#include <FreeRTOS.h>
#include <task.h>

#ifndef QUL_STACK_SIZE
#error QUL_STACK_SIZE must be defined.
#endif

static void Qul_Thread(void *argument);

int main()
{
    Qul::initPlatform();

    if (xTaskCreate(Qul_Thread, "QulExec", QUL_STACK_SIZE, 0, 4, 0) != pdPASS) {
        std::printf("Task creation failed!.\r\n");
        configASSERT(false);
    }

    vTaskStartScheduler();

    // Should not reach this point
    configASSERT(false);
    return 0;
}

static void Qul_Thread(void *argument)
{
    Qul::Application app;
    static MainScreen item;
    app.setRootItem(&item);
    app.exec();
}

Available under certain Qt licenses.
Find out more.