Ignore Enter key in formula field.
--HG-- branch : develop
This commit is contained in:
parent
8158261dcc
commit
8a10d43778
|
@ -52,6 +52,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId,
|
|||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -57,6 +57,10 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
|
|||
this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
|
||||
this->formulaBaseHeightF2 = ui->plainTextEditF2->height();
|
||||
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
ui->plainTextEditF1->installEventFilter(this);
|
||||
ui->plainTextEditF2->installEventFilter(this);
|
||||
|
||||
timerRadius = new QTimer(this);
|
||||
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -48,6 +48,7 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -51,6 +51,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -50,6 +50,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -50,6 +50,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -38,6 +38,7 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const qui
|
|||
InitVariables(ui);
|
||||
InitFormulaUI(ui);
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancel(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -55,6 +55,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
|
|||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
this->formulaBaseHeightAngle = ui->plainTextEditAngle->height();
|
||||
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
ui->plainTextEditAngle->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
CheckState();
|
||||
|
|
|
@ -48,6 +48,7 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -48,6 +48,7 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -50,6 +50,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -52,6 +52,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &
|
|||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
flagFormula = false;
|
||||
|
|
|
@ -401,6 +401,27 @@ void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit)
|
|||
plainTextEdit->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogTool::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(object);
|
||||
if (plainTextEdit != nullptr)
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if ((keyEvent->key() == Qt::Key_Enter) || (keyEvent->key() == Qt::Key_Return))
|
||||
{
|
||||
// Ignore Enter key
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(object, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ValFormulaChanged handle change formula
|
||||
|
|
|
@ -334,6 +334,7 @@ protected:
|
|||
*/
|
||||
virtual void SaveData(){}
|
||||
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
private:
|
||||
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user