mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Cross ref item: when xref is show has table, user can add prefix to the text of power and delay contact.
Minor improvemnt: the table update is size according to his content git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3060 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -35,6 +35,8 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const
|
|||||||
settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
|
settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
|
||||||
QString display = m_display == Cross? "cross" : "contacts";
|
QString display = m_display == Cross? "cross" : "contacts";
|
||||||
settings.setValue(prefix + "displayhas", display);
|
settings.setValue(prefix + "displayhas", display);
|
||||||
|
settings.setValue(prefix + "powerprefix", m_prefix.value("power"));
|
||||||
|
settings.setValue(prefix + "delayprefix", m_prefix.value("delay"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +49,8 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
|
|||||||
m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool();
|
m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool();
|
||||||
QString display = settings.value(prefix + "displayhas", "cross").toString();
|
QString display = settings.value(prefix + "displayhas", "cross").toString();
|
||||||
display == "cross"? m_display = Cross : m_display = Contacts;
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
|
m_prefix.insert("power", settings.value(prefix + "powerprefix").toString());
|
||||||
|
m_prefix.insert("delay", settings.value(prefix + "delayprefix").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,6 +62,8 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
|
|||||||
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "fasle");
|
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "fasle");
|
||||||
QString display = m_display == Cross? "cross" : "contacts";
|
QString display = m_display == Cross? "cross" : "contacts";
|
||||||
xml_element.setAttribute("displayhas", display);
|
xml_element.setAttribute("displayhas", display);
|
||||||
|
xml_element.setAttribute("powerprefix", m_prefix.value("power"));
|
||||||
|
xml_element.setAttribute("delayprefix", m_prefix.value("delay"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,11 +75,14 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
|
|||||||
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
|
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
|
||||||
QString display = xml_element.attribute("displayhas", "cross");
|
QString display = xml_element.attribute("displayhas", "cross");
|
||||||
display == "cross"? m_display = Cross : m_display = Contacts;
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
|
m_prefix.insert("power", xml_element.attribute("powerprefix"));
|
||||||
|
m_prefix.insert("delay", xml_element.attribute("delayprefix"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
||||||
return (m_show_power_ctc == xrp.m_show_power_ctc &&
|
return (m_show_power_ctc == xrp.m_show_power_ctc &&
|
||||||
m_display == xrp.m_display);
|
m_display == xrp.m_display &&
|
||||||
|
m_prefix == xrp.m_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
|
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
|
||||||
|
|||||||
@@ -48,9 +48,13 @@ class XRefProperties : public PropertiesInterface
|
|||||||
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
||||||
DisplayHas displayHas () const {return m_display;}
|
DisplayHas displayHas () const {return m_display;}
|
||||||
|
|
||||||
|
void setPrefix (const QString &key, const QString &value) {m_prefix.insert(key, value);}
|
||||||
|
QString prefix (const QString &key) const {return m_prefix.value(key);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_show_power_ctc;
|
bool m_show_power_ctc;
|
||||||
DisplayHas m_display;
|
DisplayHas m_display;
|
||||||
|
QHash <QString, QString> m_prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XREFPROPERTIES_H
|
#endif // XREFPROPERTIES_H
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
//define the height of the header.
|
//define the height of the header.
|
||||||
#define header 5
|
#define header 5
|
||||||
//define the widht of the cross
|
|
||||||
#define crossWidth 50
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CrossRefItem::CrossRefItem
|
* @brief CrossRefItem::CrossRefItem
|
||||||
@@ -71,7 +69,25 @@ QPainterPath CrossRefItem::shape() const{
|
|||||||
return m_shape_path;
|
return m_shape_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrossRefItem::setProperties(XRefProperties xrp) {
|
/**
|
||||||
|
* @brief CrossRefItem::elementPositionText
|
||||||
|
* @param elmt
|
||||||
|
* @return the string corresponding to the position of @elmt in the diagram.
|
||||||
|
* if @add_prefix is true, prefix (for power and delay contact) is added to the poistion text.
|
||||||
|
*/
|
||||||
|
QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_prefix) const{
|
||||||
|
QString txt;
|
||||||
|
txt += QString::number(elmt->diagram()->folioIndex() + 1);
|
||||||
|
txt += "-";
|
||||||
|
txt += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
||||||
|
if (add_prefix) {
|
||||||
|
if (elmt->kindInformations()["type"].toString() == "power") txt.prepend(m_properties.prefix("power"));
|
||||||
|
else if (elmt->kindInformations()["type"].toString().contains("delay")) txt.prepend(m_properties.prefix("delay"));
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrossRefItem::setProperties(const XRefProperties &xrp) {
|
||||||
if (m_properties != xrp) {
|
if (m_properties != xrp) {
|
||||||
m_properties = xrp;
|
m_properties = xrp;
|
||||||
updateLabel();
|
updateLabel();
|
||||||
@@ -128,7 +144,8 @@ void CrossRefItem::autoPos() {
|
|||||||
point.setY(border.height() - m_element->diagram()->border_and_titleblock.titleBlockHeight() - boundingRect().height());
|
point.setY(border.height() - m_element->diagram()->border_and_titleblock.titleBlockHeight() - boundingRect().height());
|
||||||
}
|
}
|
||||||
|
|
||||||
point.setX(point.x() - crossWidth/2);
|
qreal offset = m_bounding_rect.topLeft().x() < 0 ? m_bounding_rect.topLeft().x() : 0;
|
||||||
|
point.setX(point.x() - m_bounding_rect.width()/2 - offset);
|
||||||
setPos(point);
|
setPos(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +194,52 @@ void CrossRefItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
QGraphicsObject::mouseReleaseEvent(e);
|
QGraphicsObject::mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CrossRefItem::buildHeaderContact
|
||||||
|
* Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc
|
||||||
|
*/
|
||||||
|
void CrossRefItem::buildHeaderContact() {
|
||||||
|
if (!m_hdr_no_ctc.isNull() && !m_hdr_nc_ctc.isNull()) return;
|
||||||
|
|
||||||
|
//init the painter
|
||||||
|
QPainter qp;
|
||||||
|
QPen pen_;
|
||||||
|
pen_.setWidthF(0.2);
|
||||||
|
|
||||||
|
//draw the NO contact
|
||||||
|
if (m_hdr_no_ctc.isNull()) {
|
||||||
|
qp.begin(&m_hdr_no_ctc);
|
||||||
|
qp.setPen(pen_);
|
||||||
|
qp.drawLine(0, 3, 5, 3);
|
||||||
|
QPointF p1[3] = {
|
||||||
|
QPointF(5, 0),
|
||||||
|
QPointF(10, 3),
|
||||||
|
QPointF(15, 3),
|
||||||
|
};
|
||||||
|
qp.drawPolyline(p1,3);
|
||||||
|
qp.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
//draw the NC contact
|
||||||
|
if (m_hdr_nc_ctc.isNull()) {
|
||||||
|
qp.begin(&m_hdr_nc_ctc);
|
||||||
|
qp.setPen(pen_);
|
||||||
|
QPointF p2[3] = {
|
||||||
|
QPointF(0, 3),
|
||||||
|
QPointF(5, 3),
|
||||||
|
QPointF(5, 0)
|
||||||
|
};
|
||||||
|
qp.drawPolyline(p2,3);
|
||||||
|
QPointF p3[3] = {
|
||||||
|
QPointF(4, 0),
|
||||||
|
QPointF(10, 3),
|
||||||
|
QPointF(15, 3),
|
||||||
|
};
|
||||||
|
qp.drawPolyline(p3,3);
|
||||||
|
qp.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CrossRefItem::setUpCrossBoundingRect
|
* @brief CrossRefItem::setUpCrossBoundingRect
|
||||||
* Get the numbers of slaves elements linked to this parent element,
|
* Get the numbers of slaves elements linked to this parent element,
|
||||||
@@ -185,31 +248,56 @@ void CrossRefItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
*/
|
*/
|
||||||
void CrossRefItem::setUpCrossBoundingRect() {
|
void CrossRefItem::setUpCrossBoundingRect() {
|
||||||
//this is the default size of cross ref item
|
//this is the default size of cross ref item
|
||||||
QRectF default_bounding(0, 0, crossWidth, 40);
|
//add 2 to header for better visual
|
||||||
|
QRectF default_bounding(0, 0, 40, header+2);
|
||||||
|
|
||||||
//No need to calcul if nothing is linked
|
//No need to calcul if nothing is linked
|
||||||
if (!m_element->isFree()) {
|
if (!m_element->isFree()) {
|
||||||
|
/*Set up a Qpainter with the same parametres
|
||||||
|
than the QPainter used for draw the text inside the cross,
|
||||||
|
for calculate the size of each text
|
||||||
|
=====
|
||||||
|
We can also use the QPainter used for draw the text inside the cross
|
||||||
|
and call the method "boundingrect", for know the size of text,
|
||||||
|
but the QrectF returned isn't good (bug)*/
|
||||||
|
QPainter qp;
|
||||||
|
QPicture pict;
|
||||||
|
qp.begin(&pict);
|
||||||
|
QPen pen_;
|
||||||
|
pen_.setWidthF(0.2);
|
||||||
|
qp.setPen(pen_);
|
||||||
|
qp.setFont(QETApp::diagramTextsFont(5));
|
||||||
|
|
||||||
QList <Element *> NO_list;
|
QList <Element *> NO_list;
|
||||||
QList <Element *> NC_list;
|
QList <Element *> NC_list;
|
||||||
|
|
||||||
//find each no and nc of connected element to m_element
|
//find each no and nc of connected element to m_element
|
||||||
|
//and define the size of default_bounding according to the connected elements
|
||||||
|
bool was_ajusted = false;
|
||||||
|
qreal no_height = 0, nc_height = 0;
|
||||||
foreach (Element *elmt, m_element->linkedElements()) {
|
foreach (Element *elmt, m_element->linkedElements()) {
|
||||||
|
QRectF r;
|
||||||
|
qp.drawText(r, Qt::AlignCenter, elementPositionText(elmt, true), &r);
|
||||||
|
if (r.width() > default_bounding.width()/2) {
|
||||||
|
default_bounding.setWidth(r.width()*2);
|
||||||
|
was_ajusted = true;
|
||||||
|
}
|
||||||
|
|
||||||
QString state = elmt->kindInformations()["state"].toString();
|
QString state = elmt->kindInformations()["state"].toString();
|
||||||
if (state == "NO") NO_list << elmt;
|
if (state == "NO") {
|
||||||
else if (state == "NC") NC_list << elmt;
|
NO_list << elmt;
|
||||||
|
no_height += r.height();
|
||||||
}
|
}
|
||||||
|
else if (state == "NC") {
|
||||||
int i =0;
|
NC_list << elmt;
|
||||||
if (NO_list.count()>4 || NC_list.count()>4) {
|
nc_height += r.height();
|
||||||
i = NO_list.count() > NC_list.count()?
|
|
||||||
NO_list.count() : NC_list.count();
|
|
||||||
|
|
||||||
//increase the height of bounding rect,
|
|
||||||
//according to the number of slave item less 4.
|
|
||||||
i-=4;
|
|
||||||
default_bounding.setHeight(default_bounding.height() + (i*8));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (was_ajusted) default_bounding.setWidth (default_bounding.width()+5); //adjust only for better visual
|
||||||
|
no_height > nc_height? default_bounding.setHeight (default_bounding.height() + no_height) :
|
||||||
|
default_bounding.setHeight (default_bounding.height() + nc_height);
|
||||||
|
qp.end();
|
||||||
|
}
|
||||||
m_shape_path.addRect(default_bounding);
|
m_shape_path.addRect(default_bounding);
|
||||||
m_bounding_rect = default_bounding;
|
m_bounding_rect = default_bounding;
|
||||||
}
|
}
|
||||||
@@ -226,41 +314,14 @@ void CrossRefItem::drawHasCross(QPainter &painter) {
|
|||||||
//draw the cross
|
//draw the cross
|
||||||
QRectF br = boundingRect();
|
QRectF br = boundingRect();
|
||||||
painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
|
painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
|
||||||
painter.drawLine(br.width()/2-(crossWidth/2), header, br.width()/2+(crossWidth/2), header); //horizontal line
|
painter.drawLine(0, header, br.width(), header); //horizontal line
|
||||||
|
|
||||||
//draw the symbolic NO
|
//Add the symbolic contacts
|
||||||
qreal xoffset = br.width()/2 - 25;
|
buildHeaderContact();
|
||||||
painter.drawLine(xoffset+5, 3, xoffset+10, 3);
|
QPointF p((m_bounding_rect.width()/4) - (m_hdr_no_ctc.width()/2), 0);
|
||||||
QPointF p1[3] = {
|
painter.drawPicture (p, m_hdr_no_ctc);
|
||||||
QPointF(xoffset+10, 0),
|
p.setX((m_bounding_rect.width() * 3/4) - (m_hdr_nc_ctc.width()/2));
|
||||||
QPointF(xoffset+15, 3),
|
painter.drawPicture (p, m_hdr_nc_ctc);
|
||||||
QPointF(xoffset+20, 3),
|
|
||||||
};
|
|
||||||
painter.drawPolyline(p1,3);
|
|
||||||
|
|
||||||
//draw the symbolic NC
|
|
||||||
xoffset = br.width()/2;
|
|
||||||
QPointF p2[3] = {
|
|
||||||
QPointF(xoffset+5, 3),
|
|
||||||
QPointF(xoffset+10, 3),
|
|
||||||
QPointF(xoffset+10, 0)
|
|
||||||
};
|
|
||||||
painter.drawPolyline(p2,3);
|
|
||||||
QPointF p3[3] = {
|
|
||||||
QPointF(xoffset+9, 0),
|
|
||||||
QPointF(xoffset+15, 3),
|
|
||||||
QPointF(xoffset+20, 3),
|
|
||||||
};
|
|
||||||
painter.drawPolyline(p3,3);
|
|
||||||
|
|
||||||
///keep this code for possible next feature
|
|
||||||
///choice to use symbolic or text.
|
|
||||||
//draw the header
|
|
||||||
/*qp.setFont(QETApp::diagramTextsFont(7));
|
|
||||||
QRectF header_rect (0,0,30,10);
|
|
||||||
qp.drawText(header_rect, Qt::AlignCenter, "NO");
|
|
||||||
header_rect.setRect(30, 0, 30, 10);
|
|
||||||
qp.drawText(header_rect, Qt::AlignCenter, "NC");*/
|
|
||||||
|
|
||||||
//and fill it
|
//and fill it
|
||||||
fillCrossRef(painter);
|
fillCrossRef(painter);
|
||||||
@@ -294,15 +355,11 @@ void CrossRefItem::drawHasContacts(QPainter &painter) {
|
|||||||
else if (type == "delayOn") option += DelayOn;
|
else if (type == "delayOn") option += DelayOn;
|
||||||
else if (type == "delayOff") option += DelayOff;
|
else if (type == "delayOff") option += DelayOff;
|
||||||
|
|
||||||
QString contact_str;
|
drawContact(painter, option, elementPositionText(elmt));
|
||||||
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
|
||||||
contact_str += "-";
|
|
||||||
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
|
||||||
drawContact(painter, option, contact_str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF br(0,0,crossWidth, m_drawed_contacts*10+4);
|
QRectF br(0, 0, 50, m_drawed_contacts*10+4);
|
||||||
m_bounding_rect = br;
|
m_bounding_rect = br;
|
||||||
m_shape_path.addRect(br);
|
m_shape_path.addRect(br);
|
||||||
painter.restore();
|
painter.restore();
|
||||||
@@ -416,30 +473,27 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
|
|||||||
//fill the NO
|
//fill the NO
|
||||||
foreach (Element *elmt, NO_list) {
|
foreach (Element *elmt, NO_list) {
|
||||||
++i;
|
++i;
|
||||||
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
contact_str += elementPositionText(elmt, true);
|
||||||
contact_str += "-";
|
|
||||||
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
|
||||||
if(NO_list.size() > i) contact_str += "\n";
|
if(NO_list.size() > i) contact_str += "\n";
|
||||||
}
|
}
|
||||||
QRectF rect_(middle_cross - (crossWidth/2),
|
QRectF rect_(0,
|
||||||
header,
|
header,
|
||||||
middle_cross,
|
middle_cross,
|
||||||
(m_bounding_rect.height()-header));
|
m_bounding_rect.height()-header);
|
||||||
painter.drawText(rect_, Qt::AlignTop | Qt::AlignLeft, contact_str);
|
painter.drawText(rect_, Qt::AlignTop | Qt::AlignLeft, contact_str);
|
||||||
|
|
||||||
//fill the NC
|
//fill the NC
|
||||||
contact_str.clear();
|
contact_str.clear();
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach (Element *elmt, NC_list) {
|
foreach (Element *elmt, NC_list) {
|
||||||
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
++i;
|
||||||
contact_str += "-";
|
contact_str += elementPositionText(elmt, true);
|
||||||
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
|
||||||
if (NC_list.size() > i) contact_str += "\n";
|
if (NC_list.size() > i) contact_str += "\n";
|
||||||
}
|
}
|
||||||
rect_.setRect(middle_cross,
|
rect_.setRect(middle_cross,
|
||||||
header,
|
header,
|
||||||
crossWidth/2,
|
middle_cross,
|
||||||
(m_bounding_rect.height()-header));
|
m_bounding_rect.height()-header);
|
||||||
painter.drawText(rect_, Qt::AlignTop | Qt::AlignRight, contact_str);
|
painter.drawText(rect_, Qt::AlignTop | Qt::AlignRight, contact_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +529,6 @@ void CrossRefItem::AddExtraInfo(QPainter &painter) {
|
|||||||
* must to be show or not
|
* must to be show or not
|
||||||
*/
|
*/
|
||||||
void CrossRefItem::checkMustShow() {
|
void CrossRefItem::checkMustShow() {
|
||||||
|
|
||||||
//We always show Xref when is displayed has contact
|
//We always show Xref when is displayed has contact
|
||||||
if (m_properties.displayHas() == XRefProperties::Contacts) {
|
if (m_properties.displayHas() == XRefProperties::Contacts) {
|
||||||
this->show();
|
this->show();
|
||||||
|
|||||||
@@ -52,11 +52,12 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
|
|
||||||
QRectF boundingRect () const;
|
QRectF boundingRect () const;
|
||||||
virtual QPainterPath shape () const;
|
virtual QPainterPath shape () const;
|
||||||
|
QString elementPositionText (const Element *elmt, const bool &add_prefix = false) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setProperties (XRefProperties xrp);
|
void setProperties (const XRefProperties &xrp);
|
||||||
void updateLabel ();
|
void updateLabel ();
|
||||||
void autoPos ();
|
void autoPos ();
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *e);
|
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void buildHeaderContact ();
|
||||||
void setUpCrossBoundingRect ();
|
void setUpCrossBoundingRect ();
|
||||||
void drawHasCross (QPainter &painter);
|
void drawHasCross (QPainter &painter);
|
||||||
void drawHasContacts (QPainter &painter);
|
void drawHasContacts (QPainter &painter);
|
||||||
@@ -78,7 +80,7 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
private:
|
private:
|
||||||
Element *m_element; //element to display the cross reference
|
Element *m_element; //element to display the cross reference
|
||||||
QRectF m_bounding_rect;
|
QRectF m_bounding_rect;
|
||||||
QPicture m_drawing;
|
QPicture m_drawing, m_hdr_no_ctc, m_hdr_nc_ctc;
|
||||||
QPainterPath m_shape_path;
|
QPainterPath m_shape_path;
|
||||||
XRefProperties m_properties;
|
XRefProperties m_properties;
|
||||||
int m_drawed_contacts;
|
int m_drawed_contacts;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(XRefProperties properties, QWidget *p
|
|||||||
m_properties(properties)
|
m_properties(properties)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_show_power_cb, SLOT(setEnabled(bool)));
|
connect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_cross_properties_gb, SLOT(setEnabled(bool)));
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(XRefProperties properties, QWidget *p
|
|||||||
*/
|
*/
|
||||||
XRefPropertiesWidget::~XRefPropertiesWidget()
|
XRefPropertiesWidget::~XRefPropertiesWidget()
|
||||||
{
|
{
|
||||||
disconnect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_show_power_cb, SLOT(setEnabled(bool)));
|
disconnect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_cross_properties_gb, SLOT(setEnabled(bool)));
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +63,8 @@ XRefProperties XRefPropertiesWidget::properties() {
|
|||||||
if (ui->m_display_has_cross_rb->isChecked()) m_properties.setDisplayHas(XRefProperties::Cross);
|
if (ui->m_display_has_cross_rb->isChecked()) m_properties.setDisplayHas(XRefProperties::Cross);
|
||||||
else if (ui->m_display_has_contacts_rb->isChecked()) m_properties.setDisplayHas(XRefProperties::Contacts);
|
else if (ui->m_display_has_contacts_rb->isChecked()) m_properties.setDisplayHas(XRefProperties::Contacts);
|
||||||
m_properties.setShowPowerContac(ui->m_show_power_cb->isChecked());
|
m_properties.setShowPowerContac(ui->m_show_power_cb->isChecked());
|
||||||
|
m_properties.setPrefix("power", ui->m_power_prefix_le->text());
|
||||||
|
m_properties.setPrefix("delay", ui->m_delay_prefix_le->text());
|
||||||
|
|
||||||
return m_properties;
|
return m_properties;
|
||||||
}
|
}
|
||||||
@@ -77,9 +79,9 @@ void XRefPropertiesWidget::setReadOnly(bool ro) {
|
|||||||
ui->m_display_has_contacts_rb->setDisabled(ro);
|
ui->m_display_has_contacts_rb->setDisabled(ro);
|
||||||
|
|
||||||
if (m_properties.displayHas() != XRefProperties::Cross)
|
if (m_properties.displayHas() != XRefProperties::Cross)
|
||||||
ui->m_show_power_cb->setDisabled(true);
|
ui->m_cross_properties_gb->setDisabled(true);
|
||||||
else
|
else
|
||||||
ui->m_show_power_cb->setDisabled(ro);
|
ui->m_cross_properties_gb->setDisabled(ro);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,5 +98,7 @@ void XRefPropertiesWidget::updateDisplay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->m_show_power_cb->setChecked(m_properties.showPowerContact());
|
ui->m_show_power_cb->setChecked(m_properties.showPowerContact());
|
||||||
ui->m_show_power_cb->setDisabled(!ui->m_display_has_cross_rb->isChecked());
|
ui->m_power_prefix_le->setText(m_properties.prefix("power"));
|
||||||
|
ui->m_delay_prefix_le->setText(m_properties.prefix("delay"));
|
||||||
|
ui->m_cross_properties_gb->setDisabled(!ui->m_display_has_cross_rb->isChecked());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,12 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="m_cross_properties_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string>Option d'affichage en croix</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="m_show_power_cb">
|
<widget class="QCheckBox" name="m_show_power_cb">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -48,6 +54,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="m_delay_prefix_le"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="m_power_prefix_le"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Préfixe des contacts de puissance:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Préfixe des contacts temporisés:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -56,13 +86,16 @@
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>253</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user