mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 02:10:52 +01:00
Multipaste : improve the conductor autonum, conductors are numerated from top to bottom, and left to right
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5340 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -249,10 +249,19 @@ QList<Terminal *> CustomElement::terminals() const {
|
||||
return(m_terminals);
|
||||
}
|
||||
|
||||
/// @return la liste des conducteurs rattaches a cet element
|
||||
QList<Conductor *> CustomElement::conductors() const {
|
||||
/**
|
||||
* @brief CustomElement::conductors
|
||||
* @return The list of conductor docked to this element
|
||||
* the list is sorted according to the position of the terminal where the conductor is docked
|
||||
* from top to bottom, and left to right.
|
||||
*/
|
||||
QList<Conductor *> CustomElement::conductors() const
|
||||
{
|
||||
QList<Conductor *> conductors;
|
||||
foreach(Terminal *t, m_terminals) conductors << t -> conductors();
|
||||
|
||||
for(Terminal *t : m_terminals)
|
||||
conductors << t -> conductors();
|
||||
|
||||
return(conductors);
|
||||
}
|
||||
|
||||
@@ -803,6 +812,16 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
|
||||
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
|
||||
new_terminal -> setZValue(420); // valeur arbitraire pour maintenir les bornes au-dessus des champs de texte
|
||||
m_terminals << new_terminal;
|
||||
|
||||
//Sort from top to bottom and left to rigth
|
||||
std::sort(m_terminals.begin(), m_terminals.end(), [](Terminal *a, Terminal *b)
|
||||
{
|
||||
if(a->dockConductor().y() == b->dockConductor().y())
|
||||
return (a->dockConductor().x() < b->dockConductor().x());
|
||||
else
|
||||
return (a->dockConductor().y() < b->dockConductor().y());
|
||||
});
|
||||
|
||||
return(new_terminal);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user