History

Fixes to problems with meta-types

ksuprynowicz committed 4 years ago

Commit 50a6a631 parent 33c86078 files · +43 −15Browse files

Showing the changes to interface/src/scripting/PerformanceScriptingInterface.cpp (1 of 8 files). Show all

Unified · Split

interface/src/scripting/PerformanceScriptingInterface.cpp+12−2
@@ -1,6 +1,7 @@
11 //
22 // Created by Bradley Austin Davis on 2019/05/14
33 // Copyright 2013-2019 High Fidelity, Inc.
4+// Copyright 2022 Overte e.V.
45 //
56 // Distributed under the Apache License, Version 2.0.
67 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -9,15 +10,24 @@ · 2 unmodified lines
910
1011 #include "PerformanceScriptingInterface.h"
1112
13+#include <ScriptEngineCast.h>
14+
1215 #include "../Application.h"
1316
17+STATIC_SCRIPT_INITIALIZER(+[](ScriptManager* manager){
18+ auto scriptEngine = manager->engine().get();
19+
20+ scriptRegisterMetaType(scriptEngine, scriptValueFromEnumClass<PerformanceScriptingInterface::PerformancePreset>, scriptValueToEnumClass<PerformanceScriptingInterface::PerformancePreset>, "PerformancePreset");
21+ scriptRegisterMetaType(scriptEngine, scriptValueFromEnumClass<PerformanceScriptingInterface::RefreshRateProfile>, scriptValueToEnumClass<PerformanceScriptingInterface::RefreshRateProfile>, "RefreshRateProfile");
22+});
23+
1424 std::once_flag PerformanceScriptingInterface::registry_flag;
1525
1626 PerformanceScriptingInterface::PerformanceScriptingInterface() {
1727 std::call_once(registry_flag, [] {
1828 qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "PerformanceEnums");
19− qRegisterMetaType<PerformanceScriptingInterface::PerformancePreset>("PerformanceScriptingInterface::PerformancePreset");
20− qRegisterMetaType<PerformanceScriptingInterface::RefreshRateProfile>("PerformanceScriptingInterface::RefreshRateProfile");
29+ //qRegisterMetaType<PerformanceScriptingInterface::PerformancePreset>("PerformanceScriptingInterface::PerformancePreset");
30+ //qRegisterMetaType<PerformanceScriptingInterface::RefreshRateProfile>("PerformanceScriptingInterface::RefreshRateProfile");
2131 });
2232 }
2333