Skip to content

Commit

Permalink
ControllerScriptEngineBase: install console extension
Browse files Browse the repository at this point in the history
This allows new scripts to use console.* functions which for example
enables easier debugging using Qt's debugging and logging tools.
See https://doc.qt.io/qt-5/qtquick-debugging.html#console-api for more information
on the console extension api.
  • Loading branch information
Swiftb0y committed Aug 5, 2021
1 parent ac4cacd commit 0d90636
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/controllers/scripting/controllerscriptenginebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bool ControllerScriptEngineBase::initialize() {
// Create the Script Engine
m_pJSEngine = std::make_shared<QJSEngine>(this);

m_pJSEngine->installExtensions(QJSEngine::ConsoleExtension);

QJSValue engineGlobalObject = m_pJSEngine->globalObject();

QJSValue mapper = m_pJSEngine->newQMetaObject(
Expand Down
1 change: 0 additions & 1 deletion src/controllers/scripting/controllerscriptmoduleengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ ControllerScriptModuleEngine::~ControllerScriptModuleEngine() {

bool ControllerScriptModuleEngine::initialize() {
ControllerScriptEngineBase::initialize();
m_pJSEngine->installExtensions(QJSEngine::ConsoleExtension);
// TODO: Add new ControlObject JS API to scripting environment.

QJSValue mod =
Expand Down

0 comments on commit 0d90636

Please sign in to comment.