1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #include <QCoreApplication> #include <QObject> #include <QDebug> #include "reader.h" #include "newspaper.h"
int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); bool a; Newspaper newspaper; Reader reader; a = QObject::connect(&newspaper, SIGNAL(newPaper(QString )), &reader, SLOT(receiveNewspaper(QString ))); if(a) { newspaper.send("abc"); }else { qDebug() << "error."<<endl; } return app.exec(); }
|