Friday, February 10, 2017

Assign radio buttons to QButtonGroup in Qt Designer

When you use the Qt designer to design your form, you can group buttons by selecting them and choosing "Assign to button group" then "New button group" from the context menu.

However it's not possible to manually assign IDs to the buttons in the group. Instead, use QButtonGroup::setId(button, id) after setupUI in order to change the automatically assigned IDs. And also take into account that Qt Designer start counting negative from -2 so it wouldn't be recommendable to depend on that order.

No comments:

Post a Comment