Undo selection of last object if was selected twice.
--HG-- branch : feature
This commit is contained in:
parent
0a11ec59fb
commit
c2da41bbf0
|
@ -127,26 +127,36 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
switch (type)
|
if (id != GetLastId())
|
||||||
{
|
{
|
||||||
case SceneObject::Arc:
|
switch (type)
|
||||||
NewItem(VPieceNode(id, Tool::NodeArc, reverse));
|
{
|
||||||
break;
|
case SceneObject::Arc:
|
||||||
case SceneObject::Point:
|
NewItem(VPieceNode(id, Tool::NodeArc, reverse));
|
||||||
NewItem(VPieceNode(id, Tool::NodePoint));
|
break;
|
||||||
break;
|
case SceneObject::Point:
|
||||||
case SceneObject::Spline:
|
NewItem(VPieceNode(id, Tool::NodePoint));
|
||||||
NewItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
break;
|
||||||
break;
|
case SceneObject::Spline:
|
||||||
case SceneObject::SplinePath:
|
NewItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
||||||
NewItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
break;
|
||||||
break;
|
case SceneObject::SplinePath:
|
||||||
case (SceneObject::Line):
|
NewItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
||||||
case (SceneObject::Detail):
|
break;
|
||||||
case (SceneObject::Unknown):
|
case (SceneObject::Line):
|
||||||
default:
|
case (SceneObject::Detail):
|
||||||
qDebug() << "Got wrong scene object. Ignore.";
|
case (SceneObject::Unknown):
|
||||||
break;
|
default:
|
||||||
|
qDebug() << "Got wrong scene object. Ignore.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ui->listWidget->count() > 1)
|
||||||
|
{
|
||||||
|
delete GetItemById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidObjects(PathIsValid());
|
ValidObjects(PathIsValid());
|
||||||
|
@ -163,7 +173,14 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
emit ToolTip(tr("Select main path objects, <b>Shift</b> - reverse direction curve, "
|
emit ToolTip(tr("Select main path objects, <b>Shift</b> - reverse direction curve, "
|
||||||
"<b>Enter</b> - finish creation"));
|
"<b>Enter</b> - finish creation"));
|
||||||
|
|
||||||
visPath->VisualMode(NULL_ID);
|
if (not qApp->getCurrentScene()->items().contains(visPath))
|
||||||
|
{
|
||||||
|
visPath->VisualMode(NULL_ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
visPath->RefreshGeometry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -545,6 +562,22 @@ QListWidgetItem *DialogPiecePath::GetItemById(quint32 id)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogPiecePath::GetLastId() const
|
||||||
|
{
|
||||||
|
const int count = ui->listWidget->count();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->listWidget->item(count-1);
|
||||||
|
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
|
return node.GetId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::SetCurrentSABefore(qreal value)
|
void DialogPiecePath::SetCurrentSABefore(qreal value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,6 +99,8 @@ private:
|
||||||
|
|
||||||
QListWidgetItem *GetItemById(quint32 id);
|
QListWidgetItem *GetItemById(quint32 id);
|
||||||
|
|
||||||
|
quint32 GetLastId() const;
|
||||||
|
|
||||||
void SetCurrentSABefore(qreal value);
|
void SetCurrentSABefore(qreal value);
|
||||||
void SetCurrentSAAfter(qreal value);
|
void SetCurrentSAAfter(qreal value);
|
||||||
};
|
};
|
||||||
|
|
|
@ -202,26 +202,36 @@ void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
reverse = true;
|
reverse = true;
|
||||||
}
|
}
|
||||||
switch (type)
|
if (id != GetLastId())
|
||||||
{
|
{
|
||||||
case SceneObject::Arc:
|
switch (type)
|
||||||
NewMainPathItem(VPieceNode(id, Tool::NodeArc, reverse));
|
{
|
||||||
break;
|
case SceneObject::Arc:
|
||||||
case SceneObject::Point:
|
NewMainPathItem(VPieceNode(id, Tool::NodeArc, reverse));
|
||||||
NewMainPathItem(VPieceNode(id, Tool::NodePoint));
|
break;
|
||||||
break;
|
case SceneObject::Point:
|
||||||
case SceneObject::Spline:
|
NewMainPathItem(VPieceNode(id, Tool::NodePoint));
|
||||||
NewMainPathItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
break;
|
||||||
break;
|
case SceneObject::Spline:
|
||||||
case SceneObject::SplinePath:
|
NewMainPathItem(VPieceNode(id, Tool::NodeSpline, reverse));
|
||||||
NewMainPathItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
break;
|
||||||
break;
|
case SceneObject::SplinePath:
|
||||||
case (SceneObject::Line):
|
NewMainPathItem(VPieceNode(id, Tool::NodeSplinePath, reverse));
|
||||||
case (SceneObject::Detail):
|
break;
|
||||||
case (SceneObject::Unknown):
|
case (SceneObject::Line):
|
||||||
default:
|
case (SceneObject::Detail):
|
||||||
qDebug() << "Got wrong scene object. Ignore.";
|
case (SceneObject::Unknown):
|
||||||
break;
|
default:
|
||||||
|
qDebug() << "Got wrong scene object. Ignore.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ui->listWidgetMainPath->count() > 1)
|
||||||
|
{
|
||||||
|
delete GetItemById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
|
@ -238,7 +248,14 @@ void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
emit ToolTip(tr("Select main path objects clockwise, <b>Shift</b> - reverse direction curve, "
|
emit ToolTip(tr("Select main path objects clockwise, <b>Shift</b> - reverse direction curve, "
|
||||||
"<b>Enter</b> - finish creation"));
|
"<b>Enter</b> - finish creation"));
|
||||||
|
|
||||||
visPath->VisualMode(NULL_ID);
|
if (not qApp->getCurrentScene()->items().contains(visPath))
|
||||||
|
{
|
||||||
|
visPath->VisualMode(NULL_ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
visPath->RefreshGeometry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -925,6 +942,22 @@ QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogSeamAllowance::GetLastId() const
|
||||||
|
{
|
||||||
|
const int count = ui->listWidgetMainPath->count();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->listWidgetMainPath->item(count-1);
|
||||||
|
const VPieceNode node = qvariant_cast<VPieceNode>(item->data(Qt::UserRole));
|
||||||
|
return node.GetId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetCurrentSABefore(qreal value)
|
void DialogSeamAllowance::SetCurrentSABefore(qreal value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,6 +105,8 @@ private:
|
||||||
|
|
||||||
QListWidgetItem *GetItemById(quint32 id);
|
QListWidgetItem *GetItemById(quint32 id);
|
||||||
|
|
||||||
|
quint32 GetLastId() const;
|
||||||
|
|
||||||
void SetCurrentSABefore(qreal value);
|
void SetCurrentSABefore(qreal value);
|
||||||
void SetCurrentSAAfter(qreal value);
|
void SetCurrentSAAfter(qreal value);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user