mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
folio report can only be linked to inverted folio report
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2694 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<definition width="40" version="0.3" hotspot_x="18" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
<definition width="40" version="0.3" hotspot_x="18" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
||||||
link_type="folio_report">
|
link_type="next_report">
|
||||||
<names>
|
<names>
|
||||||
<name lang="ar">الصفحة التالية</name>
|
<name lang="ar">الصفحة التالية</name>
|
||||||
<name lang="de">Nächste Seite</name>
|
<name lang="de">Nächste Seite</name>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<definition width="70" version="0.3" hotspot_x="49" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
<definition width="70" version="0.3" hotspot_x="49" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
||||||
link_type="folio_report">
|
link_type="previous_report">
|
||||||
<names>
|
<names>
|
||||||
<name lang="ar">الصفحة السابقة</name>
|
<name lang="ar">الصفحة السابقة</name>
|
||||||
<name lang="de">Vorherige Seite</name>
|
<name lang="de">Vorherige Seite</name>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Element * ElementFactory::createElement(const ElementsLocation &location, QGraph
|
|||||||
|
|
||||||
if (element_definition->xml().hasAttribute("link_type")) {
|
if (element_definition->xml().hasAttribute("link_type")) {
|
||||||
QString link_type = element_definition->xml().attribute("link_type");
|
QString link_type = element_definition->xml().attribute("link_type");
|
||||||
if (link_type == "folio_report") return (new ReportElement(location, qgi, s, state));
|
if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
|
||||||
}
|
}
|
||||||
//default if nothing match for link_type
|
//default if nothing match for link_type
|
||||||
return (new SimpleElement(location, qgi, s, state));
|
return (new SimpleElement(location, qgi, s, state));
|
||||||
|
|||||||
@@ -1382,7 +1382,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(QList <Terminal *> *t_li
|
|||||||
*/
|
*/
|
||||||
Terminal * Conductor::relatedPotentialTerminal (Terminal *t) {
|
Terminal * Conductor::relatedPotentialTerminal (Terminal *t) {
|
||||||
//terminal must have a folio report parent.
|
//terminal must have a folio report parent.
|
||||||
if (t->parentElement()->linkType() & Element::Report) {
|
if (t->parentElement()->linkType() & Element::AllReport) {
|
||||||
QList <Element *> elmt_list = t->parentElement()->linkedElements();
|
QList <Element *> elmt_list = t->parentElement()->linkedElements();
|
||||||
if (!elmt_list.isEmpty()) {
|
if (!elmt_list.isEmpty()) {
|
||||||
return (elmt_list.first()->terminals().first());
|
return (elmt_list.first()->terminals().first());
|
||||||
|
|||||||
@@ -46,12 +46,14 @@ class Element : public QetGraphicsItem {
|
|||||||
// this enum is use to know the kind of element and
|
// this enum is use to know the kind of element and
|
||||||
// to use flag for element provider class
|
// to use flag for element provider class
|
||||||
enum {Simple = 1,
|
enum {Simple = 1,
|
||||||
Report = 2,
|
NextReport = 2,
|
||||||
Master = 4,
|
PreviousReport = 4,
|
||||||
SlaveNO = 8,
|
AllReport = 6,
|
||||||
SlaveNC = 16,
|
Master = 8,
|
||||||
AllSlave = 24,
|
SlaveNO = 16,
|
||||||
Bornier = 32};
|
SlaveNC = 32,
|
||||||
|
AllSlave = 48,
|
||||||
|
Bornier = 64};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList <Element *> connected_elements;
|
QList <Element *> connected_elements;
|
||||||
|
|||||||
@@ -20,10 +20,12 @@
|
|||||||
#include "diagramposition.h"
|
#include "diagramposition.h"
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
|
|
||||||
ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
|
ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, Diagram *s, int *state) :
|
||||||
CustomElement(location, qgi, s, state)
|
CustomElement(location, qgi, s, state)
|
||||||
{
|
{
|
||||||
texts().at(0)->setNoEditable();
|
texts().at(0)->setNoEditable();
|
||||||
|
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
|
||||||
|
link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportElement::~ReportElement() {
|
ReportElement::~ReportElement() {
|
||||||
@@ -43,8 +45,8 @@ void ReportElement::linkToElement(Element * elmt) {
|
|||||||
if (connected_elements.first() == elmt) i = false;
|
if (connected_elements.first() == elmt) i = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ensure elmt is a report
|
//ensure elmt is a inverse report of this element
|
||||||
if (elmt->linkType() == Report && i) {
|
if ((elmt->linkType() == inverse_report) && i) {
|
||||||
unlinkAllElements();
|
unlinkAllElements();
|
||||||
connected_elements << elmt;
|
connected_elements << elmt;
|
||||||
connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
|
connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
|
||||||
@@ -81,7 +83,7 @@ void ReportElement::unlinkAllElements(){
|
|||||||
* @return the kind of link type
|
* @return the kind of link type
|
||||||
*/
|
*/
|
||||||
int ReportElement::linkType() const {
|
int ReportElement::linkType() const {
|
||||||
return Report;
|
return link_type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,13 +30,15 @@ class ReportElement : public CustomElement {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public :
|
public :
|
||||||
explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
|
||||||
~ReportElement();
|
~ReportElement();
|
||||||
virtual void linkToElement(Element *);
|
virtual void linkToElement(Element *);
|
||||||
virtual void unlinkAllElements();
|
virtual void unlinkAllElements();
|
||||||
virtual int linkType() const;
|
virtual int linkType() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int link_type_;
|
||||||
|
int inverse_report;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,11 @@ void elementpropertieswidget::buildInterface() {
|
|||||||
switch (element_ -> linkType()) {
|
switch (element_ -> linkType()) {
|
||||||
case Element::Simple:
|
case Element::Simple:
|
||||||
break;
|
break;
|
||||||
case Element::Report:
|
case Element::NextReport:
|
||||||
|
frp_ = new FolioReportProperties(element_, this);
|
||||||
|
tab_ -> addTab(frp_, tr("Report de folio"));
|
||||||
|
break;
|
||||||
|
case Element::PreviousReport:
|
||||||
frp_ = new FolioReportProperties(element_, this);
|
frp_ = new FolioReportProperties(element_, this);
|
||||||
tab_ -> addTab(frp_, tr("Report de folio"));
|
tab_ -> addTab(frp_, tr("Report de folio"));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -36,8 +36,10 @@ FolioReportProperties::~FolioReportProperties()
|
|||||||
* @brief FolioReportProperties::BuildRadioList : build the radio list for each available folio report
|
* @brief FolioReportProperties::BuildRadioList : build the radio list for each available folio report
|
||||||
*/
|
*/
|
||||||
void FolioReportProperties::BuildRadioList() {
|
void FolioReportProperties::BuildRadioList() {
|
||||||
|
//Research the invert report of @element_
|
||||||
|
int rep = element_->linkType() == Element::NextReport? Element::PreviousReport : Element::NextReport;
|
||||||
ElementProvider ep(element_->diagram()->project(), element_->diagram());
|
ElementProvider ep(element_->diagram()->project(), element_->diagram());
|
||||||
QList <Element *> elmt_list = ep.freeElement(Element::Report);
|
QList <Element *> elmt_list = ep.freeElement(rep);
|
||||||
|
|
||||||
foreach (Element *elmt, elmt_list) {
|
foreach (Element *elmt, elmt_list) {
|
||||||
if (elmt != element_) {
|
if (elmt != element_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user