Added menu bar to the Qt RAM search window. Currently only has a File->Close menu entry.

This commit is contained in:
mjbudd77 2021-02-27 17:16:04 -05:00
parent 623c2151a7
commit 081d55ea45
1 changed files with 31 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <string>
#include <SDL.h>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QHeaderView>
@ -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();