Text annotations

FYI, Slicer now uses Qt-5.14.1, so markdown editing and display is available! It works very nicely.

For example, create a textbox:

t=qt.QTextEdit()
t.show()

Type some markdown text into it:

image

Then run this code to render it as markdown (you can also do some limited WYSIWYG editing, but the behavior is not so obvious, as not all formatting can be translated back to markdown; so I would disable editing):

t.setMarkdown(t.toPlainText())

image

Run this to switch back to plain text editing:

t.setPlainText(t.markdown)

We could add a Format attribute to text node, which could be set to plain text, html, or markdown. Editing would probably always happen in plain text mode, but when you finished editing then rich text could be displayed.

@joachim would you be interested in giving a try and implement this?

1 Like