#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
class Widget : public QWidget
{
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
//槽函数声明
public slots:
void FoodisComing();
private:
Ui::Widget *ui;
};
#endif // WIDGET_H
#include "widget.h"
#include "ui_widget.h"
#include <QMessageBox>
//声明使用弹消息框的类
//点餐送达的按钮和弹消息
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(FoodisComing()));
}
Widget::~Widget()
{
delete ui;
}
//槽函数的定义
void Widget::FoodisComing()
{
QMessageBox::information(this,tr("开始送餐"),tr("快递送达"));
}