From 9f9144dd56d8f717b3dfaa209e7f510d2f38ede7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 6 Sep 2017 10:06:10 +0300 Subject: [PATCH] Fix bug with Variables Table. Editing values were almost impossible or very hard because of changing a cursor position. --HG-- branch : develop --- src/app/valentina/dialogs/dialogincrements.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 1d76488cc..83eb55922 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -963,12 +963,14 @@ void DialogIncrements::SaveIncrName(const QString &text) return; } - const QTableWidgetItem *nameField = table->item(row, 0); + QTableWidgetItem *nameField = table->item(row, 0); QString newName = text.isEmpty() ? GetCustomName() : CustomIncrSign + text; + bool updateFlag = not text.isEmpty(); if (not data->IsUnique(newName)) { + updateFlag = false; qint32 num = 2; QString name = newName; do @@ -986,7 +988,7 @@ void DialogIncrements::SaveIncrName(const QString &text) CacheRename(nameField->text(), newName); hasChanges = true; - LocalUpdateTree(); + updateFlag ? LocalUpdateTree() : nameField->setText(newName); table->blockSignals(true); table->selectRow(row); @@ -1020,11 +1022,12 @@ void DialogIncrements::SaveIncrDescription() return; } + const QTextCursor cursor = textEdit->textCursor(); + const QTableWidgetItem *nameField = table->item(row, 0); doc->SetIncrementDescription(nameField->text(), textEdit->toPlainText()); LocalUpdateTree(); - const QTextCursor cursor = textEdit->textCursor(); table->blockSignals(true); table->selectRow(row); table->blockSignals(false); @@ -1102,10 +1105,11 @@ void DialogIncrements::SaveIncrFormula() return; } + const QTextCursor cursor = textEdit->textCursor(); + hasChanges = true; LocalUpdateTree(); - const QTextCursor cursor = textEdit->textCursor(); table->blockSignals(true); table->selectRow(row); table->blockSignals(false);