diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 38f66706d3..e8e14cb233 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -2188,6 +2188,7 @@ void Application::setStyleSheet(const QString& qssFile, bool tiledBackground) } mw->setProperty("fc_currentStyleSheet", qssFile); + mw->setProperty("fc_tiledBackground", tiledBackground); if (!qssFile.isEmpty()) { // Search for stylesheet in user-defined search paths. diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index c5d50cb2ac..2c6035b577 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -952,6 +952,33 @@ bool StdCmdUserEditMode::isActive() return true; } +//=========================================================================== +// Std_ReloadStylesheet +//=========================================================================== +DEF_STD_CMD(StdCmdReloadStyleSheet) + +StdCmdReloadStyleSheet::StdCmdReloadStyleSheet() + : Command("Std_ReloadStyleSheet") +{ + sGroup = "View"; + sMenuText = QT_TR_NOOP("&Reload stylesheet"); + sToolTipText = QT_TR_NOOP("Reloads the current stylesheet"); + sWhatsThis = "Std_ReloadStyleSheet"; + sStatusTip = QT_TR_NOOP("Reloads the current stylesheet"); + sPixmap = "view-refresh"; + sWhatsThis = "Std_ReloadStyleSheet"; +} + +void StdCmdReloadStyleSheet::activated(int iMsg) +{ + auto mw = getMainWindow(); + + auto qssFile = mw->property("fc_currentStyleSheet").toString(); + auto tiledBackground = mw->property("fc_tiledBackground").toBool(); + + Gui::Application::Instance->setStyleSheet(qssFile, tiledBackground); +} + namespace Gui { void CreateStdCommands() @@ -983,6 +1010,7 @@ void CreateStdCommands() rcCmdMgr.addCommand(new StdCmdTextDocument()); rcCmdMgr.addCommand(new StdCmdUnitsCalculator()); rcCmdMgr.addCommand(new StdCmdUserEditMode()); + rcCmdMgr.addCommand(new StdCmdReloadStyleSheet()); //rcCmdMgr.addCommand(new StdCmdMeasurementSimple()); //rcCmdMgr.addCommand(new StdCmdDownloadOnlineHelp()); //rcCmdMgr.addCommand(new StdCmdDescription());