Add symbol and improve 'Other' option for slave device contact type.

This commit is contained in:
Laurent Trinques
2022-08-06 18:42:05 +02:00
parent f0919d5fa6
commit 21524ee528

View File

@@ -759,6 +759,9 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
} }
//Draw a switch contact //Draw a switch contact
else if (flags &SW) else if (flags &SW)
{ {
bounding_rect = QRectF(0, offset, 24, 20); bounding_rect = QRectF(0, offset, 24, 20);
@@ -799,16 +802,12 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
QRectF rr(9.5, offset+17, 5, 3); QRectF rr(9.5, offset+17, 5, 3);
painter.drawArc(rr, 0, 180*16); painter.drawArc(rr, 0, 180*16);
} }
}
else if (flags &Other)
{
bounding_rect = QRectF(0, offset, 24, 20);
}
}
//Draw position text //Draw position text
QRectF text_rect = painter.boundingRect( QRectF text_rect = painter.boundingRect(
QRectF(30, offset+5, 5, 10), QRectF(30, offset+4, 5, 10),
Qt::AlignLeft | Qt::AlignVCenter, Qt::AlignLeft | Qt::AlignVCenter,
str); str);
painter.drawText(text_rect, painter.drawText(text_rect,
@@ -826,11 +825,30 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
//a switch contact take place of two normal contact //a switch contact take place of two normal contact
m_drawed_contacts += 2; m_drawed_contacts += 2;
}else if(flags &Other){ }
QRectF text_rect = painter.boundingRect(QRectF(30, offset, 5, 10), Qt::AlignLeft | Qt::AlignVCenter, str); //Draw a other symbol
painter.drawText(text_rect, Qt::AlignLeft | Qt::AlignVCenter, str); else if(flags &Other)
{
bounding_rect = QRectF(0, offset, 24, 20);
//Draw the first arc symbol
QRectF r(8, offset+4, 5, 3);
painter.drawArc(r, 10*16, 270*16);
//Draw the second arc symbol
QRectF r2(11.2, offset+4, 5, 3);
painter.drawArc(r2, 160*16, 300*16);
//Draw position text
QRectF text_rect = painter.boundingRect(
QRectF(30, offset, 5, 10),
Qt::AlignLeft | Qt::AlignVCenter,
str);
painter.drawText(text_rect,
Qt::AlignLeft | Qt::AlignVCenter,
str);
bounding_rect = bounding_rect.united(text_rect);
if (m_hovered_contacts_map.contains(elmt)) { if (m_hovered_contacts_map.contains(elmt)) {
m_hovered_contacts_map.insert(elmt, bounding_rect); m_hovered_contacts_map.insert(elmt, bounding_rect);
@@ -838,12 +856,12 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
else { else {
m_hovered_contacts_map.insert(elmt, bounding_rect); m_hovered_contacts_map.insert(elmt, bounding_rect);
} }
m_drawed_contacts += 1; ++m_drawed_contacts;
} }
return bounding_rect; return bounding_rect;
} }
/** /**
@brief CrossRefItem::fillCrossRef @brief CrossRefItem::fillCrossRef
Fill the content of the cross ref Fill the content of the cross ref