minor change

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3367 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun 2014-10-09 09:02:41 +00:00
parent b910992143
commit 0cd1a812f3
5 changed files with 33 additions and 32 deletions

View File

@ -66,7 +66,7 @@ DEPENDPATH += .
INCLUDEPATH += sources sources/editor sources/titleblock sources/ui sources/qetgraphicsitem sources/richtext sources/factory sources/properties sources/dvevent
# Fichiers sources
HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) $$files(sources/editor/*.h) $$files(sources/titleblock/*.h) $$files(sources/richtext/*.h) $$files(sources/qetgraphicsitem/*.h) $$files(sources/factory/*.cpp) \
HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) $$files(sources/editor/*.h) $$files(sources/titleblock/*.h) $$files(sources/richtext/*.h) $$files(sources/qetgraphicsitem/*.h) $$files(sources/factory/*.h) \
$$files(sources/properties/*.h) \
$$files(sources/editor/ui/*.h) \
$$files(sources/dvevent/*.h)

View File

@ -1441,36 +1441,6 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
return(other_conductors);
}
/**
* @brief Conductor::relatedPotentialTerminal
* Return terminal at the same potential from the same
* parent element of @t.
* For folio report, return the terminal of linked other report.
* For Terminal element, return the other terminal of terminal element.
* @param t terminal to start search
* @param all_diagram :if true return all related terminal,
* false return only terminal in the same diagram of @t
* @return
*/
Terminal * Conductor::relatedPotentialTerminal (Terminal *t, const bool all_diagram) {
// If terminal parent element is a folio report.
if (all_diagram && t->parentElement()->linkType() & Element::AllReport) {
QList <Element *> elmt_list = t->parentElement()->linkedElements();
if (!elmt_list.isEmpty()) {
return (elmt_list.first()->terminals().first());
}
}
// If terminal parent element is a Terminal element.
if (t->parentElement() -> linkType() & Element::Terminale) {
QList <Terminal *> terminals = t->parentElement()->terminals();
terminals.removeAll(t);
if (!terminals.isEmpty()) return terminals.first();
else return nullptr;
}
return nullptr;
}
/**
* @return l'editeur de schemas parent ou 0
*/

View File

@ -179,7 +179,6 @@ class Conductor : public QObject, public QGraphicsPathItem {
static qreal conductor_bound(qreal, qreal, bool);
static Qt::Corner movementType(const QPointF &, const QPointF &);
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
Terminal * relatedPotentialTerminal (Terminal *, const bool all_diagram = true);
};
Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false);

View File

@ -549,3 +549,33 @@ Element *Terminal::parentElement() const {
return(parent_element_);
}
/**
* @brief Conductor::relatedPotentialTerminal
* Return terminal at the same potential from the same
* parent element of @t.
* For folio report, return the terminal of linked other report.
* For Terminal element, return the other terminal of terminal element.
* @param t terminal to start search
* @param all_diagram :if true return all related terminal,
* false return only terminal in the same diagram of @t
* @return
*/
Terminal * relatedPotentialTerminal (const Terminal *terminal, const bool all_diagram) {
// If terminal parent element is a folio report.
if (all_diagram && terminal -> parentElement() -> linkType() & Element::AllReport) {
QList <Element *> elmt_list = terminal -> parentElement() -> linkedElements();
if (!elmt_list.isEmpty()) {
return (elmt_list.first() -> terminals().first());
}
}
// If terminal parent element is a Terminal element.
else if (terminal -> parentElement() -> linkType() & Element::Terminale) {
QList <Terminal *> terminals = terminal -> parentElement() -> terminals();
terminals.removeAll(const_cast<Terminal *> (terminal));
if (!terminals.isEmpty())
return terminals.first();
}
return nullptr;
}

View File

@ -160,4 +160,6 @@ inline QString Terminal::name() const {
return(name_terminal_);
}
Terminal * relatedPotentialTerminal (const Terminal *terminal, const bool all_diagram = true);
#endif