From 90207bd92682219b89e477809b8e07b33c7d1e76 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 14 Oct 2013 19:18:08 +0300 Subject: [PATCH] Insert value of variable after cursor in line edit. --HG-- branch : develop --- container/vcontainer.cpp | 2 ++ dialogs/dialogtool.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 9d89dd1b6..f5ef78bc7 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -217,6 +217,8 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{ } } break; + case(Tool::SplineTool): + break;//Nothing to do, just ignore. default: qWarning()<<"Get wrong tool type. Ignore."<currentItem(); - QString val = item->text(); - lineEdit->setText(lineEdit->text().append(val)); + int pos = lineEdit->cursorPosition(); + lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); lineEdit->setFocus(); + lineEdit->setCursorPosition(pos + item->text().size()); } void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){ @@ -328,9 +329,12 @@ void DialogTool::PutHere(){ void DialogTool::PutVal(QListWidgetItem *item){ Q_ASSERT(lineEditFormula != 0); - QString val = item->text(); - lineEditFormula->setText(lineEditFormula->text().append(val)); + Q_ASSERT(item != 0); + int pos = lineEditFormula->cursorPosition(); + lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(), + item->text())); lineEditFormula->setFocus(); + lineEditFormula->setCursorPosition(pos + item->text().size()); } void DialogTool::ValChenged(int row){