/** ---------------------------------------------------------------------------
* @brief display_gui::restore_cursor
* @param win Reference to a QTextEdit object
* @param cur_position The last known curser position
*/
void display_gui::restore_cursor (QTextEdit & win, int cur_position)
{
#ifdef DEBUG_CURSOR_RESTORE
fprintf (stderr,"..... b.NewPos %6d",win.textCursor().position());
#endif
//win.textCursor().setPosition(cur_position, QTextCursor::KeepAnchor); //QTextCursor::MoveAnchor);
//win.textCursor().movePosition(QTextCursor::End, QTextCursor::KeepAnchor); //QTextCursor::MoveAnchor);
// after many many hours .. this seem to be working !!!
// for some UNKNOWN REASON you cannot do this to the original, but you can copy it, change
// what you want , and write it back, then it works
QTextCursor my_cur = win.textCursor();
my_cur.setPosition(cur_position);
win.setTextCursor(my_cur);
#ifdef DEBUG_CURSOR_RESTORE
fprintf (stderr,"..... b.Restore %6d", cur_position);
#endif
}
Bookmarks