diff --git a/src/contents/ui/NoteDelegate.qml b/src/contents/ui/NoteDelegate.qml index 1d04a35..1585caf 100644 --- a/src/contents/ui/NoteDelegate.qml +++ b/src/contents/ui/NoteDelegate.qml @@ -1,68 +1,64 @@ /* * SPDX-FileCopyrightText: (C) 2020 by Ismael Asensio * SPDX-License-Identifier: GPL-2.0-or-later */ import QtQuick 2.14 import QtQuick.Layouts 1.14 import QtQuick.Controls 2.14 as QQC2 import org.kde.kirigami 2.12 as Kirigami Kirigami.AbstractListItem { RowLayout { Kirigami.Icon { - source: model.decoration + source: decoration Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium } Loader { id: contentLoader Layout.fillWidth: true Layout.alignment: Qt.AlignTop sourceComponent: { - switch (model.type) { + switch (type) { case 255: return groupRenderer; case 3: return imageRenderer; default: return textRenderer; } } Component { id: groupRenderer - // ERROR: GroupRenderer is instantiated recursively - // GroupRenderer { - // model: root.model.childrenObjects - // } QQC2.Label { - text: model.display + text: display } } Component { id: textRenderer TextEdit { - text: model.display + text: display textFormat: TextEdit.RichText wrapMode: TextEdit.WordWrap } } Component { id: imageRenderer Image { - source: model.display + source: display fillMode: Image.PreserveAspectFit Layout.alignment: Qt.AlignTop } } } QQC2.ToolTip { visible: hovered - text: model.toolTip + text: toolTip } } } diff --git a/src/contents/ui/basket_scene.qml b/src/contents/ui/basket_scene.qml index 4dfb2f0..e4db292 100644 --- a/src/contents/ui/basket_scene.qml +++ b/src/contents/ui/basket_scene.qml @@ -1,50 +1,73 @@ /* * SPDX-FileCopyrightText: (C) 2020 by Ismael Asensio * SPDX-License-Identifier: GPL-2.0-or-later */ import QtQuick 2.14 import QtQuick.Layouts 1.14 import QtQuick.Controls 2.14 as QQC2 import QtQml.Models 2.14 import org.kde.kirigami 2.12 as Kirigami ColumnLayout { property var basketModel; RowLayout { Layout.fillWidth: true Layout.preferredHeight: implicitHeight Kirigami.Heading { Layout.fillWidth: true level: 3 text: "BasketQMLViewDraft" } Kirigami.Heading { level: 5 - text: "Columnns : " + columnSplitter.count + text: "Groups : " + groupRepeater.count Layout.alignment: Qt.AlignRight } } - QQC2.SplitView { + Loader { + id: groupLoader + property bool isFreeLayout: true + + sourceComponent: (isFreeLayout) ? freeBasketLayout : columnBasketLayout + + Component { + id: freeBasketLayout + Item {} + } + Component { + id: columnBasketLayout + QQC2.SplitView {} + } + Layout.fillWidth: true Layout.fillHeight: true - Repeater { - id: columnSplitter - model: basketModel - delegate: ListView { - model: DelegateModel { - id: groupModel - model: basketModel - rootIndex: groupModel.modelIndex(index) - delegate: NoteDelegate {} - } + } + + Repeater { + id: groupRepeater + model: basketModel + delegate: ListView { + parent: groupLoader.item + header: NoteDelegate { + backgroundColor: Kirigami.Theme.backgroundColor + } + model: DelegateModel { + id: groupModel + model: basketModel + rootIndex: groupModel.modelIndex(index) + delegate: NoteDelegate {} } + x: geometry.x + y: geometry.y + width: geometry.width + height: contentHeight + headerItem.height } } }