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
410410 }
411411
412412 void TabletProxy::pushOntoStack(const QVariant& path) {
413− if (_qmlTabletRoot) {
414− auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
413+ QObject* root = nullptr;
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");
415422 if (stack) {
416423 QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path));
417424 } else {
418425 loadQMLSource(path);
419426 }
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− }
427427 } else {
428428 qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
429429 }
430430 }
431431
432432 void TabletProxy::popFromStack() {
433− if (_qmlTabletRoot) {
434− auto stack = _qmlTabletRoot->findChild<QQuickItem*>("stack");
435− if (stack) {
436− QMetaObject::invokeMethod(stack, "popSource");
437− } else {
438− qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack";
439− }
440− } else if (_desktopWindow) {
441− auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
442− if (stack) {
443− QMetaObject::invokeMethod(stack, "popSource");
444− } else {
445− qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
446− }
433+ QObject* root = nullptr;
434+ if (!_toolbarMode && _qmlTabletRoot) {
435+ root = _qmlTabletRoot;
436+ } else if (_toolbarMode && _desktopWindow) {
437+ root = _desktopWindow->asQuickItem();
438+ }
439+
440+ if (root) {
441+ auto stack = root->findChild<QQuickItem*>("stack");
442+ QMetaObject::invokeMethod(stack, "popSource");
447443 } else {
448444 qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null";
449445 }

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