c++ - Qt Signal is emitter but signal seems not triggered -


all,

i'm developing application , inside app, need generate signal when value changed. have updated class mydevice add cumulchanged slots when value data changed.

mydevice.cpp

void mydevice::increasesize(uint64_t size) {     device->cumulsizeoperation += size;     emit cumulchanged(); }  void mydevice::cumulchanged(){     qdebug() << "test"; } 

i'm entering in increasesize , cumulchanged emitted.

i'm using signal in ui view information update progress bar.

what have done in ui.cpp

connect(this, signal(mydevice::cumulchanged()),         this, slot(onupdateprogress())); 

and onupdateprogress defined in ui class

void ui::onupdateprogress(){     box->progressupdate(); } 

my ui class defined below:

ui.cpp

ui::ui(devicemngr& device) :     m_device(device) 

and ui.h

class ui : public qtreewidget {     q_object public:     ui(devicemngr& device);     ~ ui();  private:     devicemngr& m_device; } 

any idea why onupdateprogress not triggered ?

thanks

i assume have in mydevice.h:

signals:     void cumulchanged(); 

then remove:

void mydevice::cumulchanged(){     qdebug() << "test"; } 

and add following line ui constructor:

connect(&device, &mydevice::cumulchanged, this, &ui::onupdateprogress); 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -