From bd680fa12b43698a7dfb76b8791aea5d2d9fd496 Mon Sep 17 00:00:00 2001 From: Oleksandr Bondar Date: Sun, 10 May 2026 07:39:09 +0000 Subject: dolphinmainwindow: defer menuBar visibility apply until after UI has loaded The KXmlGuiWindow base class restores menuBar visibility directly via applyMainWindowSettings(), bypassing the ShowMenubar action's checked state. As a result, the action always reported checked=true on startup regardless of the saved setting. Sync the action's checked state from the actual menuBar visibility after setupGUI(), then apply it back via singleShot(0) to ensure all QueuedConnection slots have fired first Amends c3ef613f29dd256e1b6065f1c744241b6f69788a --- src/dolphinmainwindow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 0aff2299c..7d798ac17 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -235,7 +235,10 @@ DolphinMainWindow::DolphinMainWindow() } QAction *showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar)); - menuBar()->setVisible(showMenuBarAction->isChecked()); + showMenuBarAction->setChecked(!menuBar()->isHidden()); //workaround for bug #171080 + QTimer::singleShot(0, this, [this, showMenuBarAction]() { + menuBar()->setVisible(showMenuBarAction->isChecked()); + }); auto hamburgerMenu = static_cast(actionCollection()->action(KStandardAction::name(KStandardAction::HamburgerMenu))); hamburgerMenu->setMenuBar(menuBar()); @@ -1308,6 +1311,9 @@ void DolphinMainWindow::toggleShowMenuBar() { QAction *showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar)); menuBar()->setVisible(showMenuBarAction->isChecked()); + KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("MainWindow")); + group.writeEntry("MenuBar", showMenuBarAction->isChecked() ? "Enabled" : "Disabled"); + group.sync(); } QPointer DolphinMainWindow::preferredSearchTool() -- cgit v1.3.1