diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 449cdde92..3d0a98a5a 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -638,7 +638,10 @@ void DialogIncrements::SaveIncrFormula() void DialogIncrements::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); @@ -659,6 +662,9 @@ void DialogIncrements::DeployFormula() setUpdatesEnabled(false); repaint(); setUpdatesEnabled(true); + + ui->plainTextEditFormula->setFocus(); + ui->plainTextEditFormula->setTextCursor(cursor); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 1055d0cbe..682c5dc1e 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -535,7 +535,10 @@ bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &too void DialogTool::DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight) { SCASSERT(formula != nullptr); - SCASSERT(buttonGrowLength != nullptr) + SCASSERT(buttonGrowLength != nullptr); + + const QTextCursor cursor = formula->textCursor(); + if (formula->height() < DIALOG_MAX_FORMULA_HEIGHT) { formula->setFixedHeight(DIALOG_MAX_FORMULA_HEIGHT); @@ -556,6 +559,9 @@ void DialogTool::DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowL setUpdatesEnabled(false); repaint(); setUpdatesEnabled(true); + + formula->setFocus(); + formula->setTextCursor(cursor); } //---------------------------------------------------------------------------------------------------------------------