Just set default values and don't show dialog. User still can easy get access

to options.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-07-03 22:22:52 +03:00
parent 0d43f83b34
commit cc64b0627e
13 changed files with 44 additions and 41 deletions

View File

@ -188,15 +188,14 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
return; return;
} }
} }
this->setModal(true);
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis); VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
this->SetAngle(line->Angle());//Show in dialog angle what user choose this->SetAngle(line->Angle());//Show in dialog angle what user choose
emit ToolTip(""); emit ToolTip("");
timerFormula->start();
this->show(); DialogAccepted();// Just set default values and don't show dialog
} }
} }

View File

@ -201,8 +201,7 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
line->setLineP2Id(id); line->setLineP2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
} }

View File

@ -136,6 +136,12 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
prepare = true; prepare = true;
flagPoint = CheckIntersecion(); flagPoint = CheckIntersecion();
CheckState(); CheckState();
if (flagPoint)
{
DialogAccepted();
}
else
{
this->setModal(true); this->setModal(true);
this->show(); this->show();
connect(ui->comboBoxP1Line1, connect(ui->comboBoxP1Line1,
@ -153,6 +159,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
} }
} }
} }
}
break; break;
default: default:
break; break;

View File

@ -212,15 +212,14 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
return; return;
} }
} }
this->setModal(true);
VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis); VisToolLineIntersectAxis *line = qobject_cast<VisToolLineIntersectAxis *>(vis);
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
this->SetAngle(line->Angle());//Show in dialog angle what user choose this->SetAngle(line->Angle());//Show in dialog angle what user choose
emit ToolTip(""); emit ToolTip("");
timerFormula->start();
this->show(); DialogAccepted();// Just set default values and don't show dialog
} }
} }

View File

@ -155,8 +155,7 @@ void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &t
point->setArcId(id); point->setArcId(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
break; break;

View File

@ -60,7 +60,7 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
this, &DialogPointOfIntersection::PointNameChanged); this, &DialogPointOfIntersection::PointNameChanged);
vis = new VisToolPointOfIntersection(data); vis = new VisToolPointOfIntersection(data);
vis->VisualMode(NULL_ID); vis->VisualMode(NULL_ID);//Show vertical axis
FixateSize(); FixateSize();
} }
@ -119,8 +119,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
line->setPoint2Id(id); line->setPoint2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
break; break;

View File

@ -155,8 +155,7 @@ void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &
point->setArc2Id(id); point->setArc2Id(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
break; break;

View File

@ -241,8 +241,7 @@ void DialogPointOfIntersectionCircles::ChosenObject(quint32 id, const SceneObjec
point->setPoint2Id(id); point->setPoint2Id(id);
point->RefreshGeometry(); point->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
break; break;

View File

@ -340,8 +340,12 @@ inline void DialogTool::AddVisualization()
T *toolVis = qobject_cast<T *>(vis); T *toolVis = qobject_cast<T *>(vis);
SCASSERT(toolVis != nullptr); SCASSERT(toolVis != nullptr);
if (not scene->items().contains(toolVis))
{
connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor); connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor);
scene->addItem(toolVis); scene->addItem(toolVis);
}
toolVis->RefreshGeometry(); toolVis->RefreshGeometry();
} }
} }

View File

@ -144,8 +144,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
line->setHypotenuseP2Id(id); line->setHypotenuseP2Id(id);
line->RefreshGeometry(); line->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
} }

View File

@ -284,8 +284,7 @@ void DialogTrueDarts::ChosenObject(quint32 id, const SceneObject &type)
points->setD3PointId(id); points->setD3PointId(id);
points->RefreshGeometry(); points->RefreshGeometry();
prepare = true; prepare = true;
this->setModal(true); DialogAccepted();
this->show();
} }
} }
break; break;

View File

@ -66,13 +66,14 @@ void VisToolPointOfIntersection::RefreshGeometry()
if (point2Id <= NULL_ID) if (point2Id <= NULL_ID)
{ {
axisL2 = Axis(Visualization::scenePos, 180); axisL2 = Axis(Visualization::scenePos, 180);
ShowIntersection(axisL1, axisL2, supportColor);
} }
else else
{ {
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id); const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
DrawPoint(axisP2, second->toQPointF(), supportColor); DrawPoint(axisP2, second->toQPointF(), supportColor);
axisL2 = Axis(second->toQPointF(), 180); axisL2 = Axis(second->toQPointF(), 180);
ShowIntersection(axisL1, axisL2); ShowIntersection(axisL1, axisL2, mainColor);
} }
DrawLine(axis2, axisL2, supportColor, Qt::DashLine); DrawLine(axis2, axisL2, supportColor, Qt::DashLine);
} }
@ -85,14 +86,14 @@ void VisToolPointOfIntersection::setPoint2Id(const quint32 &value)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2) void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color)
{ {
QPointF p; QPointF p;
QLineF::IntersectType intersect = axis1.intersect(axis2, &p); QLineF::IntersectType intersect = axis1.intersect(axis2, &p);
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{ {
point->setVisible(true); point->setVisible(true);
DrawPoint(point, p, mainColor); DrawPoint(point, p, color);
} }
else else
{ {

View File

@ -51,7 +51,7 @@ private:
QGraphicsEllipseItem *axisP2; QGraphicsEllipseItem *axisP2;
QGraphicsLineItem *axis2;//axis1 is class themself QGraphicsLineItem *axis2;//axis1 is class themself
void ShowIntersection(const QLineF &axis1, const QLineF &axis2); void ShowIntersection(const QLineF &axis1, const QLineF &axis2, const QColor &color);
}; };
#endif // VISTOOLPOINTOFINTERSECTION_H #endif // VISTOOLPOINTOFINTERSECTION_H