./cpp
#include "form1.h"
#include "ui_form1.h"
Form1::Form1(QWidget *parent) :
QDialog(parent),
ui(new Ui::Form1)
{
ui->setupUi(this);
first = new QAction(tr("&first"), this);
second = new QAction(tr("&second"), this);
//first ->setStatusTip(tr("Show the application's About box"));
menu=new QMenu(this);
menu->addAction(first);
menu->addAction(second);
connect(first , SIGNAL(triggered()), this, SLOT(f1()));
connect(second , SIGNAL(triggered()), this, SLOT(s1()));
}
Form1::~Form1()
{
delete ui;
}
void Form1::on_pushButton_clicked()
{
QPoint pos;
pos.setX(0);
pos.setY(-42);
menu->exec(ui->pushButton->mapToGlobal(pos));
}
void Form