From 61178e64de48c873adbe1559071d14664920ed0c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 5 Oct 2015 16:52:18 +0300 Subject: [PATCH] Remember cursor position and return focus to the formula field. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 80865e2ce..01bda193f 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -1129,7 +1129,10 @@ void TMainWindow::ShowMData() void TMainWindow::DeployFormula() { SCASSERT(ui->plainTextEditFormula != nullptr); - SCASSERT(ui->pushButtonGrow != nullptr) + SCASSERT(ui->pushButtonGrow != nullptr); + + const QTextCursor cursor = ui->plainTextEditFormula->textCursor(); + if (ui->plainTextEditFormula->height() < DIALOG_MAX_FORMULA_HEIGHT) { ui->plainTextEditFormula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT); @@ -1150,6 +1153,9 @@ void TMainWindow::DeployFormula() setUpdatesEnabled(false); repaint(); setUpdatesEnabled(true); + + ui->plainTextEditFormula->setFocus(); + ui->plainTextEditFormula->setTextCursor(cursor); } //---------------------------------------------------------------------------------------------------------------------