class MyClass : public QObject{Q_OBJECTpublic: MyClass(QObject *parent = 0) : QObject(parent) { } void myMethod();public slots: void mySlot();signals: void mySignal();}
void MyClass::myMethod(){ //реализация //можно выслать наш сигнал emit mySIgnal();}void MyClass::mySlot(){ //реализация}
class Udpclientserver: public QObject {Q_OBJECT public: Udpclientserver(QObject *parent = 0){}; ~Udpclientserver(){}; //реализация public slots: void processDatagrams() { //реализация emit returndata(str); }signals : QString returndata (QString s) ; };
#include "udpclientserver.h" QString Udpclientserver::returndata(QString s} {return s;}
moc_udpclientserver.o: In function `Udpclientserver::returndata(QString)':moc_udpclientserver.cpp:(.text+0x20): multiple definition of `Udpclientserver::returndata(QString)'udpclientserver.o:udpclientserver.cpp:(.text+0x0): first defined herecollect2: ld returned 1 exit status
//QString Udpclientserver::returndata(QString _t1)//{ // QString _t0; // void *_a[] = { const_cast<void*>(reinterpret_cast<const void*>(&_t0)), const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; // QMetaObject::activate(this, &staticMetaObject, 0, _a); // return _t0;//}
QString Udpclientserver::returndata(QString _t1) { QString _t0; void *_a[] = { const_cast<void*>(reinterpret_cast<const void*>(&_t0)), const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };QMetaObject::activate(this, &staticMetaObject, 0, _a); QString s=_t1; return s; }