Explorar el Código

Ensure cursor is restored back to original position after updating font

Christopher Mullins hace 13 años
padre
commit
dcf73c5552
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      Libs/Widgets/ctkConsole.cpp

+ 5 - 1
Libs/Widgets/ctkConsole.cpp

@@ -699,9 +699,13 @@ QFont ctkConsole::shellFont() const
 void ctkConsole::setShellFont(const QFont& font)
 {
   Q_D(ctkConsole);
+  int savedPosition = d->textCursor().position();
   d->selectAll();
   d->setCurrentFont(font);
-  d->moveCursor(d->textCursor().End); // Reset cursor to undo highlighting
+  QTextCursor tc = d->textCursor();
+  tc.clearSelection();
+  tc.setPosition(savedPosition);
+  d->setTextCursor(tc);
 }
 
 //-----------------------------------------------------------------------------