From 081d55ea45384ba2fcaf53e717ec3c43958d460c Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 27 Feb 2021 17:16:04 -0500 Subject: [PATCH] Added menu bar to the Qt RAM search window. Currently only has a File->Close menu entry. --- src/drivers/Qt/RamSearch.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/drivers/Qt/RamSearch.cpp b/src/drivers/Qt/RamSearch.cpp index 4af72f77..bab1ad2c 100644 --- a/src/drivers/Qt/RamSearch.cpp +++ b/src/drivers/Qt/RamSearch.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -204,14 +205,44 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent) QGridLayout *grid; QGroupBox *frame; ramSearchInputValidator *inpValidator; + QMenuBar *menuBar; + QMenu *fileMenu; + QAction *act; + int useNativeMenuBar; setWindowTitle("RAM Search"); + menuBar = new QMenuBar(this); + + // This is needed for menu bar to show up on MacOS + g_config->getOption( "SDL.UseNativeMenuBar", &useNativeMenuBar ); + + menuBar->setNativeMenuBar( useNativeMenuBar ? true : false ); + + //----------------------------------------------------------------------- + // Menu Start + //----------------------------------------------------------------------- + // File + fileMenu = menuBar->addMenu(tr("&File")); + + // File -> Close + act = new QAction(tr("&Close"), this); + act->setShortcut(QKeySequence::Close); + act->setStatusTip(tr("Close Window")); + connect(act, SIGNAL(triggered()), this, SLOT(closeWindow(void)) ); + + fileMenu->addAction(act); + + //----------------------------------------------------------------------- + // Menu End + //----------------------------------------------------------------------- + resize(512, 512); mainLayout = new QVBoxLayout(); hbox1 = new QHBoxLayout(); + mainLayout->setMenuBar( menuBar ); mainLayout->addLayout(hbox1, 100); grid = new QGridLayout();