History

fix tablet proxy choosing wrong root

Dante Ruiz committed 9 years ago

Commit ce8dba21 parent 89fa6601 file · +19 −23Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+19−23
@@ -410,40 +410,36 @@ void TabletProxy::loadQMLSource(const QVariant& path) { · 409 unmodified lines
410}410}
411 411
412void TabletProxy::pushOntoStack(const QVariant& path) {412void TabletProxy::pushOntoStack(const QVariant& path) {
413 if (_qmlTabletRoot) {413 QObject* root = nullptr;
414 auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");414 if (!_toolbarMode && _qmlTabletRoot) {
415 root = _qmlTabletRoot;
416 } else if (_toolbarMode && _desktopWindow) {
417 root = _desktopWindow->asQuickItem();
418 }
419
420 if (root) {
421 auto stack = root->findChild<QQuickItem*>("stack");
415 if (stack) {422 if (stack) {
416 QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));423 QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
417 } else {424 } else {
418 loadQMLSource(path);425 loadQMLSource(path);
419 }426 }
420 } else if (_desktopWindow) {
421 auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
422 if (stack) {
423 QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
424 } else {
425 qCDebug(scriptengine) << "tablet cannot push QML because _desktopWindow doesn't have child stack";
426 }
427 } else {427 } else {
428 qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";428 qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
429 }429 }
430}430}
431 431
432void TabletProxy::popFromStack() {432void TabletProxy::popFromStack() {
433 if (_qmlTabletRoot) {433 QObject* root = nullptr;
434 auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");434 if (!_toolbarMode && _qmlTabletRoot) {
435 if (stack) {435 root = _qmlTabletRoot;
436 QMetaObject::invokeMethod(stack, "popSource");436 } else if (_toolbarMode && _desktopWindow) {
437 } else {437 root = _desktopWindow->asQuickItem();
438 qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack";438 }
439 }439
440 } else if (_desktopWindow) {440 if (root) {
441 auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");441 auto stack = root->findChild<QQuickItem*>("stack");
442 if (stack) {442 QMetaObject::invokeMethod(stack, "popSource");
443 QMetaObject::invokeMethod(stack, "popSource");
444 } else {
445 qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
446 }
447 } else {443 } else {
448 qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";444 qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";
449 }445 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t