mirror of
https://github.com/overte-org/overte.git
synced 2025-06-18 21:41:20 +02:00
hide desktop windows when switching into HMD mode
This commit is contained in:
parent
a1ce9481bb
commit
09ced24710
4 changed files with 20 additions and 0 deletions
|
@ -323,6 +323,16 @@ FocusScope {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideDesktopWindows() {
|
||||||
|
for (var index = 0; index < desktop.visibleChildren.length; index++) {
|
||||||
|
var child = desktop.visibleChildren[index];
|
||||||
|
if (child.topLevelWindow && child.hasOwnProperty("modality")) {
|
||||||
|
console.log(child);
|
||||||
|
child.setShown(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setPinned(newPinned) {
|
function setPinned(newPinned) {
|
||||||
pinned = newPinned
|
pinned = newPinned
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,13 @@ void OffscreenUi::show(const QUrl& url, const QString& name, std::function<void(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffscreenUi::hideDesktopWindows() {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
BLOCKING_INVOKE_METHOD(this, "hideDesktopWindows");
|
||||||
|
}
|
||||||
|
QMetaObject::invokeMethod(_desktop, "hideDesktopWindows");
|
||||||
|
}
|
||||||
|
|
||||||
void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f) {
|
||||||
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
void createDesktop(const QUrl& url);
|
void createDesktop(const QUrl& url);
|
||||||
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
void hide(const QString& name);
|
void hide(const QString& name);
|
||||||
|
void hideDesktopWindows();
|
||||||
bool isVisible(const QString& name);
|
bool isVisible(const QString& name);
|
||||||
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
bool shouldSwallowShortcut(QEvent* event);
|
bool shouldSwallowShortcut(QEvent* event);
|
||||||
|
|
|
@ -387,6 +387,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
||||||
offscreenUi->hide("RunningScripts");
|
offscreenUi->hide("RunningScripts");
|
||||||
_showRunningScripts = true;
|
_showRunningScripts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offscreenUi->hideDesktopWindows();
|
||||||
// destroy desktop window
|
// destroy desktop window
|
||||||
if (_desktopWindow) {
|
if (_desktopWindow) {
|
||||||
_desktopWindow->deleteLater();
|
_desktopWindow->deleteLater();
|
||||||
|
|
Loading…
Reference in a new issue