Toggle dynamically created objects using dynamically created QRadioButtons
I'm working on a QT application. In it the user can create several objects, each one will be added to a list. In the next step the user shall position the objects. The choice which one of the objects shall be positioned, shall be made by clicking QRadioButtons (seems logical as QRadioButtons added to a QGroupbox ensure that only one of them is active).
The problem is I can't find a sig开发者_运维问答nal that allows me tell which radio button is active or was clicked. I already connected all radio buttons to one slot, but all I get is a boolean value. How can I get the sender of the signal? Or what would be the standard way to achieve my goal?
QObject::sender is a bit too abstract. Try QButtonGroup::buttonClicked
You can get the sender of the signal using... QObject::sender() method within your slot!
精彩评论