#include "custom.h" #include "restaurant.h" #include 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(); }