I think many of us would like to be able to stick images into Leo nodes.  
It's easy to insert one.  You get the text cursor for the insertion point, 
give it the image URL, and call insertImage().  The editor component will 
let you cut and paste the image without any other code being written.

For Leo nodes the main problem I see is how to restore the image when the 
outline is saved and re-opened.  To get a text representation of the 
editor's contents, one calls toPlainText() on the editor. There is no image 
encoded in the plain text, but Qt does insert a special marker character in 
place. This unicode character will not be used in any normal text.  On 
save, we can add the image url for a marker right after it, perhaps like 
this (using "x" to represent the marker):

x[[image1.png]]

When we want to reload the outline, we scan though the node, pick up these 
markers, and remove the URL string, get the cursor for that position, and 
use it to insert the image.

The parts of this scheme that I have tested so far are to insert an image 
and to observe the special marker character in the toPlainText() output. 
The other steps seem doable, but you never know for sure until you get into 
the details.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/4e7e79a2-e5fb-4bc0-86dc-bd3b004e2037n%40googlegroups.com.

Reply via email to