New option Interactive tools.

develop
Roman Telezhynskyi 2022-11-17 16:42:03 +02:00
parent 64bfafb1d3
commit 6ec85f3bdf
39 changed files with 351 additions and 142 deletions

View File

@ -9,6 +9,7 @@
- [smart-pattern/valentina#184] Fix incorrect seam allowance. - [smart-pattern/valentina#184] Fix incorrect seam allowance.
- Export area of piece in Final measurements. - Export area of piece in Final measurements.
- New option Show accuracy radius. - New option Show accuracy radius.
- New option Interactive tools.
# Valentina 0.7.52 September 12, 2022 # Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru. - Fix crash when default locale is ru.

View File

@ -123,6 +123,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode()); ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP()); ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
ui->checkBoxInteractiveTools->setChecked(settings->IsInteractiveTools());
//----------------------- Toolbar //----------------------- Toolbar
ui->toolBarStyleCheck->setChecked(settings->GetToolBarStyle()); ui->toolBarStyleCheck->setChecked(settings->GetToolBarStyle());
@ -202,6 +203,7 @@ auto PreferencesConfigurationPage::Apply() -> QStringList
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked()); settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked()); settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
settings->SetInteractiveTools(ui->checkBoxInteractiveTools->isChecked());
if (m_langChanged || m_systemChanged) if (m_langChanged || m_systemChanged)
{ {

View File

@ -33,9 +33,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-27</y> <y>0</y>
<width>624</width> <width>624</width>
<height>838</height> <height>867</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -235,6 +235,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxInteractiveTools">
<property name="toolTip">
<string>Disable if you want to skip interactive part of creating tools. And go straight to editing formulas instead.</string>
</property>
<property name="text">
<string>Interactive tools</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -91,6 +91,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayout
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationInteractiveTools, (QLatin1String("configuration/interactiveTools"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, (QLatin1String("configuration/dontUseNativeDialog"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, (QLatin1String("configuration/dontUseNativeDialog"))) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) // NOLINT
@ -670,6 +671,18 @@ void VCommonSettings::SetDoubleClickZoomFitBestCurrentPP(bool value)
setValue(*settingConfigurationDoubleClickZoomFitBestCurrentPP, value); setValue(*settingConfigurationDoubleClickZoomFitBestCurrentPP, value);
} }
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsInteractiveTools() const
{
return value(*settingConfigurationInteractiveTools, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetInteractiveTools(bool value)
{
setValue(*settingConfigurationInteractiveTools, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCommonSettings::GetUndoCount() const -> int auto VCommonSettings::GetUndoCount() const -> int
{ {

View File

@ -125,6 +125,9 @@ public:
auto IsDoubleClickZoomFitBestCurrentPP() const -> bool; auto IsDoubleClickZoomFitBestCurrentPP() const -> bool;
void SetDoubleClickZoomFitBestCurrentPP(bool value); void SetDoubleClickZoomFitBestCurrentPP(bool value);
auto IsInteractiveTools() const -> bool;
void SetInteractiveTools(bool value);
auto GetUndoCount() const -> int; auto GetUndoCount() const -> int;
void SetUndoCount(const int &value); void SetUndoCount(const int &value);

View File

@ -292,10 +292,9 @@ void DialogAlongLine::ChosenSecondPoint(quint32 id, const QString &toolTip)
prepare = true; prepare = true;
if (m_buildMidpoint) if (m_buildMidpoint || not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{ {
setModal(true); FinishCreating();
show();
} }
} }
else else
@ -305,6 +304,16 @@ void DialogAlongLine::ChosenSecondPoint(quint32 id, const QString &toolTip)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief SetSecondPointId set id second point of line * @brief SetSecondPointId set id second point of line
@ -380,13 +389,7 @@ void DialogAlongLine::ShowDialog(bool click)
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit()))); SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -124,6 +124,8 @@ private:
void SetCurrentLength(); void SetCurrentLength();
void ChosenSecondPoint(quint32 id, const QString &toolTip); void ChosenSecondPoint(quint32 id, const QString &toolTip);
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -257,17 +257,6 @@ void DialogArc::ShowDialog(bool click)
auto *arcVis = qobject_cast<VisToolArc *>(vis); auto *arcVis = qobject_cast<VisToolArc *>(vis);
SCASSERT(arcVis != nullptr) SCASSERT(arcVis != nullptr)
auto FinishCreating = [this, arcVis]()
{
arcVis->SetMode(Mode::Show);
arcVis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click) if (click)
{ {
// The check need to ignore first release of mouse button. // The check need to ignore first release of mouse button.
@ -400,6 +389,11 @@ void DialogArc::ChosenObject(quint32 id, const SceneObject &type)
} }
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -551,6 +545,18 @@ void DialogArc::EvalF()
m_angleF2 = Eval(formulaData, m_flagF2); m_angleF2 = Eval(formulaData, m_flagF2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetCenter return id of center point * @brief GetCenter return id of center point

View File

@ -157,6 +157,8 @@ private:
void EvalRadius(); void EvalRadius();
void EvalF(); void EvalF();
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -284,17 +284,6 @@ void DialogArcWithLength::ShowDialog(bool click)
{ {
if (prepare) if (prepare)
{ {
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click) if (click)
{ {
// The check need to ignore first release of mouse button. // The check need to ignore first release of mouse button.
@ -384,6 +373,11 @@ void DialogArcWithLength::ChosenObject(quint32 id, const SceneObject &type)
} }
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -544,3 +538,15 @@ void DialogArcWithLength::EvalF()
Eval(formulaData, m_flagF1); Eval(formulaData, m_flagF1);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}

View File

@ -150,6 +150,8 @@ private:
void Radius(); void Radius();
void Length(); void Length();
void EvalF(); void EvalF();
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -387,13 +387,7 @@ void DialogBisector::ShowDialog(bool click)
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit()))); SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -443,10 +437,25 @@ void DialogBisector::ChosenThirdPoint(quint32 id)
line->SetPoint3Id(id); line->SetPoint3Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogBisector::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetTypeLine return type of line * @brief GetTypeLine return type of line

View File

@ -122,6 +122,8 @@ private:
qint32 m_number{0}; qint32 m_number{0};
void ChosenThirdPoint(quint32 id); void ChosenThirdPoint(quint32 id);
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -225,8 +225,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
} }
/*We will ignore click if poinet is in point circle*/ /*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId()); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
@ -238,12 +237,11 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
} }
} }
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis); auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr) SCASSERT(line != nullptr)
SetAngle(line->Angle());//Show in dialog angle what user choose
this->SetAngle(line->Angle());//Show in dialog angle what user choose
emit ToolTip(QString()); emit ToolTip(QString());
DialogAccepted();// Just set default values and don't show dialog DialogAccepted();// Just set default values and don't show dialog
} }
} }
@ -253,7 +251,7 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (prepare == false)// After first choose we ignore all objects if (prepare == false)// After first choose we ignore all objects
{ {
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis); auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr) SCASSERT(line != nullptr)
switch (number) switch (number)
@ -284,6 +282,14 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
line->setAxisPointId(id); line->setAxisPointId(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
emit ToolTip(QString());
setModal(true);
show();
}
} }
} }
break; break;

View File

@ -177,6 +177,11 @@ void DialogCutArc::ChosenObject(quint32 id, const SceneObject &type)
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow()); auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -250,6 +255,16 @@ void DialogCutArc::ValidateAlias()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutArc::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setArcId set id of arc * @brief setArcId set id of arc
@ -388,11 +403,5 @@ void DialogCutArc::ShowDialog(bool click)
} }
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }

View File

@ -116,6 +116,8 @@ private:
QString m_originAliasSuffix2{}; QString m_originAliasSuffix2{};
bool m_firstRelease{false}; bool m_firstRelease{false};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -185,6 +185,11 @@ void DialogCutSpline::ChosenObject(quint32 id, const SceneObject &type)
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow()); auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -258,6 +263,16 @@ void DialogCutSpline::ValidateAlias()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogCutSpline::DeployFormulaTextEdit() void DialogCutSpline::DeployFormulaTextEdit()
{ {
@ -388,11 +403,5 @@ void DialogCutSpline::ShowDialog(bool click)
} }
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }

View File

@ -116,6 +116,8 @@ private:
QString m_originAliasSuffix2{}; QString m_originAliasSuffix2{};
bool m_firstRelease{false}; bool m_firstRelease{false};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -185,6 +185,11 @@ void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow()); auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -258,6 +263,16 @@ void DialogCutSplinePath::ValidateAlias()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogCutSplinePath::DeployFormulaTextEdit() void DialogCutSplinePath::DeployFormulaTextEdit()
{ {
@ -389,11 +404,5 @@ void DialogCutSplinePath::ShowDialog(bool click)
} }
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }

View File

@ -115,6 +115,8 @@ private:
QString m_originAliasSuffix2{}; QString m_originAliasSuffix2{};
bool m_firstRelease{false}; bool m_firstRelease{false};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -442,6 +442,18 @@ void DialogEllipticalArc::EvalAngles()
m_angleRotation = Eval(formulaData, m_flagRotationAngle); m_angleRotation = Eval(formulaData, m_flagRotationAngle);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXRadius1() void DialogEllipticalArc::FXRadius1()
{ {
@ -633,13 +645,7 @@ void DialogEllipticalArc::ShowDialog(bool click)
SetRotationAngle(QString::number(Angle() - path->StartingRotationAngle())); SetRotationAngle(QString::number(Angle() - path->StartingRotationAngle()));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -671,6 +677,11 @@ void DialogEllipticalArc::ChosenObject(quint32 id, const SceneObject &type)
vis->VisualMode(id); vis->VisualMode(id);
} }
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }

View File

@ -186,6 +186,8 @@ private:
void EvalRadiuses(); void EvalRadiuses();
void EvalAngles(); void EvalAngles();
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -221,6 +221,11 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -353,16 +358,12 @@ void DialogEndLine::ShowDialog(bool click)
return; return;
} }
} }
this->setModal(true);
auto *line = qobject_cast<VisToolEndLine *>(vis); auto *line = qobject_cast<VisToolEndLine *>(vis);
SCASSERT(line != nullptr) SCASSERT(line != nullptr)
SetAngle(line->Angle());//Show in dialog angle what user choose
SetFormula(line->Length());
this->SetAngle(line->Angle());//Show in dialog angle what user choose FinishCreating();
this->SetFormula(line->Length());
emit ToolTip(QString());
timerFormulaLength->start();
this->show();
} }
} }
@ -397,6 +398,15 @@ void DialogEndLine::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogEndLine::FinishCreating()
{
setModal(true);
emit ToolTip(QString());
timerFormulaLength->start();
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogEndLine::~DialogEndLine() DialogEndLine::~DialogEndLine()
{ {

View File

@ -121,6 +121,8 @@ private:
bool flagFormula; bool flagFormula;
bool flagError; bool flagError;
bool flagName; bool flagName;
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -249,8 +249,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
} }
/*We will ignore click if poinet is in point circle*/ /*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId()); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos()); QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
@ -262,12 +261,12 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
} }
} }
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis); auto *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr) SCASSERT(line != nullptr)
SetAngle(line->Angle());//Show in dialog angle what user choose
this->SetAngle(line->Angle());//Show in dialog angle what user choose line->SetMode(Mode::Show);
emit ToolTip(QString()); emit ToolTip(QString());
DialogAccepted();// Just set default values and don't show dialog DialogAccepted();// Just set default values and don't show dialog
} }
} }
@ -279,7 +278,7 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
if (type == SceneObject::Point) if (type == SceneObject::Point)
{ {
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis); auto *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr) SCASSERT(line != nullptr)
switch (number) switch (number)
@ -289,8 +288,8 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{ {
number++; number++;
line->VisualMode(id); line->VisualMode(id);
VAbstractMainWindow *window = auto *window =
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow()); qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
@ -320,6 +319,13 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
line->SetAxisPointId(id); line->SetAxisPointId(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
vis->SetMode(Mode::Show);
emit ToolTip(QString());
show();
}
} }
} }
} }

View File

@ -225,6 +225,11 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
VAbstractValApplication::VApp()->getMainWindow()); VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
connect(line, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(line, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
break; break;
@ -259,6 +264,16 @@ void DialogNormal::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief SetSecondPointId set id of second point * @brief SetSecondPointId set id of second point
@ -459,11 +474,5 @@ void DialogNormal::ShowDialog(bool click)
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit()))); SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }

View File

@ -122,6 +122,8 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 m_number{0}; qint32 m_number{0};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -227,13 +227,7 @@ void DialogPointFromCircleAndTangent::ShowDialog(bool click)
SetCircleRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); SetCircleRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -272,6 +266,11 @@ void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject
point->SetCenterId(id); point->SetCenterId(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
break; break;
@ -371,6 +370,18 @@ void DialogPointFromCircleAndTangent::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointFromCircleAndTangent::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPointFromCircleAndTangent::SetNotes(const QString &notes) void DialogPointFromCircleAndTangent::SetNotes(const QString &notes)
{ {

View File

@ -103,6 +103,8 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 m_number{0}; qint32 m_number{0};
bool m_firstRelease{false}; bool m_firstRelease{false};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -209,13 +209,7 @@ void DialogPointOfContact::ShowDialog(bool click)
SetRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); SetRadius(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -278,6 +272,11 @@ void DialogPointOfContact::ChosenObject(quint32 id, const SceneObject &type)
line->SetRadiusId(id); line->SetRadiusId(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
@ -310,6 +309,18 @@ void DialogPointOfContact::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfContact::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief SetSecondPoint set id second point * @brief SetSecondPoint set id second point

View File

@ -114,6 +114,8 @@ private:
qint32 m_number{0}; qint32 m_number{0};
bool m_firstRelease{false}; bool m_firstRelease{false};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -252,17 +252,6 @@ void DialogPointOfIntersectionCircles::ShowDialog(bool click)
return; return;
} }
auto FinishCreating = [this]()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
};
if (click) if (click)
{ {
// The check need to ignore first release of mouse button. // The check need to ignore first release of mouse button.
@ -323,13 +312,21 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
case 0: case 0:
if (SetObject(id, ui->comboBoxCircle1Center, QString())) if (SetObject(id, ui->comboBoxCircle1Center, QString()))
{ {
++m_stage;
point->VisualMode(id); point->VisualMode(id);
auto *window = qobject_cast<VAbstractMainWindow *>( if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
VAbstractValApplication::VApp()->getMainWindow()); {
SCASSERT(window != nullptr) m_stage = 2;
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip); emit ToolTip(tr("Select second circle center"));
}
else
{
++m_stage;
auto *window = qobject_cast<VAbstractMainWindow *>(
VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
} }
break; break;
case 2: case 2:
@ -341,6 +338,12 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
point->RefreshGeometry(); point->RefreshGeometry();
++m_stage; ++m_stage;
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
return;
}
} }
} }
break; break;
@ -485,6 +488,18 @@ void DialogPointOfIntersectionCircles::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::SetNotes(const QString &notes) void DialogPointOfIntersectionCircles::SetNotes(const QString &notes)
{ {

View File

@ -122,6 +122,8 @@ private:
/** @brief number number of handled objects */ /** @brief number number of handled objects */
qint32 m_stage{0}; qint32 m_stage{0};
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -277,10 +277,25 @@ void DialogShoulderPoint::ChosenThirdPoint(quint32 id)
line->SetLineP2Id(id); line->SetLineP2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
if (not VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{
FinishCreating();
}
} }
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogShoulderPoint::FinishCreating()
{
vis->SetMode(Mode::Show);
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setPShoulder set id shoulder point * @brief setPShoulder set id shoulder point
@ -467,11 +482,5 @@ void DialogShoulderPoint::ShowDialog(bool click)
SetFormula(QString::number(FromPixel(line.length(), *data->GetPatternUnit()))); SetFormula(QString::number(FromPixel(line.length(), *data->GetPatternUnit())));
} }
vis->SetMode(Mode::Show); FinishCreating();
vis->RefreshGeometry();
emit ToolTip(QString());
setModal(true);
show();
} }

View File

@ -121,6 +121,8 @@ private:
qint32 m_number{0}; qint32 m_number{0};
void ChosenThirdPoint(quint32 id); void ChosenThirdPoint(quint32 id);
void FinishCreating();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -83,15 +83,21 @@ void VisToolLineIntersectAxis::RefreshGeometry()
{ {
QLineF axis; QLineF axis;
const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_axisPointId); const QSharedPointer<VPointF> third = GetData()->GeometricObject<VPointF>(m_axisPointId);
DrawPoint(m_basePoint, static_cast<QPointF>(*third), Color(VColor::MainColor));
if (VFuzzyComparePossibleNulls(m_angle, -1)) if (VFuzzyComparePossibleNulls(m_angle, -1))
{ {
if (GetMode() == Mode::Show)
{
return;
}
axis = Axis(static_cast<QPointF>(*third), ScenePos()); axis = Axis(static_cast<QPointF>(*third), ScenePos());
} }
else else
{ {
axis = Axis(static_cast<QPointF>(*third), m_angle); axis = Axis(static_cast<QPointF>(*third), m_angle);
} }
DrawPoint(m_basePoint, static_cast<QPointF>(*third), Color(VColor::MainColor));
DrawLine(m_axisLine, axis, Color(VColor::SupportColor), Qt::DashLine); DrawLine(m_axisLine, axis, Color(VColor::SupportColor), Qt::DashLine);
QPointF p; QPointF p;
@ -105,10 +111,13 @@ void VisToolLineIntersectAxis::RefreshGeometry()
DrawPoint(m_point, p, Color(VColor::MainColor)); DrawPoint(m_point, p, Color(VColor::MainColor));
ShowIntersection(axis_line, base_line); ShowIntersection(axis_line, base_line);
SetToolTip(tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - " if (GetMode() == Mode::Creation)
"sticking angle, <b>%3</b> - finish creation") {
.arg(AngleToUser(this->line().angle()), VModifierKey::Shift(), SetToolTip(tr("<b>Intersection line and axis</b>: angle = %1°; <b>%2</b> - "
VModifierKey::EnterKey())); "sticking angle, <b>%3</b> - finish creation")
.arg(AngleToUser(this->line().angle()), VModifierKey::Shift(),
VModifierKey::EnterKey()));
}
} }
} }
} }

View File

@ -50,7 +50,8 @@ VisToolPointOfContact::VisToolPointOfContact(const VContainer *data, QGraphicsIt
m_arcPoint = InitPoint(Color(VColor::SupportColor), this); m_arcPoint = InitPoint(Color(VColor::SupportColor), this);
m_lineP1 = InitPoint(Color(VColor::SupportColor), this); m_lineP1 = InitPoint(Color(VColor::SupportColor), this);
m_lineP2 = InitPoint(Color(VColor::SupportColor), this); m_lineP2 = InitPoint(Color(VColor::SupportColor), this);
m_circle = InitItem<QGraphicsEllipseItem>(Color(VColor::SupportColor), this); m_circle = InitItem<VScaledEllipse>(Color(VColor::SupportColor), this);
m_circle->SetPointMode(false);
m_point = InitPoint(Color(VColor::MainColor), this); m_point = InitPoint(Color(VColor::MainColor), this);
} }

View File

@ -66,7 +66,7 @@ private:
VScaledEllipse *m_lineP1{nullptr}; VScaledEllipse *m_lineP1{nullptr};
VScaledEllipse *m_lineP2{nullptr}; VScaledEllipse *m_lineP2{nullptr};
VScaledEllipse *m_arcPoint{nullptr}; VScaledEllipse *m_arcPoint{nullptr};
QGraphicsEllipseItem *m_circle{nullptr}; VScaledEllipse *m_circle{nullptr};
qreal m_radius{0}; qreal m_radius{0};
}; };

View File

@ -113,7 +113,7 @@ void VisToolPointOfIntersectionCircles::RefreshGeometry()
} }
} }
} }
else if (GetMode() == Mode::Creation) else if (GetMode() == Mode::Creation && VAbstractValApplication::VApp()->Settings()->IsInteractiveTools())
{ {
QLineF radiusLine (static_cast<QPointF>(*first), ScenePos()); QLineF radiusLine (static_cast<QPointF>(*first), ScenePos());
const qreal length = radiusLine.length(); const qreal length = radiusLine.length();