| 1692 | } |
| 1693 | |
| 1694 | void QmitkMxNMultiWidget::OnCreateNewSyncGroupRequested(QmitkSynchronizedNodeSelectionWidget* synchronizedWidget) |
| 1695 | { |
| 1696 | // Guard against the slot firing before the editor has a data storage attached |
| 1697 | // (e.g. during teardown, or if SetDataStorage(nullptr) was called after init). |
| 1698 | // AddSynchronizationGroup would otherwise throw, and Qt slots must not let |
| 1699 | // exceptions escape into the event dispatcher. |
| 1700 | if (nullptr == this->GetDataStorage()) |
| 1701 | { |
| 1702 | MITK_WARN << "Ignoring 'create new synchronization group' request: no data storage set on the multi widget."; |
| 1703 | return; |
| 1704 | } |
| 1705 | |
| 1706 | // 'SetSynchronizationGroup' auto-creates the group via 'AddSynchronizationGroup' |
| 1707 | // on first reference, so a separate Add call here would be redundant. |
| 1708 | const auto next = this->NextFreeSyncGroupIndex(); |
| 1709 | this->SetSynchronizationGroup(synchronizedWidget, next); |
| 1710 | } |