Make org links in headline titles clickable
Headline titles were rendered as plain text, so an inline org link in a heading showed its raw [[target][desc]] syntax and could not be followed. Body text and list items already route links through renderInline and onLinkActivated; apply the same treatment to the title Label. The title now renders as StyledText via renderInline, exposes a pointer cursor over links through a HoverHandler, and dispatches clicks to openLink (which resolves and navigates via the model). Non-link text keeps its done-aware color and strike-through.
This commit is contained in:
parent
c6bb21800a
commit
cc2b341754
|
|
@ -361,14 +361,24 @@ ListView {
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
// Title. Rendered as StyledText so inline org links in the
|
||||||
|
// headline are clickable; non-link text keeps the done-aware
|
||||||
|
// color and strike-through.
|
||||||
Label {
|
Label {
|
||||||
text: del.model.title ?? ""
|
text: outline.renderInline(del.model.title ?? "")
|
||||||
color: (del.model.isDone ?? false) ? theme.placeholderTextColor : theme.textColor
|
color: (del.model.isDone ?? false) ? theme.placeholderTextColor : theme.textColor
|
||||||
|
linkColor: theme.linkColor
|
||||||
font.pointSize: outline.levelFontSize(del.sectionLevel)
|
font.pointSize: outline.levelFontSize(del.sectionLevel)
|
||||||
font.strikeout: del.model.isDone ?? false
|
font.strikeout: del.model.isDone ?? false
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
onLinkActivated: (link) => outline.openLink(link)
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
enabled: parent.hoveredLink !== ""
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scheduled timestamp
|
// Scheduled timestamp
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue