Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,6 +30,24 @@ WindowScriptingInterface* WindowScriptingInterface::getInstance() { · 29 unmodified lines | |||
| 30 | WindowScriptingInterface::WindowScriptingInterface() { | 30 | WindowScriptingInterface::WindowScriptingInterface() { |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | QScriptValue WindowScriptingInterface::hasFocus() { | ||
| 34 | return Application::getInstance()->getGLWidget()->hasFocus(); | ||
| 35 | } | ||
| 36 | |||
| 37 | void WindowScriptingInterface::setCursorPosition(int x, int y) { | ||
| 38 | QCursor::setPos(x, y); | ||
| 39 | } | ||
| 40 | |||
| 41 | QScriptValue WindowScriptingInterface::getCursorPositionX() { | ||
| 42 | QPoint pos = QCursor::pos(); | ||
| 43 | return pos.x(); | ||
| 44 | } | ||
| 45 | |||
| 46 | QScriptValue WindowScriptingInterface::getCursorPositionY() { | ||
| 47 | QPoint pos = QCursor::pos(); | ||
| 48 | return pos.y(); | ||
| 49 | } | ||
| 50 | |||
| 33 | QScriptValue WindowScriptingInterface::alert(const QString& message) { | 51 | QScriptValue WindowScriptingInterface::alert(const QString& message) { |
| 34 | QScriptValue retVal; | 52 | QScriptValue retVal; |
| 35 | QMetaObject::invokeMethod(this, "showAlert", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QScriptValue, retVal), Q_ARG(const QString&, message)); | 53 | QMetaObject::invokeMethod(this, "showAlert", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QScriptValue, retVal), Q_ARG(const QString&, message)); |