MCPcopy Create free account
hub / github.com/MITK/MITK / SetSynchronizationGroup

Method SetSynchronizationGroup

Modules/QtWidgets/src/QmitkMxNMultiWidget.cpp:1628–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1626}
1627
1628void QmitkMxNMultiWidget::SetSynchronizationGroup(QmitkSynchronizedNodeSelectionWidget* synchronizedWidget, const GroupSyncIndexType index)
1629{
1630 if (nullptr == synchronizedWidget)
1631 {
1632 mitkThrow() << "SetSynchronizationGroup: synchronizedWidget must not be null.";
1633 }
1634
1635 // Auto-create on first reference. Add() validates index >= 1 and storage presence.
1636 if (m_SynchronizedWidgetConnectors.find(index) == m_SynchronizedWidgetConnectors.end())
1637 {
1638 this->AddSynchronizationGroup(index);
1639 }
1640
1641 const auto old_index = synchronizedWidget->GetSyncGroup();
1642
1643 if (old_index == index)
1644 {
1645 // Already on this group. Connector edge stays (no double-Connect that would
1646 // double-bump the connection counter); just refresh state from the connector
1647 // so the freshly attached widget sees the cached selection / select-all mode.
1648 m_SynchronizedWidgetConnectors[index]->SynchronizeWidget(synchronizedWidget);
1649 return;
1650 }
1651
1652 // For the initial setting of the synchronization, nothing old is there to disconnect.
1653 if (old_index != -1)
1654 {
1655 const auto oldIt = m_SynchronizedWidgetConnectors.find(old_index);
1656 if (oldIt != m_SynchronizedWidgetConnectors.end())
1657 {
1658 oldIt->second->DisconnectWidget(synchronizedWidget);
1659 }
1660 }
1661
1662 synchronizedWidget->SetSyncGroup(index);
1663 m_SynchronizedWidgetConnectors[index]->ConnectWidget(synchronizedWidget);
1664 m_SynchronizedWidgetConnectors[index]->SynchronizeWidget(synchronizedWidget);
1665}
1666
1667QmitkSynchronizedWidgetConnector* QmitkMxNMultiWidget::GetSyncGroupConnector(const GroupSyncIndexType index) const
1668{

Calls 8

SynchronizeWidgetMethod · 0.80
DisconnectWidgetMethod · 0.80
ConnectWidgetMethod · 0.80
findMethod · 0.45
endMethod · 0.45
GetSyncGroupMethod · 0.45
SetSyncGroupMethod · 0.45