From 6833c46a9522be3c55cefe79676293a0a571cbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 19 Oct 2016 14:28:08 +0200 Subject: use treemodel in qml --- components/mailviewer/qml/MailViewer.qml | 52 ++++++++++++-------------------- 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'components/mailviewer/qml/MailViewer.qml') diff --git a/components/mailviewer/qml/MailViewer.qml b/components/mailviewer/qml/MailViewer.qml index f5714e25..86a96913 100644 --- a/components/mailviewer/qml/MailViewer.qml +++ b/components/mailviewer/qml/MailViewer.qml @@ -19,42 +19,28 @@ import QtQuick 2.4 Item { - id: mailviewer - height: mainColumn.height + 50 + id: root + property alias rootIndex: visualModel.rootIndex + property bool debug: true + height: partListView.height + 50 width: parent.width * 0.9 - Column { - id: mainColumn - anchors { - top: parent.top - left: parent.left - right: parent.right - margins: 20 - } - spacing: 10 - width: parent.width - 50 - - Repeater { - model: messageParser.newTree - - delegate: Column { - id: delegateRoot - - width: mainColumn.width - - Loader { - id: loader - } + MailDataModel { + id: visualModel + debug: root.debug + model: messageParser.newTree + } - Component.onCompleted: { - switch (model.type) { - case "AlternativePart": - case "SinglePart": - loader.source = "MailPart.qml"; - break; - } - } - } + ListView { + id: partListView + model: visualModel + anchors { + top: parent.top + left: parent.left + margins: 5 } + spacing: 5 + height: contentHeight + width: parent.width - 10 } } -- cgit v1.2.3