From 1ce645fa167df3e3e58cbd9380471756d63894a9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 29 Oct 2017 19:49:51 +0200 Subject: [PATCH] Fix bug in undocommands. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 3 +++ src/libs/ifc/xml/vabstractpattern.cpp | 9 +++++++++ src/libs/vtools/undocommands/deletepatternpiece.cpp | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index d25bd2594..9c6bf5433 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3079,6 +3079,9 @@ void MainWindow::GlobalChangePP(const QString &patternPiece) if ( index != -1 ) { // -1 for not found ChangePP(index, false); + comboBoxDraws->blockSignals(true); + comboBoxDraws->setCurrentIndex(index); + comboBoxDraws->blockSignals(false); } else { diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 86d190725..f3b8dde3d 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -808,6 +808,9 @@ void VAbstractPattern::SetMPath(const QString &path) //--------------------------------------------------------------------------------------------------------------------- quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const { + // This check helps to find missed tools in the switch + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if need to ignore modeling tools."); + quint32 siblingId = NULL_ID; const QVector history = getLocalHistory(); @@ -827,6 +830,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const const VToolRecord tool = history.at(j-1); switch ( tool.getTypeTool() ) { + case Tool::Arrow: case Tool::Piece: case Tool::UnionDetails: case Tool::NodeArc: @@ -834,6 +838,11 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const case Tool::NodePoint: case Tool::NodeSpline: case Tool::NodeSplinePath: + case Tool::PlaceLabel: + case Tool::Pin: + case Tool::PiecePath: + case Tool::InsertNode: + case Tool::DuplicateDetail: continue; default: siblingId = tool.getId(); diff --git a/src/libs/vtools/undocommands/deletepatternpiece.cpp b/src/libs/vtools/undocommands/deletepatternpiece.cpp index ba526f149..13672df62 100644 --- a/src/libs/vtools/undocommands/deletepatternpiece.cpp +++ b/src/libs/vtools/undocommands/deletepatternpiece.cpp @@ -82,7 +82,7 @@ void DeletePatternPiece::undo() } 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."); + emit doc->SetCurrentPP(namePP);//Without this user will not see this change QDomElement rootElement = doc->documentElement(); const QDomElement patternPiece = doc->GetPPElement(namePP); rootElement.removeChild(patternPiece);