Index: sources/gui/qml/components/StackItem.qml =================================================================== diff -u -r3702984c4572607055ab3ede4d45792e74595991 -r821bf955d0ba7e028bccfee7c04ca77cf80a0bd4 --- sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision 3702984c4572607055ab3ede4d45792e74595991) +++ sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision 821bf955d0ba7e028bccfee7c04ca77cf80a0bd4) @@ -27,13 +27,17 @@ Item { id : _root property alias stackView: _stackView + visible: false + width : Variables.applicationWidth height: Variables.applicationHeight /*! * \brief prints out the list of the items in the stack by their index position in the stack. */ - function info() { + function info(vInfo) { + console.debug('-----') + if ( vInfo !== undefined ) console.debug(vInfo) for( var i = 0; i < _stackView.depth; i++ ) { console.debug("index:", i, _stackView.get(i)) } @@ -44,8 +48,15 @@ * \brief page function gets the screen vScreen and tries to find the screen in the stack. * if the page found will pop the items on stack down to that screen. * otherwise adds that screen on top of the stack + * \param vScreen - The screen to navigate to + * \param vCondition - if the vCondition has been passed and is false then page returns immediately + * \param vInfo - some extra information to be shown in the info function if the screen name is the same + * */ - function page(vScreen) { + function page(vScreen, vCondition, vInfo) { + if ( vScreen === undefined || vScreen === null ) return + if ( vCondition !== undefined && vCondition === false ) return + if (stackView.find(function(screen) { return screen === vScreen; })) { @@ -54,7 +65,7 @@ else { _stackView.push(vScreen) } - info() + info(vInfo) } /*! @@ -94,6 +105,15 @@ info() } + /*! + * \brief reset the stack to the bottom and only the first item will remain. + */ + function reset() { + stackView.clear() + stackView.push(stackView.initialItem) + info() + } + StackView { id : _stackView initialItem : null anchors.fill: parent