Commit 9f5bf5e8 authored by Georgiy Yankovskiy's avatar Georgiy Yankovskiy

RB/LB tabs switch

parent e6e8dcde
...@@ -147,6 +147,41 @@ Rectangle { ...@@ -147,6 +147,41 @@ Rectangle {
} }
} }
// LOGIC
property int focused: 0;
function applyFocus(inc){
if(!visible)
return;
let c = row.children;
tabs.focused += inc;
if(tabs.focused >= c.length)
tabs.focused = 0;
if(tabs.focused < 0)
tabs.focused = c.length - 1;
c[tabs.focused].forceActiveFocus();
c[tabs.focused].clicked();
/* if (c[i].focus) {
console.log("focus found");
c[i].nextItemInFocusChain().forceActiveFocus()
break
} */
}
Connections {
target: core_app
function onGamepadClickedLB(done){
tabs.applyFocus(1)
}
function onGamepadClickedRB(done){
tabs.applyFocus(-1)
}
}
} }
......
...@@ -19,10 +19,10 @@ Window { ...@@ -19,10 +19,10 @@ Window {
window.scene = SceneConstants.gameInfoScene; window.scene = SceneConstants.gameInfoScene;
} }
function onGamepadClickedLB(done){ function onGamepadClickedLB(done){
console.log("core_app: onGamepadClickedLB"); // console.log("core_app: onGamepadClickedLB");
} }
function onGamepadClickedRB(done){ function onGamepadClickedRB(done){
console.log("core_app: onGamepadClickedRB"); // console.log("core_app: onGamepadClickedRB");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment