mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 10:55:41 +02:00
expose to scripts the ability to show dedicated qml windows such as
preferences
This commit is contained in:
parent
2a099d5577
commit
347b20e506
2 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,8 @@
|
|||
#include "Application.h"
|
||||
#include "MainWindow.h"
|
||||
#include <display-plugins/CompositorHelper.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <OffscreenUi.h>
|
||||
|
||||
int DesktopScriptingInterface::getWidth() {
|
||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
|
@ -31,3 +33,11 @@ void DesktopScriptingInterface::setOverlayAlpha(float alpha) {
|
|||
qApp->getApplicationCompositor().setAlpha(alpha);
|
||||
}
|
||||
|
||||
void DesktopScriptingInterface::show(const QString& path, const QString& title) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection, Q_ARG(QString, path), Q_ARG(QString, title));
|
||||
return;
|
||||
}
|
||||
DependencyManager::get<OffscreenUi>()->show(path, title);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class DesktopScriptingInterface : public QObject, public Dependency {
|
|||
|
||||
public:
|
||||
Q_INVOKABLE void setOverlayAlpha(float alpha);
|
||||
Q_INVOKABLE void show(const QString& path, const QString& title);
|
||||
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
|
|
Loading…
Reference in a new issue