i am new to qt and what to know how to get the id of the button that is clicked in qt through signal and slot.
connect(group, SIGNAL(buttonClicked(int)), this, SLOT(buttonWasClicked(int)));
This was the earlier syntax to get the id, but qt has declared buttonClicked(int) as obsolete and it no longer allows us use it. is there any new replacement for this code.
Plz forgive if this question was silly, but i don't know much about qt yet.
The
QButtonGroup::buttonClicked(int)
signal is obsoleted but you can still useQButtonGroup:: buttonClicked(QAbstractButton *)
. Perhaps use it in conjunction with a lambda and your existingbuttonWasClicked
slot...Alternatively, use the
idClicked
signal as suggested by @chehrlic...(Assuming
MainWindow
is the type pointed to bythis
.)