From 527e7eae22b9ab17237b8985a2ab2a3db1c5c17f Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Thu, 27 Feb 2025 17:31:35 +0000 Subject: [PATCH] Gui: Refactor `StdCmdRefresh::activated`. --- src/Gui/CommandDoc.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 6d9274b69a..5a1324fe32 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1507,24 +1507,25 @@ StdCmdRefresh::StdCmdRefresh() eType = eType | NoTransaction; } -void StdCmdRefresh::activated(int iMsg) +void StdCmdRefresh::activated([[maybe_unused]] int iMsg) { - Q_UNUSED(iMsg); - if (getActiveGuiDocument()) { - App::AutoTransaction trans((eType & NoTransaction) ? nullptr : "Recompute"); - try { - doCommand(Doc,"App.activeDocument().recompute(None,True,True)"); - } - catch (Base::Exception& /*e*/) { - auto ret = QMessageBox::warning(getMainWindow(), QObject::tr("Dependency error"), - qApp->translate("Std_Refresh", "The document contains dependency cycles.\n" - "Please check the Report View for more details.\n\n" - "Do you still want to proceed?"), - QMessageBox::Yes, QMessageBox::No); - if(ret == QMessageBox::No) - return; - doCommand(Doc,"App.activeDocument().recompute(None,True)"); - } + if (!getActiveGuiDocument()) { + return; + } + + App::AutoTransaction trans((eType & NoTransaction) ? nullptr : "Recompute"); + try { + doCommand(Doc,"App.activeDocument().recompute(None,True,True)"); + } + catch (Base::Exception& /*e*/) { + auto ret = QMessageBox::warning(getMainWindow(), QObject::tr("Dependency error"), + qApp->translate("Std_Refresh", "The document contains dependency cycles.\n" + "Please check the Report View for more details.\n\n" + "Do you still want to proceed?"), + QMessageBox::Yes, QMessageBox::No); + if(ret == QMessageBox::No) + return; + doCommand(Doc,"App.activeDocument().recompute(None,True)"); } }