mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 17:50:52 +01:00
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:
@@ -7,7 +7,7 @@
|
||||
<kindInformations>
|
||||
<kindInformation show="1" name="number">1</kindInformation>
|
||||
<kindInformation show="1" name="state">SW</kindInformation>
|
||||
<kindInformation show="1" name="type">simple</kindInformation>
|
||||
<kindInformation show="1" name="type">delayOnOff</kindInformation>
|
||||
</kindInformations>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
|
||||
@@ -114,6 +114,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
|
||||
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é repos"), QVariant("delayOff"));
|
||||
ui->m_type_cb->addItem(tr("Temporisé travail & repos"), QVariant("delayOnOff"));
|
||||
|
||||
//Master option
|
||||
ui->m_master_type_cb->addItem(tr("Bobine"), QVariant("coil"));
|
||||
|
||||
@@ -552,6 +552,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
||||
if (type == "power") option += Power;
|
||||
else if (type == "delayOn") option += DelayOn;
|
||||
else if (type == "delayOff") option += DelayOff;
|
||||
else if (type == "delayOnOff") option += DelayOnOff;
|
||||
|
||||
QRectF br = drawContact(painter, option, elmt);
|
||||
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);
|
||||
}
|
||||
|
||||
// draw half circle for delay contact
|
||||
// draw half circle for delay contact
|
||||
if(flags &Delay) {
|
||||
// for delay on contact
|
||||
// for delay on contact
|
||||
if (flags &DelayOn) {
|
||||
if (flags &NO) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
// for delay off contact
|
||||
else {
|
||||
// for delay off contact
|
||||
else if ( flags &DelayOff){
|
||||
if (flags &NO) {
|
||||
painter.drawLine(12, offset+8, 12, offset+9.5);
|
||||
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);
|
||||
@@ -707,6 +725,12 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
||||
QRectF r(9.5, offset+16.5, 5, 3);
|
||||
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
|
||||
|
||||
@@ -63,7 +63,8 @@ class CrossRefItem : public QGraphicsObject
|
||||
Power = 8,
|
||||
DelayOn = 16,
|
||||
DelayOff = 32,
|
||||
Delay = 48
|
||||
DelayOnOff = 64,
|
||||
Delay = 112
|
||||
};
|
||||
|
||||
QRectF boundingRect () const override;
|
||||
|
||||
Reference in New Issue
Block a user