| 20 | } |
| 21 | |
| 22 | int ButtonGroup::addButton(ButtonWidget* button, int id) { |
| 23 | if (!button) |
| 24 | return NoButton; |
| 25 | else if (m_buttonIds.contains(button)) |
| 26 | return m_buttonIds.get(button); |
| 27 | |
| 28 | // If we are auto-generating an id, start at the last id and work forward. |
| 29 | if (id == NoButton && !m_buttons.empty()) |
| 30 | id = (prev(m_buttons.end()))->first; |
| 31 | |
| 32 | while (m_buttons.contains(id)) |
| 33 | ++id; |
| 34 | |
| 35 | m_buttons[id] = button; |
| 36 | m_buttonIds[button] = id; |
| 37 | return id; |
| 38 | } |
| 39 | |
| 40 | void ButtonGroup::removeButton(ButtonWidget* button) { |
| 41 | if (m_buttonIds.contains(button)) { |
no test coverage detected