Fix for bug in switch group (#5946)

Signed-off-by: T.J. McGrath-Daly <tj.mcgrath.daly@huawei.com>
This commit is contained in:
tjmgd
2021-12-03 18:38:45 +00:00
committed by GitHub
parent d0511cf444
commit 599e3104a2
@@ -225,6 +225,36 @@ namespace AudioControls
{
pItem->setFlags(pItem->flags() & ~Qt::ItemIsDragEnabled);
}
if (compatibleType == EACEControlType::eACET_SWITCH_STATE)
{
IAudioSystemControl* pControl = pAudioSystemEditorImpl->GetControl(GetItemId(pItem));
if (pControl && !pControl->IsLocalized())
{
size_t nConnect = 0;
for (int i = 0; i < pControl->GetParent()->ChildCount(); ++i)
{
IAudioSystemControl* child = pControl->GetParent()->GetChildAt(i);
if (child && child->IsConnected())
{
++nConnect;
}
}
QTreeWidgetItem* pParentItem = GetItem(pControl->GetParent()->GetId(), pControl->GetParent()->IsLocalized());
if (pParentItem)
{
if (nConnect > 0 && nConnect == pControl->GetParent()->ChildCount())
{
pParentItem->setForeground(0, m_connectedColor);
}
else
{
pParentItem->setForeground(0, m_disconnectedColor);
}
}
}
}
}
}