mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 09:25:12 +02:00
Add exstra functionality to script Window interface
This commit is contained in:
parent
87358002bd
commit
23a760dfcf
2 changed files with 22 additions and 0 deletions
|
@ -30,6 +30,24 @@ WindowScriptingInterface* WindowScriptingInterface::getInstance() {
|
|||
WindowScriptingInterface::WindowScriptingInterface() {
|
||||
}
|
||||
|
||||
QScriptValue WindowScriptingInterface::hasFocus() {
|
||||
return Application::getInstance()->getGLWidget()->hasFocus();
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::setCursorPosition(int x, int y) {
|
||||
QCursor::setPos(x, y);
|
||||
}
|
||||
|
||||
QScriptValue WindowScriptingInterface::getCursorPositionX() {
|
||||
QPoint pos = QCursor::pos();
|
||||
return pos.x();
|
||||
}
|
||||
|
||||
QScriptValue WindowScriptingInterface::getCursorPositionY() {
|
||||
QPoint pos = QCursor::pos();
|
||||
return pos.y();
|
||||
}
|
||||
|
||||
QScriptValue WindowScriptingInterface::alert(const QString& message) {
|
||||
QScriptValue retVal;
|
||||
QMetaObject::invokeMethod(this, "showAlert", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QScriptValue, retVal), Q_ARG(const QString&, message));
|
||||
|
|
|
@ -26,6 +26,10 @@ public:
|
|||
int getInnerHeight();
|
||||
|
||||
public slots:
|
||||
QScriptValue getCursorPositionX();
|
||||
QScriptValue getCursorPositionY();
|
||||
void setCursorPosition(int x, int y);
|
||||
QScriptValue hasFocus();
|
||||
QScriptValue alert(const QString& message = "");
|
||||
QScriptValue confirm(const QString& message = "");
|
||||
QScriptValue form(const QString& title, QScriptValue array);
|
||||
|
|
Loading…
Reference in a new issue