#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMenuBar>
#include <QDebug>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
menuBar()->setNativeMenuBar(true);
menuBar()->setEnabled(true);
ui->setupUi(this);
//Not visible with Android
QAction* directAct=menuBar()->addAction("DirectA",this,SLOT(endMe()));
directAct->setVisible(true);
directAct->setEnabled(true);
//Visible but not firing
QMenu* directMenu=menuBar()->addMenu("DirectM");
directMenu->setEnabled(true);
connect(directMenu->menuAction(),SIGNAL(triggered()),this,SLOT(endMe( )));
//Visible, working (but one more click)
QMenu* normalMenu=menuBar()->addMenu("Normal");
QAction* normalActA=normalMenu->addAction("A",this,SLOT(endMe()));
QAction* normalActB=normalMenu->addAction("B",this,SLOT(endMe()));
normalMenu->setEnabled(true);
normalActA->setEnabled(true);
normalActB->setEnabled(true);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::endMe()
{
QMessageBox::about(this,"End","App will close now");
QApplication::quit();
}
Bookmarks