[PATCH 02/16] kconfig: qconf: remove 'menu' variable

Masahiro Yamada
2020-08-02T16:17:44Z

I think it is a bit confusing to use 'menu' to hold a QMenuBar pointer
because it looks like a QMenu pointer.

You do not need to use a local variable here. Use QMenuBar() directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

scripts/kconfig/qconf.cc | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9513c0ba8d0c..0ef9a1da6475 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1381,7 +1381,6 @@ void ConfigSearchWindow::search(void)
ConfigMainWindow::ConfigMainWindow(void)
: searchWindow(0)
{
- QMenuBar* menu;
bool ok = true;
QVariant x, y;
int width, height;
@@ -1432,7 +1431,6 @@ ConfigMainWindow::ConfigMainWindow(void)
setTabOrder(configList, helpText);
configList->setFocus();

- menu = menuBar();
toolBar = new QToolBar("Tools", this);
addToolBar(toolBar);

@@ -1518,7 +1516,7 @@ ConfigMainWindow::ConfigMainWindow(void)
toolBar->addAction(fullViewAction);

// create file menu
- QMenu *fileMenu = menu->addMenu("&File");
+ QMenu *fileMenu = menuBar()->addMenu("&File");
fileMenu->addAction(loadAction);
fileMenu->addAction(saveAction);
fileMenu->addAction(saveAsAction);
@@ -1526,12 +1524,13 @@ ConfigMainWindow::ConfigMainWindow(void)
fileMenu->addAction(quitAction);

// create edit menu
- QMenu* editMenu = menu->addMenu("&Edit");
+ QMenu *editMenu = menuBar()->addMenu("&Edit");
editMenu->addAction(searchAction);

// create options menu
- QMenu* optionMenu = menu->addMenu("&Option");
+ QMenu *optionMenu = menuBar()->addMenu("&Option");
optionMenu->addAction(showNameAction);
+
optionMenu->addAction(showRangeAction);
optionMenu->addAction(showDataAction);
optionMenu->addSeparator();
@@ -1540,8 +1539,8 @@ ConfigMainWindow::ConfigMainWindow(void)
optionMenu->addAction(showDebugAction);

// create help menu
- menu->addSeparator();
- QMenu* helpMenu = menu->addMenu("&Help");
+ menuBar()->addSeparator();
+ QMenu *helpMenu = menuBar()->addMenu("&Help");
helpMenu->addAction(showIntroAction);
helpMenu->addAction(showAboutAction);

--
2.25.1