Pārlūkot izejas kodu

Merge branch 'add-set-get-shellfont-to-ctkconsole'

* add-set-get-shellfont-to-ctkconsole:
  Ensure cursor is restored back to original position after updating font
  Remove unused private member from ctkConsole
Jean-Christophe Fillion-Robin 13 gadi atpakaļ
vecāks
revīzija
cfe3637457
2 mainītis faili ar 5 papildinājumiem un 4 dzēšanām
  1. 5 1
      Libs/Widgets/ctkConsole.cpp
  2. 0 3
      Libs/Widgets/ctkConsole_p.h

+ 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);
 }
 
 //-----------------------------------------------------------------------------

+ 0 - 3
Libs/Widgets/ctkConsole_p.h

@@ -163,9 +163,6 @@ public:
   /// Secondary prompt
   QString Ps2;
 
-  /// Font of all text in shell
-  QFont ShellFont;
-
   ctkConsole::EditorHints EditorHints;
 
   bool ScrollbarAtBottom;