Signal emitter in gtkmm4

Hi, how can I obtain the signal emitter in gtkmm4?
Is there something similar to QT’s QObject::sender()?

Generally speaking the “emitter” is you, i.e. signals should only be emitted by the object itself (which of course is passed as the first argument to the callback)

I’m using the MVP pattern (Model–view–presenter - Wikipedia) in which the presenter handles the view signals, so this is the presenter in my case, not the button

Yes, the “presenter” may be handling the signals, but the model or view would be emitting them

The view holds the button which emits the signal. The presenter responds.
Here how I connect the signal:
button.signal_clicked().connect(sigc::mem_fun(presenter, &Presenter::OnButtonClicked));
Inside Presenter::OnButtonClicked(0 I want to disable the button until the action is complete, how can I do that?
Currently I’m passing the button as a parameter, I was hoping there was a simpler way to obtain it

I don’t know gtkmm specifics, but generally the object (i.e. your button) is the first argument to the callback

Alternatively you may just want to signal to the presenter that the operation started/ended so it can enable/disabled the button(s) associated with it (and presumably has references to)

Please read this Wiki page: Using libsigc++ signals - Inkscape Wiki

I hope it helps :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.