c++ - Signals and Slots help QT -


i have ui class function want call every time emit signal class lets test. in ui function need connect signal , slot im trying code qt docs , having no luck

signal declaration

signals:  void paint(int x, int y, int id); 

signal emit

emit paint(x, y, id) 

connection (m_test been class object)

connect(&m_test,signal(paint(int,int,int)), this, slot(uifunction(int,int,int))); 

getting error

error: c2664: 'qmetaobject::connection qobject::connect(const qobject *,const char *,const qobject *,const char *,qt::connectiontype)' : cannot convert parameter 1 'uifunction *' 'const qobject *'

but follwed qt docs example (counter being class)

counter a, b;      qobject::connect(&a, signal(valuechanged(int)),                       &b, slot(setvalue(int))); 

any ideas?

you need ui class inherit qobject , add qobject macro after declaration of class. e.g.

class ui : public qobject {     qobject  signals:     void paint(int x, int y, int id);  private slots:     void uifunction(int x, int y, int id); }; 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -