diff options
| author | Oleksandr Bondar <[email protected]> | 2026-05-10 07:39:09 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-05-10 07:39:09 +0000 |
| commit | bd680fa12b43698a7dfb76b8791aea5d2d9fd496 (patch) | |
| tree | 4760da69b40e8318f1614b284b44f80b3f22742b | |
| parent | a2f56f7ccf5cd41c9286970280bbf29ff2bc96b0 (diff) | |
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
| -rw-r--r-- | src/dolphinmainwindow.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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<KHamburgerMenu *>(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<QAction> DolphinMainWindow::preferredSearchTool() |
