C

Qt Quick Ultralite image_loading Example

// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial

#include "image_loading.h"
#include "myimageloader.h"
#include <qul/application.h>
#include <platforminterface/log.h>

#include <sdkconfig.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_system.h>

static void qul_thread(void *task_data)
{
    (void) task_data;

    Qul::initHardware();
    Qul::initPlatform();

    MyImageProvider myImageProvider;
    Qul::Application app = {};
    app.addImageProvider("myimageprovider", &myImageProvider);
    static struct ::image_loading item;
    app.setRootItem(&item);
    app.exec();
}

extern "C" {
void app_start(void)
{
    xTaskCreate(qul_thread, "qul_thread", QUL_STACK_SIZE, NULL, QUL_FREERTOS_TASK_PRIORITY, NULL);

    // Allow higher priority Qul task to initialize fully to avoid synchronization issues
    taskYIELD();

    return;
}
}