mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-29 15:10:52 +01:00
improve behavior of Xref item (must show or not the power contact)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3042 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -105,6 +105,7 @@ void CrossRefItem::updateLabel() {
|
||||
|
||||
autoPos();
|
||||
update();
|
||||
checkMustShow();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -467,3 +468,41 @@ void CrossRefItem::AddExtraInfo(QPainter &painter) {
|
||||
painter.restore();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CrossRefItem::checkMustShow
|
||||
* Check the propertie of this Xref for know if we
|
||||
* must to be show or not
|
||||
*/
|
||||
void CrossRefItem::checkMustShow() {
|
||||
|
||||
//We always show Xref when is displayed has contact
|
||||
if (m_properties.displayHas() == XRefProperties::Contacts) {
|
||||
this->show();
|
||||
return;
|
||||
}
|
||||
|
||||
//if Xref is display has cross and we must to don't show power contact, check it
|
||||
else if (m_properties.displayHas() == XRefProperties::Cross && !m_properties.showPowerContact()) {
|
||||
bool power = false;
|
||||
foreach (Element *elmt, m_element->linkedElements()) {
|
||||
// contact checked isn't power, show this xref and return;
|
||||
if (elmt->kindInformations()["type"].toString() != "power") {
|
||||
this->show();
|
||||
return;
|
||||
} else {
|
||||
power = true;
|
||||
}
|
||||
}
|
||||
if (power) {
|
||||
this->hide();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//By default, show this Xref
|
||||
else {
|
||||
this->show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user