/*** ** Copyright (C) 2012 Christophe CHAPUIS ** ** This package is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This package is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this package; if not, write to the Free Software ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ** ***/ import QtQuick 1.0 Item { id: delegate width: delegate.ListView.view.width; height: 60 Text { text: name color: delegate.ListView.isCurrentItem ? "white" : "black" font { family: "Helvetica"; pixelSize: 16; bold: true } anchors { left: parent.left; leftMargin: 15 verticalCenter: parent.verticalCenter } } BusyIndicator { scale: 0.6 on: delegate.ListView.isCurrentItem && window.loading anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter } } Rectangle { width: delegate.width; height: 1; color: "#cccccc" anchors.bottom: delegate.bottom visible: delegate.ListView.isCurrentItem ? false : true } Rectangle { width: delegate.width; height: 1; color: "white" visible: delegate.ListView.isCurrentItem ? false : true } MouseArea { anchors.fill: delegate onClicked: { var currentSourceDepth = delegate.ListView.view.model.sourceDepth if (listSourceModel[window.currentSourceIndex].listViews.length >= currentSourceDepth+1) { // here we remove everything in viewsModel after index "nextSourceDepth" while(window.windowViewsModel.count>currentSourceDepth+1) window.windowViewsModel.remove(window.windowViewsModel.count-1) delegate.ListView.view.currentIndex = index var path = listSourceModel[window.currentSourceIndex].currentPath path[currentSourceDepth] = index listSourceModel[window.currentSourceIndex].currentPath = path.slice(0,currentSourceDepth+1) window.windowViewsModel.append({ component: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewComponent, componentDepth: currentSourceDepth+1 }) } } } }