Optimize ::ShowDialog method.

develop
Roman Telezhynskyi 2022-08-24 19:01:26 +03:00
parent 5262d8afb7
commit f9bc111159
9 changed files with 63 additions and 126 deletions

View File

@ -351,17 +351,6 @@ void DialogAlongLine::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -389,11 +378,15 @@ void DialogAlongLine::ShowDialog(bool click)
}
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -351,17 +351,6 @@ void DialogBisector::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -396,11 +385,15 @@ void DialogBisector::ShowDialog(bool click)
}
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -366,17 +366,6 @@ void DialogCutArc::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -397,9 +386,13 @@ void DialogCutArc::ShowDialog(bool click)
{
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
}
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}

View File

@ -366,17 +366,6 @@ void DialogCutSpline::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -397,9 +386,13 @@ void DialogCutSpline::ShowDialog(bool click)
{
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
}
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}

View File

@ -366,17 +366,6 @@ void DialogCutSplinePath::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -398,9 +387,13 @@ void DialogCutSplinePath::ShowDialog(bool click)
{
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
}
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}

View File

@ -429,17 +429,6 @@ void DialogNormal::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -468,9 +457,13 @@ void DialogNormal::ShowDialog(bool click)
}
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}

View File

@ -208,17 +208,6 @@ void DialogPointFromCircleAndTangent::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -236,11 +225,15 @@ void DialogPointFromCircleAndTangent::ShowDialog(bool click)
QLineF line = QLineF(static_cast<QPointF>(*center), scene->getScenePos());
SetCircleRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -189,17 +189,6 @@ void DialogPointOfContact::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -218,11 +207,15 @@ void DialogPointOfContact::ShowDialog(bool click)
QLineF line(static_cast<QPointF>(*center), scene->getScenePos());
SetRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -449,17 +449,6 @@ void DialogShoulderPoint::ShowDialog(bool click)
return;
}
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click)
{
// The check need to ignore first release of mouse button.
@ -476,9 +465,13 @@ void DialogShoulderPoint::ShowDialog(bool click)
const QSharedPointer<VPointF> p3 = data->GeometricObject<VPointF>(GetP3());
QLineF line(static_cast<QPointF>(*p3), scene->getScenePos());
SetFormula(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
FinishCreating();
}
FinishCreating();
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}