Gui: [skip ci] add user option to disable to open a transaction on manual document recompute

This commit is contained in:
wmayer
2020-02-15 14:11:39 +01:00
parent 802ca4e0cb
commit 902cd411f8

View File

@@ -1291,13 +1291,22 @@ StdCmdRefresh::StdCmdRefresh()
sAccel = keySequenceToAccel(QKeySequence::Refresh);
eType = AlterDoc | Alter3DView | AlterSelection | ForEdit;
bCanLog = false;
// Make it optional to create a transaction for a recompute.
// The new default behaviour is quite cumbersome in some cases because when
// undoing the last transaction the manual recompute will clear the redo stack.
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Document");
bool create = hGrp->GetBool("TransactionOnRecompute", true);
if (!create)
eType = eType | NoTransaction;
}
void StdCmdRefresh::activated(int iMsg)
{
Q_UNUSED(iMsg);
if (getActiveGuiDocument()) {
App::AutoTransaction trans("Recompute");
App::AutoTransaction trans((eType & NoTransaction) ? nullptr : "Recompute");
try {
doCommand(Doc,"App.activeDocument().recompute(None,True,True)");
}