/*** ** 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 height: column.height + 40 width: delegate.ListView.view.width Column { id: column x: 10; y: 10 width: parent.width - 20 Text { id: titleText text: title; width: column.width; wrapMode: Text.WordWrap font { bold: true; family: "Helvetica"; pointSize: 16 } } Row { id: descriptionRow spacing: 5 Image { id: detailImage source: (typeof image != "undefined") ? image: "" } Text { anchors.verticalCenter: descriptionRow.verticalCenter text: description; width: column.width - detailImage.width - 10; wrapMode: Text.WordWrap font.family: "Helvetica" } } } 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 }) } } } Rectangle { width: parent.width; height: 1; color: "#cccccc" anchors.bottom: parent.bottom } }