History

first pass creating Qt <-> QtScript interface

Heather Anderson committed 4 years ago

Commit bc6eaf21 parent bd0455463 files · +1707 −294Browse files

Showing the changes to libraries/script-engine/src/ScriptContext.cpp (1 of 63 files). Show all

Unified · Split

libraries/script-engine/src/ScriptContext.cpp+23−0
@@ -0,0 +1,23 @@
1+//
2+// ScriptContext.h
3+// libraries/script-engine/src
4+//
5+// Created by Heather Anderson on 12/5/21.
6+// Copyright 2021 Vircadia contributors.
7+//
8+// Distributed under the Apache License, Version 2.0.
9+// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10+//
11+
12+#include "ScriptContext.h"
13+
14+#include "Scriptable.h"
15+
16+ScriptContextGuard::ScriptContextGuard(ScriptContext* context) {
17+ _oldContext = Scriptable::context();
18+ Scriptable::setContext(context);
19+}
20+
21+ScriptContextGuard::~ScriptContextGuard() {
22+ Scriptable::setContext(_oldContext);
23+}