qt - How to use signals in ActiveX (ActiveQt) controls -
qt - How to use signals in ActiveX (ActiveQt) controls -
i'm trying modify activeqt/wrapper illustration code qt recive udp packets. want build activex command , set in c# framewindowapplication
#include <qaxfactory> #include <qcheckbox> #include <qradiobutton> #include <qpushbutton> #include <qtoolbutton> #include <qpixmap> #include <qudpsocket> // #include "mylabel.h" //! [0] class activeqtfactory : public qaxfactory { //q_object //if uncommented have errors below public: activeqtfactory( const quuid &lib, const quuid &app ) : qaxfactory( lib, app ) {} qstringlist featurelist() const { qstringlist list; list << "qcheckbox"; list << "qradiobutton"; list << "qpushbutton"; list << "qlabel"; homecoming list; } qobject *createobject(const qstring &key) { if ( key == "qcheckbox" ) homecoming new qcheckbox(0); if ( key == "qradiobutton" ) homecoming new qradiobutton(0); if ( key == "qpushbutton" ) homecoming new qpushbutton(0 ); if ( key == "qlabel" ) { qlabel *mainlabel = new qlabel(0); mainlabel->settext("mainlab1111"); mainlabel->setminimumsize(1000,600); mainlabel->setframestyle(qframe::box); // mylabel *interlabel = new mylabel; // interlabel->setparent(mainlabel); // interlabel->show(); socket = new qudpsocket(this); socket->bind(qhostaddress::any,1234); labelvideoinfo = new qlabel(mainlabel); labelvideoinfo->show(); labelvideoinfo->setgeometry(qrect(740,10,110,260)); labelvideoinfo->settext("lol"); this->connect(socket,signal(readyread()),this,slot(reading())); homecoming mainlabel; } homecoming 0; } const qmetaobject *metaobject( const qstring &key ) const { if ( key == "qcheckbox" ) homecoming &qcheckbox::staticmetaobject; if ( key == "qradiobutton" ) homecoming &qradiobutton::staticmetaobject; if ( key == "qpushbutton" ) homecoming &qpushbutton::staticmetaobject; if ( key == "qlabel" ) homecoming &qlabel::staticmetaobject; homecoming 0; } quuid classid( const qstring &key ) const { if ( key == "qcheckbox" ) homecoming "{6e795de9-872d-43cf-a831-496ef9d86c68}"; if ( key == "qradiobutton" ) homecoming "{afcf78c8-446c-409a-93b3-ba2959039189}"; if ( key == "qpushbutton" ) homecoming "{2b262458-a4b6-468b-b7d4-cf5fee0a7092}"; if ( key == "qlabel" ) homecoming "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}"; homecoming quuid(); } quuid interfaceid( const qstring &key ) const { if ( key == "qcheckbox" ) homecoming "{4fd39dd7-2de0-43c1-a8c2-27c51a052810}"; if ( key == "qradiobutton" ) homecoming "{7cc8ae30-206c-48a3-a009-b0a088026c2f}"; if ( key == "qpushbutton" ) homecoming "{06831cc9-59b6-436a-9578-6d53e5ad03d3}"; if ( key == "qlabel" ) homecoming "{6726080f-d63d-4950-a366-9bf33e5cdf84}"; homecoming quuid(); } quuid eventsid( const qstring &key ) const { if ( key == "qcheckbox" ) homecoming "{fdb6ffbe-56a3-4e90-8f4d-198488418b3a}"; if ( key == "qradiobutton" ) homecoming "{73ee4860-684c-4a66-bf63-9b9effa0cbe5}"; if ( key == "qpushbutton" ) homecoming "{3cc3f17f-ea59-4b58-bbd3-842d467131dd}"; if ( key == "qlabel" ) homecoming "{f4d421fd-4ead-4fd9-8a25-440766939639}"; homecoming quuid(); } private: qudpsocket *socket; qhostaddress sender; quint16 senderport; int packetid; qint64 size; qbytearray datagram; qlabel *labelvideoinfo; public slots: void reading() { size=socket->pendingdatagramsize(); datagram.resize(size); socket->readdatagram(datagram.data(),size,&sender,&senderport); labelvideoinfo->settext(qstring::number(size)); } signals: void changelabel(int i) { labelvideoinfo->settext(qstring::number(i)); } }; //! [0] //! [1] qaxfactory_export( activeqtfactory, "{3b756301-0075-4e40-8be8-5a81de2426b7}", "{ab068077-4924-406a-bbaf-42d91c8727dd}" ) //! [1]
connect/signals not working, think so, because lack of q_object macro, when uncomment q_object macro have errorcodes:
main.obj:-1: error: lnk2001: unresolved external symbol "public: virtual struct qmetaobject const * __thiscall activeqtfactory::metaobject(void)const " (?metaobject@activeqtfactory@@ubepbuqmetaobject@@xz) main.obj:-1: error: lnk2001: unresolved external symbol "public: virtual void * __thiscall activeqtfactory::qt_metacast(char const *)" (?qt_metacast@activeqtfactory@@uaepaxpbd@z) main.obj:-1: error: lnk2001: unresolved external symbol "public: virtual int __thiscall activeqtfactory::qt_metacall(enum qmetaobject::call,int,void * *)" (?qt_metacall@activeqtfactory@@uaehw4call@qmetaobject@@hpapax@z)
could help me how proper receive packets?
qt activex signals-slots qudpsocket activeqt
Comments
Post a Comment