mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 21:36:31 +02:00
fix tablet proxy choosing wrong root
This commit is contained in:
parent
89fa6601b9
commit
ce8dba21a0
1 changed files with 19 additions and 23 deletions
|
@ -410,40 +410,36 @@ void TabletProxy::loadQMLSource(const QVariant& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::pushOntoStack(const QVariant& path) {
|
void TabletProxy::pushOntoStack(const QVariant& path) {
|
||||||
if (_qmlTabletRoot) {
|
QObject* root = nullptr;
|
||||||
auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
|
root = _qmlTabletRoot;
|
||||||
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
|
root = _desktopWindow->asQuickItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root) {
|
||||||
|
auto stack = root->findChild<QQuickItem*>("stack");
|
||||||
if (stack) {
|
if (stack) {
|
||||||
QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
|
QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
|
||||||
} else {
|
} else {
|
||||||
loadQMLSource(path);
|
loadQMLSource(path);
|
||||||
}
|
}
|
||||||
} else if (_desktopWindow) {
|
|
||||||
auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
|
|
||||||
if (stack) {
|
|
||||||
QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
|
|
||||||
} else {
|
|
||||||
qCDebug(scriptengine) << "tablet cannot push QML because _desktopWindow doesn't have child stack";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
|
qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::popFromStack() {
|
void TabletProxy::popFromStack() {
|
||||||
if (_qmlTabletRoot) {
|
QObject* root = nullptr;
|
||||||
auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
|
if (!_toolbarMode && _qmlTabletRoot) {
|
||||||
if (stack) {
|
root = _qmlTabletRoot;
|
||||||
QMetaObject::invokeMethod(stack, "popSource");
|
} else if (_toolbarMode && _desktopWindow) {
|
||||||
} else {
|
root = _desktopWindow->asQuickItem();
|
||||||
qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack";
|
}
|
||||||
}
|
|
||||||
} else if (_desktopWindow) {
|
if (root) {
|
||||||
auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
|
auto stack = root->findChild<QQuickItem*>("stack");
|
||||||
if (stack) {
|
QMetaObject::invokeMethod(stack, "popSource");
|
||||||
QMetaObject::invokeMethod(stack, "popSource");
|
|
||||||
} else {
|
|
||||||
qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";
|
qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue