qfedu-basic-level/day11/qtdemo2/main.cpp

27 lines
696 B
C++
Raw Permalink Normal View History

2023-06-27 20:45:52 +08:00
#include "custom.h"
#include "restaurant.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Custom c;
c.setWindowTitle("点餐系统");
c.resize(800,600);
// 创建店类的对象
Restaurant r;
// 绑定客户下单信号处理函数
void (Custom:: *toOrder)(QString, int) = &Custom::toOrderSignal;
void (Restaurant:: *receiveOrder)(QString, int) = &Restaurant::receiveOrder;
QObject::connect(&c,toOrder,&r,receiveOrder);
// 绑定店家上菜信号和客户的槽函数
QObject::connect(&r,&Restaurant::okOrder,&c,&Custom::okOrderHandle);
c.show();
return a.exec();
}