From d1d58eceab9c8f97fa43cd0e7ee2ffe3e01846d7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 27 Mar 2018 13:04:50 +1300 Subject: [PATCH] Add Window.raise() as replacement for Window.raiseMainWindow() --- interface/src/scripting/WindowScriptingInterface.cpp | 6 +++++- interface/src/scripting/WindowScriptingInterface.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 78f55f0d6e..58ec744f4e 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -78,13 +78,17 @@ void WindowScriptingInterface::setFocus() { }); } -void WindowScriptingInterface::raiseMainWindow() { +void WindowScriptingInterface::raise() { // It's forbidden to call raise() from another thread. qApp->postLambdaEvent([] { qApp->raise(); }); } +void WindowScriptingInterface::raiseMainWindow() { + raise(); +} + /// Display an alert box /// \param const QString& message message to display /// \return QScriptValue::UndefinedValue diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 997e425e53..e3b092d011 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -68,9 +68,16 @@ public slots: */ void setFocus(); + /**jsdoc + * Raise the Interface window if it is minimized. If raised, the window gains focus. + * @function Window.raise + */ + void raise(); + /**jsdoc * Raise the Interface window if it is minimized. If raised, the window gains focus. * @function Window.raiseMainWindow + * @deprecated Use {@link Window.raise|raise} instead. */ void raiseMainWindow();