Skip to content

Commit

Permalink
[TD]prevent recompute on cancel without change
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Dec 9, 2022
1 parent 7e951e6 commit 8b511b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Mod/TechDraw/Gui/TaskSectionView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) :
m_createMode(true),
m_saved(false),
m_applyDeferred(0),
m_directionIsSet(false)
m_directionIsSet(false),
m_modelIsDirty(false)
{
//existence of base is guaranteed by CmdTechDrawSectionView (Command.cpp)

Expand All @@ -103,7 +104,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) :
m_createMode(false),
m_saved(false),
m_applyDeferred(0),
m_directionIsSet(true)
m_directionIsSet(true),
m_modelIsDirty(false)
{
//existence of section is guaranteed by ViewProviderViewSection.setEdit

Expand Down Expand Up @@ -444,6 +446,8 @@ bool TaskSectionView::apply(bool forceUpdate)
}

Gui::WaitCursor wc;
m_modelIsDirty = true;

if (m_dirName.empty()) {
//this should never happen
std::string msg =
Expand Down Expand Up @@ -697,9 +701,11 @@ bool TaskSectionView::reject()
"App.ActiveDocument.removeObject('%s')",
SectionName.c_str());
} else {
restoreSectionState();
m_section->recomputeFeature();
m_section->requestPaint();
if (m_modelIsDirty) {
restoreSectionState();
m_section->recomputeFeature();
m_section->requestPaint();
}
}

if (isBaseValid()) {
Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/Gui/TaskSectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected Q_SLOTS:
CompassWidget* m_compass;
VectorEditWidget* m_viewDirectionWidget;
bool m_directionIsSet;
bool m_modelIsDirty;
};

class TaskDlgSectionView : public Gui::TaskView::TaskDialog
Expand Down

0 comments on commit 8b511b9

Please sign in to comment.