main widget emit signal once, but slot call multiple time
my design has main widget and a sub widget. I use qt push button to open the subwidget. but when i close subwidget (x sign) and use the button to open i again, my signal emit once buy my slot function run twice. I close subwidget, and open again via qt push button. now my signal emit once, but my slot function run three time. any ideas
subwidget_pt = new sub_Widget();
connect(this, SIGNAL(mysig() ),
subwidget_pt, SLOT(myslot() ) );
signal is emit from another function
i try subwidget_pt->close() but it close all my widget including the main one.
you run the connect statement multiple times, therefore the slot is executed multiple times.
Solution: only connect once, then emit as often as you like.
thanks, i saw it will disconnect automatically when i close the sub-widget, guess not. I didn't properly run the destructor, now its working after i run the destructor.
Pablo J. Rogina
@s002wjh if your issue is solved, please don't forget to mark you post as such. Thanks.