mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #10239 from druiz17/edit-model
Fix issue of tablet proxy not choose the correct root
This commit is contained in:
commit
57f6529ce6
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) {
|
||||
if (_qmlTabletRoot) {
|
||||
auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
|
||||
QObject* root = nullptr;
|
||||
if (!_toolbarMode && _qmlTabletRoot) {
|
||||
root = _qmlTabletRoot;
|
||||
} else if (_toolbarMode && _desktopWindow) {
|
||||
root = _desktopWindow->asQuickItem();
|
||||
}
|
||||
|
||||
if (root) {
|
||||
auto stack = root->findChild<QQuickItem*>("stack");
|
||||
if (stack) {
|
||||
QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
|
||||
} else {
|
||||
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 {
|
||||
qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
|
||||
}
|
||||
}
|
||||
|
||||
void TabletProxy::popFromStack() {
|
||||
if (_qmlTabletRoot) {
|
||||
auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
|
||||
if (stack) {
|
||||
QMetaObject::invokeMethod(stack, "popSource");
|
||||
} else {
|
||||
qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack";
|
||||
}
|
||||
} else if (_desktopWindow) {
|
||||
auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
|
||||
if (stack) {
|
||||
QMetaObject::invokeMethod(stack, "popSource");
|
||||
} else {
|
||||
qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
|
||||
}
|
||||
QObject* root = nullptr;
|
||||
if (!_toolbarMode && _qmlTabletRoot) {
|
||||
root = _qmlTabletRoot;
|
||||
} else if (_toolbarMode && _desktopWindow) {
|
||||
root = _desktopWindow->asQuickItem();
|
||||
}
|
||||
|
||||
if (root) {
|
||||
auto stack = root->findChild<QQuickItem*>("stack");
|
||||
QMetaObject::invokeMethod(stack, "popSource");
|
||||
} else {
|
||||
qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue