Fix bug in undocommands.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-29 19:49:51 +02:00
parent 8309fa8c7a
commit 1ce645fa16
3 changed files with 14 additions and 1 deletions

View File

@ -3079,6 +3079,9 @@ void MainWindow::GlobalChangePP(const QString &patternPiece)
if ( index != -1 ) if ( index != -1 )
{ // -1 for not found { // -1 for not found
ChangePP(index, false); ChangePP(index, false);
comboBoxDraws->blockSignals(true);
comboBoxDraws->setCurrentIndex(index);
comboBoxDraws->blockSignals(false);
} }
else else
{ {

View File

@ -808,6 +808,9 @@ void VAbstractPattern::SetMPath(const QString &path)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
{ {
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if need to ignore modeling tools.");
quint32 siblingId = NULL_ID; quint32 siblingId = NULL_ID;
const QVector<VToolRecord> history = getLocalHistory(); const QVector<VToolRecord> history = getLocalHistory();
@ -827,6 +830,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
const VToolRecord tool = history.at(j-1); const VToolRecord tool = history.at(j-1);
switch ( tool.getTypeTool() ) switch ( tool.getTypeTool() )
{ {
case Tool::Arrow:
case Tool::Piece: case Tool::Piece:
case Tool::UnionDetails: case Tool::UnionDetails:
case Tool::NodeArc: case Tool::NodeArc:
@ -834,6 +838,11 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
case Tool::NodePoint: case Tool::NodePoint:
case Tool::NodeSpline: case Tool::NodeSpline:
case Tool::NodeSplinePath: case Tool::NodeSplinePath:
case Tool::PlaceLabel:
case Tool::Pin:
case Tool::PiecePath:
case Tool::InsertNode:
case Tool::DuplicateDetail:
continue; continue;
default: default:
siblingId = tool.getId(); siblingId = tool.getId();

View File

@ -82,7 +82,7 @@ void DeletePatternPiece::undo()
} }
emit NeedFullParsing(); emit NeedFullParsing();
doc->ChangeActivPP(namePP); emit doc->SetCurrentPP(namePP);//Without this user will not see this change
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -90,6 +90,7 @@ void DeletePatternPiece::redo()
{ {
qCDebug(vUndo, "Redo."); qCDebug(vUndo, "Redo.");
emit doc->SetCurrentPP(namePP);//Without this user will not see this change
QDomElement rootElement = doc->documentElement(); QDomElement rootElement = doc->documentElement();
const QDomElement patternPiece = doc->GetPPElement(namePP); const QDomElement patternPiece = doc->GetPPElement(namePP);
rootElement.removeChild(patternPiece); rootElement.removeChild(patternPiece);