preserve text cursor when writing fields

This commit is contained in:
Damien Elmes 2009-01-21 01:48:22 +09:00
parent a652a0979d
commit 8d3220ad3d

View file

@ -304,9 +304,11 @@ class FactEditor(object):
self.widgets[w] = field
new = self.fact[field.name]
old = tidyHTML(unicode(w.toHtml()))
# only update if something has changed, to preserve the cursor
# only update if something has changed
if new != old:
cur = w.textCursor()
w.setHtml('<meta name="qrichtext" content="1"/>' + new)
w.setTextCursor(cur)
if font:
# apply fonts
font = QFont()