harbour-sextant/qml/components/OrgDelegate.qml
Renaud Casenave-Péré 52ef89147c WIP
2025-07-20 21:27:03 +09:00

55 lines
1.3 KiB
QML

import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
id: orgItem
property bool focused: document.focusedIndex == index
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.paddingMedium * depth
}
height: loader.item ? loader.item.height : 0
Loader {
id: loader
anchors.fill: parent
property string type: nodeType
onTypeChanged: {
var url
if (type == "org-line")
url = "OrgLine.qml"
else if (type == "org-headline")
url = "OrgHeadline.qml"
setSource(url)
}
}
GlassItem {
id: eof
visible: isLastItem
anchors.top: orgItem.bottom
height: Theme.paddingLarge
width: parent.width
falloffRadius: 0.15
radius: 0.15
color: palette.highlightColor
cache: true
}
onFocusedChanged: {
if (focused)
document.focusedItem = orgItem
}
function forceCommit (update) { loader.item.forceCommit(update) }
function setCursorPosition(index) { loader.item.setCursorPosition(index) }
function setCursorPositionAtEnd (fix) { loader.item.setCursorPositionAtEnd(fix) }
function editRawText () { loader.item.editRawText() }
}