Add new slave type : delay on/off

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5848 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2019-04-29 16:41:06 +00:00
parent c49cf8d136
commit cd9a42184f
4 changed files with 32 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
<kindInformations> <kindInformations>
<kindInformation show="1" name="number">1</kindInformation> <kindInformation show="1" name="number">1</kindInformation>
<kindInformation show="1" name="state">SW</kindInformation> <kindInformation show="1" name="state">SW</kindInformation>
<kindInformation show="1" name="type">simple</kindInformation> <kindInformation show="1" name="type">delayOnOff</kindInformation>
</kindInformations> </kindInformations>
<informations>Author: The QElectroTech team <informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations> License: see http://qelectrotech.org/wiki/doc/elements_license</informations>

View File

@@ -114,6 +114,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
ui->m_type_cb->addItem(tr("Puissance"), QVariant("power")); ui->m_type_cb->addItem(tr("Puissance"), QVariant("power"));
ui->m_type_cb->addItem(tr("Temporisé travail"), QVariant("delayOn")); ui->m_type_cb->addItem(tr("Temporisé travail"), QVariant("delayOn"));
ui->m_type_cb->addItem(tr("Temporisé repos"), QVariant("delayOff")); ui->m_type_cb->addItem(tr("Temporisé repos"), QVariant("delayOff"));
ui->m_type_cb->addItem(tr("Temporisé travail & repos"), QVariant("delayOnOff"));
//Master option //Master option
ui->m_master_type_cb->addItem(tr("Bobine"), QVariant("coil")); ui->m_master_type_cb->addItem(tr("Bobine"), QVariant("coil"));

View File

@@ -552,6 +552,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
if (type == "power") option += Power; if (type == "power") option += Power;
else if (type == "delayOn") option += DelayOn; else if (type == "delayOn") option += DelayOn;
else if (type == "delayOff") option += DelayOff; else if (type == "delayOff") option += DelayOff;
else if (type == "delayOnOff") option += DelayOnOff;
QRectF br = drawContact(painter, option, elmt); QRectF br = drawContact(painter, option, elmt);
bounding_rect = bounding_rect.united(br); bounding_rect = bounding_rect.united(br);
@@ -625,9 +626,9 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
painter.drawArc(arc, 0, 180*16); painter.drawArc(arc, 0, 180*16);
} }
// draw half circle for delay contact // draw half circle for delay contact
if(flags &Delay) { if(flags &Delay) {
// for delay on contact // for delay on contact
if (flags &DelayOn) { if (flags &DelayOn) {
if (flags &NO) { if (flags &NO) {
painter.drawLine(12, offset+8, 12, offset+11); painter.drawLine(12, offset+8, 12, offset+11);
@@ -640,8 +641,8 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
painter.drawArc(r, 180*16, 180*16); painter.drawArc(r, 180*16, 180*16);
} }
} }
// for delay off contact // for delay off contact
else { else if ( flags &DelayOff){
if (flags &NO) { if (flags &NO) {
painter.drawLine(12, offset+8, 12, offset+9.5); painter.drawLine(12, offset+8, 12, offset+9.5);
QRectF r(9.5, offset+9.5, 5, 3); QRectF r(9.5, offset+9.5, 5, 3);
@@ -654,6 +655,23 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
} }
} }
else {
// for delay on contact
if (flags &NO) {
painter.drawLine(12, offset+8, 12, offset+11);
QRectF r(9.5, offset+11.7, 5, 3);
painter.drawArc(r, 0, 180*16);
QRectF rl(9.5, offset+9, 5, 3);
painter.drawArc(rl, 180*16, 180*16);
}
if (flags &NC) {
painter.drawLine(QPointF(12.5, offset+5), QPointF(12.5, offset+8));
QRectF r(9.5, offset+10.7, 5, 3);
painter.drawArc(r, 0, 180*16);
QRectF rl(9.5, offset+8, 5, 3);
painter.drawArc(rl, 180*16, 180*16);
}
}
} }
QRectF text_rect = painter.boundingRect(QRectF(30, offset, 5, 10), Qt::AlignLeft | Qt::AlignVCenter, str); QRectF text_rect = painter.boundingRect(QRectF(30, offset, 5, 10), Qt::AlignLeft | Qt::AlignVCenter, str);
@@ -707,6 +725,12 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
QRectF r(9.5, offset+16.5, 5, 3); QRectF r(9.5, offset+16.5, 5, 3);
painter.drawArc(r, 0, 180*16); painter.drawArc(r, 0, 180*16);
} }
else if (flags &DelayOnOff) {
QRectF r(9.5, offset+14, 5, 3);
painter.drawArc(r, 180*16, 180*16);
QRectF rr(9.5, offset+17, 5, 3);
painter.drawArc(rr, 0, 180*16);
}
} }
//Draw position text //Draw position text

View File

@@ -63,7 +63,8 @@ class CrossRefItem : public QGraphicsObject
Power = 8, Power = 8,
DelayOn = 16, DelayOn = 16,
DelayOff = 32, DelayOff = 32,
Delay = 48 DelayOnOff = 64,
Delay = 112
}; };
QRectF boundingRect () const override; QRectF boundingRect () const override;