Edward K. Ream a écrit :
Setting the insertion point programmatically does not appear to "take"
until (approximately) the point at which a textChanged() signal is
generated. The relevant code (simplified just a bit) is:
def setInsertPoint(self,i):
w = self.widget
g.trace(i,w)
w.t
QQQ
As you can see, w does not report the new insertion point immediately:
getInsertPoint: 0
setInsertPoint: 48
getInsertPoint: 0 # Oops.
QQQ
Mystery solved. w.textCursor returns a copy of the cursor, so instead of::
w.textCursor().setPosition(i)
the following will work::
cursor