mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-06 11:14:14 +02:00
Fix PLC cross-reference links and make cross-ref column clickable
This commit is contained in:
@@ -252,6 +252,29 @@ ElementTextItemGroup *DynamicElementTextItem::parentGroup() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DynamicElementTextItem::masterElement
|
||||
@return the master element for slave elements, or the parent element for others.
|
||||
For PLC slaves, returns the actual master from linkedElements() instead of
|
||||
m_master_element (which points to self because elementUseForInfo() returns
|
||||
self for PLC slaves to resolve %{plc_*} variables).
|
||||
*/
|
||||
Element *DynamicElementTextItem::masterElement() const
|
||||
{
|
||||
Element *elmt = parentElement();
|
||||
if (!elmt)
|
||||
return m_master_element.data();
|
||||
|
||||
if (elmt->linkType() == Element::Slave &&
|
||||
elmt->elementData().m_slave_type == ElementData::PLCSlave &&
|
||||
!elmt->linkedElements().isEmpty())
|
||||
{
|
||||
return elmt->linkedElements().first();
|
||||
}
|
||||
|
||||
return m_master_element.data();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DynamicElementTextItem::elementUseForInfo
|
||||
@return a pointer to the element we must use for the variable information.
|
||||
|
||||
Reference in New Issue
Block a user