Cross ref item, check properties for show power contacts or not.

Change properties in project is applied immediately to cross ref


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2985 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-04-12 12:51:25 +00:00
parent c7fe3f583b
commit ff14edda6b
4 changed files with 58 additions and 6 deletions

View File

@@ -35,10 +35,12 @@ CrossRefItem::CrossRefItem(Element *elmt, QGraphicsItem *parent) :
QGraphicsObject(parent),
element_ (elmt)
{
m_properties = elmt->diagram()->defaultXRefProperties();
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(autoPos()));
connect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
connect(elmt->diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
connect(elmt->diagram(), SIGNAL(XRefPropertiesChanged(XRefProperties)), this, SLOT(updateLabel()));
updateLabel();
}
@@ -276,7 +278,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
//find each no and nc of connected element to element_
foreach (Element *elmt, element_->linkedElements()) {
if (elmt->kindInformations()["type"].toString() == "power") continue;
if (elmt->kindInformations()["type"].toString() == "power" && !m_properties.showPowerContact()) continue;
QString state = elmt->kindInformations()["state"].toString();
if (state == "NO") NO_list << elmt;
else if (state == "NC") NC_list << elmt;