mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Cross ref item: user can select if xref must be displayed has a table or a contacts list.
Option is found in config dialog under the tab Cross ref. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3033 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -288,7 +288,7 @@ void ProjectNewDiagramConfigPage::initWidgets() {
|
|||||||
conductor_ = new ConductorPropertiesWidget();
|
conductor_ = new ConductorPropertiesWidget();
|
||||||
conductor_ -> setContentsMargins(0, 0, 0, 0);
|
conductor_ -> setContentsMargins(0, 0, 0, 0);
|
||||||
report_ = new ReportPropertieWidget("_");
|
report_ = new ReportPropertieWidget("_");
|
||||||
xref_ = new XRefPropertiesWidget();
|
xref_ = new XRefPropertiesWidget(XRefProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ XRefProperties::XRefProperties()
|
|||||||
*/
|
*/
|
||||||
void XRefProperties::toSettings(QSettings &settings, const QString prefix) const {
|
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";
|
||||||
|
settings.setValue(prefix + "displayhas", display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +45,8 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const
|
|||||||
*/
|
*/
|
||||||
void XRefProperties::fromSettings(const QSettings &settings, const QString prefix) {
|
void XRefProperties::fromSettings(const QSettings &settings, const QString prefix) {
|
||||||
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();
|
||||||
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +56,8 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
|
|||||||
*/
|
*/
|
||||||
void XRefProperties::toXml(QDomElement &xml_element) const {
|
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";
|
||||||
|
xml_element.setAttribute("displayhas", display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,10 +67,13 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
|
|||||||
*/
|
*/
|
||||||
void XRefProperties::fromXml(const QDomElement &xml_element) {
|
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");
|
||||||
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
|
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ class XRefProperties : public PropertiesInterface
|
|||||||
public:
|
public:
|
||||||
XRefProperties();
|
XRefProperties();
|
||||||
|
|
||||||
|
enum DisplayHas {
|
||||||
|
Cross,
|
||||||
|
Contacts
|
||||||
|
};
|
||||||
|
|
||||||
virtual void toSettings (QSettings &settings, const QString = QString()) const;
|
virtual void toSettings (QSettings &settings, const QString = QString()) const;
|
||||||
virtual void fromSettings (const QSettings &settings, const QString = QString());
|
virtual void fromSettings (const QSettings &settings, const QString = QString());
|
||||||
virtual void toXml (QDomElement &xml_element) const;
|
virtual void toXml (QDomElement &xml_element) const;
|
||||||
@@ -40,8 +45,12 @@ class XRefProperties : public PropertiesInterface
|
|||||||
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
|
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
|
||||||
bool showPowerContact () const {return m_show_power_ctc;}
|
bool showPowerContact () const {return m_show_power_ctc;}
|
||||||
|
|
||||||
|
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
||||||
|
DisplayHas displayHas () const {return m_display;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_show_power_ctc;
|
bool m_show_power_ctc;
|
||||||
|
DisplayHas m_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XREFPROPERTIES_H
|
#endif // XREFPROPERTIES_H
|
||||||
|
|||||||
@@ -84,50 +84,14 @@ void CrossRefItem::updateLabel() {
|
|||||||
pen_.setWidthF(0.2);
|
pen_.setWidthF(0.2);
|
||||||
qp.setPen(pen_);
|
qp.setPen(pen_);
|
||||||
|
|
||||||
//calcul the size of the cross
|
XRefProperties::DisplayHas dh = m_properties.displayHas();
|
||||||
setUpCrossBoundingRect();
|
if (dh == XRefProperties::Cross) {
|
||||||
|
drawHasCross(qp);
|
||||||
|
}
|
||||||
|
else if (dh == XRefProperties::Contacts) {
|
||||||
|
drawHasContacts(qp);
|
||||||
|
}
|
||||||
|
|
||||||
//draw the cross
|
|
||||||
QRectF br = boundingRect();
|
|
||||||
qp.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line
|
|
||||||
qp.drawLine(br.width()/2-(crossWidth/2), header, br.width()/2+(crossWidth/2), header); //horizontal line
|
|
||||||
|
|
||||||
//draw the symbolic NO
|
|
||||||
qreal xoffset = br.width()/2 - 25;
|
|
||||||
qp.drawLine(xoffset+5, 3, xoffset+10, 3);
|
|
||||||
QPointF p1[3] = {
|
|
||||||
QPointF(xoffset+10, 0),
|
|
||||||
QPointF(xoffset+15, 3),
|
|
||||||
QPointF(xoffset+20, 3),
|
|
||||||
};
|
|
||||||
qp.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)
|
|
||||||
};
|
|
||||||
qp.drawPolyline(p2,3);
|
|
||||||
QPointF p3[3] = {
|
|
||||||
QPointF(xoffset+9, 0),
|
|
||||||
QPointF(xoffset+15, 3),
|
|
||||||
QPointF(xoffset+20, 3),
|
|
||||||
};
|
|
||||||
qp.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
|
|
||||||
fillCrossRef(qp);
|
|
||||||
AddExtraInfo(qp);
|
AddExtraInfo(qp);
|
||||||
qp.end();
|
qp.end();
|
||||||
|
|
||||||
@@ -241,6 +205,181 @@ void CrossRefItem::setUpCrossBoundingRect() {
|
|||||||
m_bounding_rect = default_bounding;
|
m_bounding_rect = default_bounding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CrossRefItem::drawHasCross
|
||||||
|
* Draw this crossref with a cross
|
||||||
|
* @param painter, painter to use
|
||||||
|
*/
|
||||||
|
void CrossRefItem::drawHasCross(QPainter &painter) {
|
||||||
|
//calcul the size of the cross
|
||||||
|
setUpCrossBoundingRect();
|
||||||
|
|
||||||
|
//draw the cross
|
||||||
|
QRectF br = boundingRect();
|
||||||
|
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
|
||||||
|
|
||||||
|
//draw the symbolic NO
|
||||||
|
qreal xoffset = br.width()/2 - 25;
|
||||||
|
painter.drawLine(xoffset+5, 3, xoffset+10, 3);
|
||||||
|
QPointF p1[3] = {
|
||||||
|
QPointF(xoffset+10, 0),
|
||||||
|
QPointF(xoffset+15, 3),
|
||||||
|
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
|
||||||
|
fillCrossRef(painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CrossRefItem::drawHasContacts
|
||||||
|
* Draw this crossref with symbolic contacts
|
||||||
|
* @param painter painter to use
|
||||||
|
*/
|
||||||
|
void CrossRefItem::drawHasContacts(QPainter &painter) {
|
||||||
|
m_drawed_contacts = 0;
|
||||||
|
|
||||||
|
painter.save();
|
||||||
|
QPen pen_;
|
||||||
|
pen_.setWidthF(0.3);
|
||||||
|
painter.setPen(pen_);
|
||||||
|
painter.setFont(QETApp::diagramTextsFont(5));
|
||||||
|
|
||||||
|
//Draw each linked contact
|
||||||
|
foreach (Element *elmt, m_element->linkedElements()) {
|
||||||
|
DiagramContext info = elmt->kindInformations();
|
||||||
|
|
||||||
|
for (int i=0; i<info["number"].toInt(); i++) {
|
||||||
|
int option = 0;
|
||||||
|
|
||||||
|
info["state"].toString() == "NO"? option = NO : option = NC;
|
||||||
|
|
||||||
|
QString type = info["type"].toString();
|
||||||
|
if (type == "power") option += Power;
|
||||||
|
else if (type == "delayOn") option += DelayOn;
|
||||||
|
else if (type == "delayOff") option += DelayOff;
|
||||||
|
|
||||||
|
QString contact_str;
|
||||||
|
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);
|
||||||
|
m_bounding_rect = br;
|
||||||
|
m_shape_path.addRect(br);
|
||||||
|
painter.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CrossRefItem::drawContact
|
||||||
|
* draw one contacte, the type of contact to draw is define in ctc.
|
||||||
|
* @param painter painter to use
|
||||||
|
* @param ctc option for draw the contact, see enum CONTACTS
|
||||||
|
*/
|
||||||
|
void CrossRefItem::drawContact(QPainter &painter, int flags, QString str) {
|
||||||
|
int offset = m_drawed_contacts*10;
|
||||||
|
|
||||||
|
//draw the basic line
|
||||||
|
painter.drawLine(0, offset+6, 8, offset+6);
|
||||||
|
painter.drawLine(16, offset+6, 24, offset+6);
|
||||||
|
|
||||||
|
///take exemple of this code for display the terminal text
|
||||||
|
/*QFont font = QETApp::diagramTextsFont(4);
|
||||||
|
font.setBold(true);
|
||||||
|
painter.setFont(font);
|
||||||
|
QRectF bt(0, offset, 24, 10);
|
||||||
|
int txt = 10 + m_drawed_contacts;
|
||||||
|
painter.drawText(bt, Qt::AlignLeft|Qt::AlignTop, QString::number(txt));
|
||||||
|
painter.drawText(bt, Qt::AlignRight|Qt::AlignTop, QString::number(txt));
|
||||||
|
painter.setFont(QETApp::diagramTextsFont(5));*/
|
||||||
|
|
||||||
|
//draw open contact
|
||||||
|
if (flags &NO) {
|
||||||
|
painter.drawLine(8, offset+9, 16, offset+6);
|
||||||
|
}
|
||||||
|
//draw close contact
|
||||||
|
if (flags &NC) {
|
||||||
|
QPointF p1[3] = {
|
||||||
|
QPointF(8, offset+6),
|
||||||
|
QPointF(9, offset+6),
|
||||||
|
QPointF(9, offset+2.5)
|
||||||
|
};
|
||||||
|
painter.drawPolyline(p1,3);
|
||||||
|
painter.drawLine(8, offset+3, 16, offset+6);
|
||||||
|
}
|
||||||
|
|
||||||
|
//draw half circle for power contact
|
||||||
|
if (flags &Power) {
|
||||||
|
QRectF arc(4, offset+4, 4, 4);
|
||||||
|
if (flags &NO)
|
||||||
|
painter.drawArc(arc, 180*16, 180*16);
|
||||||
|
else
|
||||||
|
painter.drawArc(arc, 0, 180*16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw half circle for delay contact
|
||||||
|
if(flags &DelayOn || flags &DelayOff) {
|
||||||
|
// for delay on contact
|
||||||
|
if (flags &DelayOn) {
|
||||||
|
if (flags &NO) {
|
||||||
|
painter.drawLine(12, offset+4, 12, offset+6);
|
||||||
|
QRectF r(9.5, offset+1, 5, 3);
|
||||||
|
painter.drawArc(r, 180*16, 180*16);
|
||||||
|
}
|
||||||
|
if (flags &NC) {
|
||||||
|
painter.drawLine(QPointF(13.5, offset+2), QPointF(13.5, offset+3.5));
|
||||||
|
QRectF r(11, offset-1, 5, 3);
|
||||||
|
painter.drawArc(r, 180*16, 180*16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// for delay off contact
|
||||||
|
else {
|
||||||
|
if (flags &NO) {
|
||||||
|
painter.drawLine(12, offset+3, 12, offset+6);
|
||||||
|
QRectF r(9.5, offset+2, 5, 3);
|
||||||
|
painter.drawArc(r, 0, 180*16);
|
||||||
|
}
|
||||||
|
if (flags &NC) {
|
||||||
|
painter.drawLine(QPointF(13.5, offset+1), QPointF(13.5, offset+3.5));
|
||||||
|
QRectF r(11, offset, 5, 3);
|
||||||
|
painter.drawArc(r, 0, 180*16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.drawText(20, offset, 30, 10, Qt::AlignRight | Qt::AlignVCenter, str);
|
||||||
|
++m_drawed_contacts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CrossRefItem::fillCrossRef
|
* @brief CrossRefItem::fillCrossRef
|
||||||
* Fill the content of the cross ref
|
* Fill the content of the cross ref
|
||||||
@@ -262,13 +401,16 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
|
|||||||
|
|
||||||
painter.setFont(QETApp::diagramTextsFont(5));
|
painter.setFont(QETApp::diagramTextsFont(5));
|
||||||
qreal middle_cross = m_bounding_rect.width()/2;
|
qreal middle_cross = m_bounding_rect.width()/2;
|
||||||
//fill the NO
|
|
||||||
QString contact_str;
|
QString contact_str;
|
||||||
|
int i =0;
|
||||||
|
//fill the NO
|
||||||
foreach (Element *elmt, NO_list) {
|
foreach (Element *elmt, NO_list) {
|
||||||
|
++i;
|
||||||
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
||||||
contact_str += "-";
|
contact_str += "-";
|
||||||
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
||||||
contact_str += "\n";
|
if(NO_list.size() > i) contact_str += "\n";
|
||||||
}
|
}
|
||||||
QRectF rect_(middle_cross - (crossWidth/2),
|
QRectF rect_(middle_cross - (crossWidth/2),
|
||||||
header,
|
header,
|
||||||
@@ -278,11 +420,12 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
|
|||||||
|
|
||||||
//fill the NC
|
//fill the NC
|
||||||
contact_str.clear();
|
contact_str.clear();
|
||||||
|
i = 0;
|
||||||
foreach (Element *elmt, NC_list) {
|
foreach (Element *elmt, NC_list) {
|
||||||
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
contact_str += QString::number(elmt->diagram()->folioIndex() + 1);
|
||||||
contact_str += "-";
|
contact_str += "-";
|
||||||
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
|
||||||
contact_str += "\n";
|
if (NC_list.size() > i) contact_str += "\n";
|
||||||
}
|
}
|
||||||
rect_.setRect(middle_cross,
|
rect_.setRect(middle_cross,
|
||||||
header,
|
header,
|
||||||
|
|||||||
@@ -42,6 +42,14 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
enum { Type = UserType + 1009 };
|
enum { Type = UserType + 1009 };
|
||||||
virtual int type() const { return Type; }
|
virtual int type() const { return Type; }
|
||||||
|
|
||||||
|
enum CONTACTS {
|
||||||
|
NO = 1,
|
||||||
|
NC = 2,
|
||||||
|
Power = 4,
|
||||||
|
DelayOn = 8,
|
||||||
|
DelayOff = 16
|
||||||
|
};
|
||||||
|
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
virtual QPainterPath shape() const;
|
virtual QPainterPath shape() const;
|
||||||
|
|
||||||
@@ -52,14 +60,17 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
void autoPos();
|
void autoPos();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
|
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *e);
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *e);
|
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUpCrossBoundingRect();
|
void setUpCrossBoundingRect();
|
||||||
void fillCrossRef(QPainter &painter);
|
void drawHasCross (QPainter &painter);
|
||||||
void AddExtraInfo(QPainter &painter);
|
void drawHasContacts (QPainter &painter);
|
||||||
|
void drawContact (QPainter &painter, int flags, QString str = QString());
|
||||||
|
void fillCrossRef (QPainter &painter);
|
||||||
|
void AddExtraInfo (QPainter &painter);
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
private:
|
private:
|
||||||
@@ -68,6 +79,7 @@ class CrossRefItem : public QGraphicsObject
|
|||||||
QPicture m_drawing;
|
QPicture m_drawing;
|
||||||
QPainterPath m_shape_path;
|
QPainterPath m_shape_path;
|
||||||
XRefProperties m_properties;
|
XRefProperties m_properties;
|
||||||
|
int m_drawed_contacts;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CROSSREFITEM_H
|
#endif // CROSSREFITEM_H
|
||||||
|
|||||||
@@ -31,6 +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)));
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +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)));
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +60,10 @@ void XRefPropertiesWidget::setProperties(const XRefProperties &properties) {
|
|||||||
* @return the propertie edited by this widget
|
* @return the propertie edited by this widget
|
||||||
*/
|
*/
|
||||||
XRefProperties XRefPropertiesWidget::properties() {
|
XRefProperties XRefPropertiesWidget::properties() {
|
||||||
m_properties.setShowPowerContac(ui->cb_show_power->isChecked());
|
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);
|
||||||
|
m_properties.setShowPowerContac(ui->m_show_power_cb->isChecked());
|
||||||
|
|
||||||
return m_properties;
|
return m_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +73,9 @@ XRefProperties XRefPropertiesWidget::properties() {
|
|||||||
* @param ro
|
* @param ro
|
||||||
*/
|
*/
|
||||||
void XRefPropertiesWidget::setReadOnly(bool ro) {
|
void XRefPropertiesWidget::setReadOnly(bool ro) {
|
||||||
ui->cb_show_power->setDisabled(ro);
|
ui->m_display_has_cross_rb->setDisabled(ro);
|
||||||
|
ui->m_display_has_contacts_rb->setDisabled(ro);
|
||||||
|
ui->m_show_power_cb->setDisabled(ro);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,5 +83,14 @@ void XRefPropertiesWidget::setReadOnly(bool ro) {
|
|||||||
* Update display with the content of the properties
|
* Update display with the content of the properties
|
||||||
*/
|
*/
|
||||||
void XRefPropertiesWidget::updateDisplay() {
|
void XRefPropertiesWidget::updateDisplay() {
|
||||||
ui->cb_show_power->setChecked(m_properties.showPowerContact());
|
XRefProperties::DisplayHas dh = m_properties.displayHas();
|
||||||
|
if (dh == XRefProperties::Cross) {
|
||||||
|
ui->m_display_has_cross_rb->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (dh == XRefProperties::Contacts) {
|
||||||
|
ui->m_display_has_contacts_rb->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->m_show_power_cb->setChecked(m_properties.showPowerContact());
|
||||||
|
ui->m_show_power_cb->setDisabled(!ui->m_display_has_cross_rb->isChecked());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,34 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cb_show_power">
|
<widget class="QGroupBox" name="m_display_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string>Représentation:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_display_has_cross_rb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Afficher en croix</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_display_has_contacts_rb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Afficher en contacts</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="m_show_power_cb">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Afficher les contacts de puissance dans la croix</string>
|
<string>Afficher les contacts de puissance dans la croix</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user