C

Qt Quick Ultralite Automotive Cluster Demo

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

pragma Singleton
import QtQuick 2.15

// Just a proxy for C++ code to provide additional APIs
QtObject {
    id: mathapi
    property bool benchmarkMode: false;

    function random() : real {
        if (benchmarkMode)
            return 0; //Disable randomization for benchmark
        return Math.random();
    }

    function sqrt(val: real) : real {
        return Math.sqrt(val);
    }
}