c++ - QObject::connect: No such signal(classname)(signalname)(atribure) -
i have problem. great when compile, slots don't work. after application starts, outputs qobject::connect: no such signal cmatrix::readytodraw(ww)
. tested it, slot drawfunction()
doesn't work. can't debug because of segmentation fault.
header.h
class cmatrix:public qobject { q_object public: int **m_pmatrix; const short int m_size=4; public: cmatrix(); bool checkfields(); void setfield(); signals: void readytodraw(cmatrix *ww); public slots: void movedown(); void movetop(); void moveleft(); void moveright(); }; class mainwindow : public qwidget { q_object public: mainwindow(qwidget *parent = 0); ~mainwindow(); private slots: void drawfunction(cmatrix *a); public: qpushbutton* buttop; qlist<qlabel*> lbllist; };
main.cpp
#include "header.h" #include <qapplication> int main(int argc, char *argv[]) { qapplication a(argc, argv); mainwindow w; cmatrix *ww=new cmatrix; qobject::connect(w.buttop,signal(clicked()),ww,slot(movetop())); qobject::connect(ww,signal(readytodraw(ww)),&w,slot(drawfunction(ww))); w.show(); return a.exec(); }
your signals signature is
readytodraw(cmatrix *)
not
readytodraw(ww)
as connect() needs type, not name of variable.
so change connect line to:
qobject::connect(ww,signal(readytodraw(cmatrix *)),&w,slot(drawfunction(cmatrix *)));
Comments
Post a Comment