#include "menumainwindow.h"
menumainwindow
::menumainwindow(QWidget *parent
){
showAct
= new QAction(("&Show"),
this);
connect(showAct, SIGNAL(triggered()),label1, SLOT(show()));
hideAct
= new QAction(("&Hide"),
this);
connect(hideAct, SIGNAL(triggered()),label1, SLOT(hide()));
exitAct
= new QAction(("&Exit"),
this);
connect(exitAct, SIGNAL(triggered()),qApp, SLOT(quit()));
bar = menuBar()->addMenu("&File");
bar->addAction(showAct);
bar->addAction(hideAct);
bar->addSeparator();
bar->addAction(exitAct);
setCentralWidget(bar);
}
#include "menumainwindow.h"
menumainwindow::menumainwindow(QWidget *parent)
: QMainWindow(parent)
{
showAct = new QAction(("&Show"), this);
connect(showAct, SIGNAL(triggered()),label1, SLOT(show()));
hideAct = new QAction(("&Hide"), this);
connect(hideAct, SIGNAL(triggered()),label1, SLOT(hide()));
exitAct = new QAction(("&Exit"), this);
connect(exitAct, SIGNAL(triggered()),qApp, SLOT(quit()));
bar = menuBar()->addMenu("&File");
bar->addAction(showAct);
bar->addAction(hideAct);
bar->addSeparator();
bar->addAction(exitAct);
setCentralWidget(bar);
}
To copy to clipboard, switch view to plain text mode
here it will display show,hide,exit menu but i want it to show when i click the “fileâ€..so anything wrong in the code..please suggest
Bookmarks