[kde-doc-english] [trojita] src/Gui: GUI: Reuse a pre-existing action for "Show menu bar" a bit
Jan Kundrát
jkt at kde.org
Thu Mar 5 18:45:43 UTC 2015
Git commit b38311d7eef3be6da1e21eb6ac16b1d7a5825806 by Jan Kundrát.
Committed on 03/03/2015 at 18:23.
Pushed by gerrit into branch 'master'.
GUI: Reuse a pre-existing action for "Show menu bar" a bit
Change-Id: Ia1f8df8eb13a6d57a3345969d9d38cf114c331b5
M +9 -2 src/Gui/Window.cpp
http://commits.kde.org/trojita/b38311d7eef3be6da1e21eb6ac16b1d7a5825806
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 729b144..c03dc84 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -291,15 +291,23 @@ void MainWindow::createActions()
connect(showMenuBar, SIGNAL(triggered(bool)), menuBar(), SLOT(setVisible(bool)));
connect(showMenuBar, SIGNAL(triggered(bool)), this, SLOT(updateMenuHidingButton()));
connect(showMenuBar, SIGNAL(triggered(bool)), m_delayedStateSaving, SLOT(start()));
- connect(menuShow, SIGNAL(clicked()), showMenuBar , SLOT(trigger()));
showToolBar = new QAction(tr("Show &Toolbar"), this);
showToolBar->setCheckable(true);
showToolBar->setChecked(true);
+ // Ideally, we would like to reuse the original action in this context.
+ // However, that action is checkable, and we want a simple button toggle here.
+ // Let's just copy around the title and icon.
+ // We cannot set the shortcut because the original action is still enabled and handles Ctrl+M just fine.
+ menuShow->setText(showMenuBar->text());
+ menuShow->setIcon(showMenuBar->icon());
+ // Make sure that the button clearly shows what it's all about
+ menuShow->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
connect(showToolBar, SIGNAL(triggered(bool)), m_mainToolbar, SLOT(setVisible(bool)));
connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), showToolBar, SLOT(setChecked(bool)));
connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), m_delayedStateSaving, SLOT(start()));
connect(m_mainToolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(updateMenuHidingButton()));
+ connect(menuShow, SIGNAL(clicked()), showMenuBar , SLOT(trigger()));
configSettings = new QAction(loadIcon(QLatin1String("configure")), tr("&Settings..."), this);
connect(configSettings, SIGNAL(triggered()), this, SLOT(slotShowSettings()));
@@ -667,7 +675,6 @@ void MainWindow::createWidgets()
busyParsersIndicator->hide();
menuShow = new QToolButton(this);
- menuShow->setText(tr("Show Menu Bar"));
statusBar()->addPermanentWidget(menuShow);
menuShow->hide();
More information about the kde-doc-english
mailing list