mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-22 21:59:59 +01:00
Revert r4900
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4902 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -280,13 +280,13 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
|
||||
) const {
|
||||
// construit le QHash qui sera retourne
|
||||
QHash<ConductorSegmentProfile *, qreal> segments_hash;
|
||||
for (ConductorSegmentProfile *csp: segments_list) {
|
||||
foreach(ConductorSegmentProfile *csp, segments_list) {
|
||||
segments_hash.insert(csp, csp -> length);
|
||||
}
|
||||
|
||||
// memorise le signe de la longueur de chaque segement
|
||||
QHash<ConductorSegmentProfile *, int> segments_signs;
|
||||
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
|
||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
|
||||
segments_signs.insert(csp, getSign(csp -> length));
|
||||
}
|
||||
|
||||
@@ -297,12 +297,12 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
|
||||
while (remaining_offset > precision || remaining_offset < -precision) {
|
||||
// recupere le nombre de segments differents ayant une longueur non nulle
|
||||
uint segments_count = 0;
|
||||
for (ConductorSegmentProfile *csp: segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
|
||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
|
||||
//qDebug() << " remaining_offset =" << remaining_offset;
|
||||
qreal local_offset = remaining_offset / segments_count;
|
||||
//qDebug() << " repartition d'un offset local de" << local_offset << "px sur" << segments_count << "segments";
|
||||
remaining_offset = 0.0;
|
||||
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
|
||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
|
||||
// ignore les segments de longueur nulle
|
||||
if (!segments_hash[csp]) continue;
|
||||
// applique l'offset au segment
|
||||
@@ -526,7 +526,7 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
qp -> setPen(final_conductor_pen);
|
||||
qp -> setBrush(junction_brush);
|
||||
qp -> setRenderHint(QPainter::Antialiasing, true);
|
||||
for (QPointF point: junctions_list) {
|
||||
foreach(QPointF point, junctions_list) {
|
||||
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
||||
}
|
||||
}
|
||||
@@ -764,7 +764,7 @@ QPainterPath Conductor::shape() const
|
||||
https://qelectrotech.org/forum/viewtopic.php?pid=5067#p5067
|
||||
**/
|
||||
// if (isSelected()) {
|
||||
// for (QRectF rect, m_handler.handlerRect(handlerPoints())) {
|
||||
// foreach (QRectF rect, m_handler.handlerRect(handlerPoints())) {
|
||||
// shape_.addRect(rect);
|
||||
// }
|
||||
// }
|
||||
@@ -792,7 +792,7 @@ uint Conductor::segmentsCount(QET::ConductorSegmentType type) const {
|
||||
QList<ConductorSegment *> segments_list = segmentsList();
|
||||
if (type == QET::Both) return(segments_list.count());
|
||||
uint nb_seg = 0;
|
||||
for (ConductorSegment *conductor_segment: segments_list) {
|
||||
foreach(ConductorSegment *conductor_segment, segments_list) {
|
||||
if (conductor_segment -> type() == type) ++ nb_seg;
|
||||
}
|
||||
return(nb_seg);
|
||||
@@ -895,7 +895,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
|
||||
{
|
||||
// parcours et export des segments
|
||||
QDomElement current_segment;
|
||||
for (ConductorSegment *segment: segmentsList())
|
||||
foreach(ConductorSegment *segment, segmentsList())
|
||||
{
|
||||
current_segment = dom_document.createElement("segment");
|
||||
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
|
||||
@@ -954,8 +954,8 @@ bool Conductor::pathFromXml(const QDomElement &e) {
|
||||
|
||||
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
|
||||
qreal width = 0.0, height = 0.0;
|
||||
for (qreal t: segments_x) width += t;
|
||||
for (qreal t: segments_y) height += t;
|
||||
foreach (qreal t, segments_x) width += t;
|
||||
foreach (qreal t, segments_y) height += t;
|
||||
QPointF t1 = terminal1 -> dockConductor();
|
||||
QPointF t2 = terminal2 -> dockConductor();
|
||||
qreal expected_width = t2.x() - t1.x();
|
||||
@@ -1009,7 +1009,7 @@ QVector<QPointF> Conductor::handlerPoints() const
|
||||
|
||||
QVector <QPointF> middle_points;
|
||||
|
||||
for (ConductorSegment *segment: sl)
|
||||
foreach(ConductorSegment *segment, sl)
|
||||
middle_points.append(segment->middle());
|
||||
|
||||
return middle_points;
|
||||
@@ -1145,7 +1145,7 @@ void Conductor::calculateTextItemPosition() {
|
||||
}
|
||||
|
||||
//At this point this conductor is the longuest conductor we hide all text of conductor_list
|
||||
for (Conductor *c: relatedPotentialConductors(false)) {
|
||||
foreach (Conductor *c, relatedPotentialConductors(false)) {
|
||||
c -> textItem() -> setVisible(false);
|
||||
}
|
||||
//Make sure text item is visible
|
||||
@@ -1295,7 +1295,7 @@ void Conductor::setPropertyToPotential(const ConductorProperties &property, bool
|
||||
setProperties(property);
|
||||
QSet <Conductor *> potential_list = relatedPotentialConductors();
|
||||
|
||||
for (Conductor *other_conductor: potential_list)
|
||||
foreach(Conductor *other_conductor, potential_list)
|
||||
{
|
||||
if (only_text)
|
||||
{
|
||||
@@ -1400,7 +1400,7 @@ void Conductor::displayedTextChanged()
|
||||
{
|
||||
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
||||
|
||||
for (Conductor *potential_conductor: relatedPotentialConductors())
|
||||
foreach (Conductor *potential_conductor, relatedPotentialConductors())
|
||||
{
|
||||
old_value.setValue(potential_conductor->properties());
|
||||
ConductorProperties new_properties = potential_conductor->properties();
|
||||
@@ -1436,7 +1436,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
||||
this_terminal << terminal1 << terminal2;
|
||||
|
||||
// Return all conductor of terminal 1 and 2
|
||||
for (Terminal *terminal: this_terminal) {
|
||||
foreach (Terminal *terminal, this_terminal) {
|
||||
if (!t_list -> contains(terminal)) {
|
||||
t_list -> append(terminal);
|
||||
QList <Conductor *> other_conductors_list_t = terminal -> conductors();
|
||||
@@ -1450,7 +1450,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
||||
|
||||
other_conductors_list_t.removeAll(this);
|
||||
// Research the conductors connected to conductors already found
|
||||
for (Conductor *c: other_conductors_list_t) {
|
||||
foreach (Conductor *c, other_conductors_list_t) {
|
||||
other_conductors += c -> relatedPotentialConductors(all_diagram, t_list);
|
||||
}
|
||||
other_conductors += other_conductors_list_t.toSet();
|
||||
@@ -1554,7 +1554,7 @@ QList<QPointF> Conductor::junctions() const {
|
||||
// determine si le point est une bifurcation ou non
|
||||
bool is_bend = false;
|
||||
Qt::Corner current_bend_type = Qt::TopLeftCorner;
|
||||
for (ConductorBend cb: bends_list) {
|
||||
foreach(ConductorBend cb, bends_list) {
|
||||
if (cb.first == point) {
|
||||
is_bend = true;
|
||||
current_bend_type = cb.second;
|
||||
@@ -1566,7 +1566,7 @@ QList<QPointF> Conductor::junctions() const {
|
||||
|
||||
bool is_junction = false;
|
||||
QPointF scene_point = mapToScene(point);
|
||||
for (Conductor *c: other_conductors) {
|
||||
foreach(Conductor *c, other_conductors) {
|
||||
// exprime le point dans les coordonnees de l'autre conducteur
|
||||
QPointF conductor_point = c -> mapFromScene(scene_point);
|
||||
// recupere les segments de l'autre conducteur
|
||||
@@ -1580,7 +1580,7 @@ QList<QPointF> Conductor::junctions() const {
|
||||
is_junction = true;
|
||||
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
|
||||
QList<ConductorBend> other_conductor_bends = c -> bends();
|
||||
for (ConductorBend cb: other_conductor_bends) {
|
||||
foreach(ConductorBend cb, other_conductor_bends) {
|
||||
if (cb.first == conductor_point && cb.second == current_bend_type) {
|
||||
is_junction = false;
|
||||
}
|
||||
@@ -1714,7 +1714,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
||||
QList<QPolygonF> polygons = polygon.simplified().toSubpathPolygons();
|
||||
QList<QLineF> lines;
|
||||
QList<QPointF> points;
|
||||
for (QPolygonF polygon: polygons) {
|
||||
foreach(QPolygonF polygon, polygons) {
|
||||
if (polygon.count() <= 1) continue;
|
||||
|
||||
// on recense les lignes et les points
|
||||
@@ -1727,7 +1727,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
||||
// on fait des projetes orthogonaux du point sur les differents segments du
|
||||
// polygone, en les triant par longueur croissante
|
||||
QMap<qreal, QPointF> intersections;
|
||||
for (QLineF line: lines) {
|
||||
foreach (QLineF line, lines) {
|
||||
QPointF intersection_point;
|
||||
if (QET::orthogonalProjection(point, line, &intersection_point)) {
|
||||
intersections.insert(QLineF(intersection_point, point).length(), intersection_point);
|
||||
@@ -1764,7 +1764,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
||||
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram) {
|
||||
Conductor *longuest_conductor = conductor;
|
||||
//Search the longuest conductor
|
||||
for (Conductor *c: conductor -> relatedPotentialConductors(all_diagram))
|
||||
foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram))
|
||||
if (c -> length() > longuest_conductor -> length())
|
||||
longuest_conductor = c;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
m_hovered_contact->setSelected(true);
|
||||
|
||||
//Zoom to the linked slave element
|
||||
for (QGraphicsView *view: m_hovered_contact->diagram()->views())
|
||||
foreach(QGraphicsView *view, m_hovered_contact->diagram()->views())
|
||||
{
|
||||
QRectF fit = m_hovered_contact->sceneBoundingRect();
|
||||
fit.adjust(-200, -200, 200, 200);
|
||||
@@ -230,7 +230,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
if (m_hovered_contact)
|
||||
{
|
||||
for (QRectF rect: m_hovered_contacts_map.values(m_hovered_contact))
|
||||
foreach(QRectF rect, m_hovered_contacts_map.values(m_hovered_contact))
|
||||
{
|
||||
//Mouse hover the same rect than previous hover event
|
||||
if (rect.contains(pos))
|
||||
@@ -243,9 +243,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
//At this point, mouse don't hover previous rect
|
||||
m_hovered_contact = nullptr;
|
||||
|
||||
for (Element *elmt: m_hovered_contacts_map.keys())
|
||||
foreach (Element *elmt, m_hovered_contacts_map.keys())
|
||||
{
|
||||
for (QRectF rect: m_hovered_contacts_map.values(elmt))
|
||||
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
|
||||
{
|
||||
//Mouse hover a contact
|
||||
if (rect.contains(pos))
|
||||
@@ -261,9 +261,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Element *elmt: m_hovered_contacts_map.keys())
|
||||
foreach (Element *elmt, m_hovered_contacts_map.keys())
|
||||
{
|
||||
for (QRectF rect: m_hovered_contacts_map.values(elmt))
|
||||
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
|
||||
{
|
||||
//Mouse hover a contact
|
||||
if (rect.contains(pos))
|
||||
@@ -344,9 +344,9 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
||||
|
||||
QStringList no_str, nc_str;
|
||||
|
||||
for (Element *elmt: NOElements())
|
||||
foreach (Element *elmt, NOElements())
|
||||
no_str.append(elementPositionText(elmt, true));
|
||||
for (Element *elmt: NCElements())
|
||||
foreach(Element *elmt, NCElements())
|
||||
nc_str.append(elementPositionText(elmt, true));
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
||||
|
||||
//Bounding rect of the NO text
|
||||
QRectF no_bounding;
|
||||
for (QString str: no_str)
|
||||
foreach(QString str, no_str)
|
||||
{
|
||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
||||
no_bounding = no_bounding.united(bounding);
|
||||
@@ -371,7 +371,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
||||
|
||||
//Bounding rect of the NC text
|
||||
QRectF nc_bounding;
|
||||
for (QString str: nc_str)
|
||||
foreach(QString str, nc_str)
|
||||
{
|
||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
||||
nc_bounding = nc_bounding.united(bounding);
|
||||
@@ -434,7 +434,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
||||
QRectF bounding_rect;
|
||||
|
||||
//Draw each linked contact
|
||||
for (Element *elmt: m_element->linkedElements())
|
||||
foreach (Element *elmt, m_element->linkedElements())
|
||||
{
|
||||
DiagramContext info = elmt->kindInformations();
|
||||
|
||||
@@ -627,7 +627,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
||||
|
||||
//Fill NO
|
||||
QPointF no_top_left(0, header);
|
||||
for (Element *elmt: NOElements())
|
||||
foreach(Element *elmt, NOElements())
|
||||
{
|
||||
QPen pen = painter.pen();
|
||||
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
||||
@@ -651,7 +651,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
||||
|
||||
//Fill NC
|
||||
QPointF nc_top_left(middle_cross, header);
|
||||
for (Element *elmt: NCElements())
|
||||
foreach(Element *elmt, NCElements())
|
||||
{
|
||||
QPen pen = painter.pen();
|
||||
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
||||
@@ -731,7 +731,7 @@ QList<Element *> CrossRefItem::NOElements() const
|
||||
{
|
||||
QList<Element *> no_list;
|
||||
|
||||
for (Element *elmt: m_element->linkedElements())
|
||||
foreach (Element *elmt, m_element->linkedElements())
|
||||
{
|
||||
//We continue if element is a power contact and xref propertie
|
||||
//is set to don't show power contact
|
||||
@@ -761,7 +761,7 @@ QList<Element *> CrossRefItem::NCElements() const
|
||||
{
|
||||
QList<Element *> nc_list;
|
||||
|
||||
for (Element *elmt: m_element->linkedElements())
|
||||
foreach (Element *elmt, m_element->linkedElements())
|
||||
{
|
||||
//We continue if element is a power contact and xref propertie
|
||||
//is set to don't show power contact
|
||||
|
||||
@@ -211,7 +211,7 @@ QList<Terminal *> CustomElement::terminals() const {
|
||||
/// @return la liste des conducteurs rattaches a cet element
|
||||
QList<Conductor *> CustomElement::conductors() const {
|
||||
QList<Conductor *> conductors;
|
||||
for (Terminal *t: list_terminals) conductors << t -> conductors();
|
||||
foreach(Terminal *t, list_terminals) conductors << t -> conductors();
|
||||
return(conductors);
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
|
||||
|
||||
// agit sur le QPen et la QBrush en fonction des valeurs rencontrees
|
||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||
for (QString style: styles) {
|
||||
foreach (QString style, styles) {
|
||||
if (rx.exactMatch(style)) {
|
||||
QString style_name = rx.cap(1);
|
||||
QString style_value = rx.cap(2);
|
||||
@@ -988,7 +988,7 @@ ElementTextItem* CustomElement::setTaggedText(const QString &tagg, const QString
|
||||
* @param tagg
|
||||
*/
|
||||
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
|
||||
for (ElementTextItem *eti: list_texts_) {
|
||||
foreach (ElementTextItem *eti, list_texts_) {
|
||||
if (eti -> tagg() == tagg) return eti;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -115,7 +115,7 @@ void Element::setHighlighted(bool hl) {
|
||||
*/
|
||||
void Element::displayHelpLine(bool b)
|
||||
{
|
||||
for (Terminal *t: terminals())
|
||||
foreach (Terminal *t, terminals())
|
||||
t->drawHelpLine(b);
|
||||
}
|
||||
|
||||
@@ -225,14 +225,14 @@ void Element::rotateBy(const qreal &angle) {
|
||||
applyRotation(applied_angle + rotation());
|
||||
|
||||
//update the path of conductor
|
||||
for (QGraphicsItem *qgi: childItems()) {
|
||||
foreach(QGraphicsItem *qgi, childItems()) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||
p -> updateConductor();
|
||||
}
|
||||
}
|
||||
|
||||
// repositionne les textes de l'element qui ne comportent pas l'option "FollowParentRotations"
|
||||
for (ElementTextItem *eti: texts()) {
|
||||
foreach(ElementTextItem *eti, texts()) {
|
||||
if (!eti -> followParentRotations()) {
|
||||
// on souhaite pivoter le champ de texte par rapport a son centre
|
||||
QPointF eti_center = eti -> boundingRect().center();
|
||||
@@ -400,16 +400,16 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
||||
ce recensement servira lors de la mise en place des fils
|
||||
*/
|
||||
QList<QDomElement> liste_terminals;
|
||||
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
|
||||
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
||||
if (Terminal::valideXml(qde)) liste_terminals << qde;
|
||||
}
|
||||
|
||||
QHash<int, Terminal *> priv_id_adr;
|
||||
int terminals_non_trouvees = 0;
|
||||
for (QGraphicsItem *qgi: childItems()) {
|
||||
foreach(QGraphicsItem *qgi, childItems()) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||
bool terminal_trouvee = false;
|
||||
for (QDomElement qde: liste_terminals) {
|
||||
foreach(QDomElement qde, liste_terminals) {
|
||||
if (p -> fromXml(qde)) {
|
||||
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
||||
terminal_trouvee = true;
|
||||
@@ -426,25 +426,25 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
||||
return(false);
|
||||
} else {
|
||||
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
|
||||
for (int id_trouve: priv_id_adr.keys()) {
|
||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
||||
if (table_id_adr.contains(id_trouve)) {
|
||||
// cet element possede un id qui est deja reference (= conflit)
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
// copie des associations id / adr
|
||||
for (int id_trouve: priv_id_adr.keys()) {
|
||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
||||
table_id_adr.insert(id_trouve, priv_id_adr.value(id_trouve));
|
||||
}
|
||||
}
|
||||
|
||||
//import text filed value
|
||||
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input");
|
||||
for (QGraphicsItem *qgi: childItems())
|
||||
foreach(QGraphicsItem *qgi, childItems())
|
||||
{
|
||||
if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(qgi))
|
||||
{
|
||||
for (QDomElement input: inputs)
|
||||
foreach(QDomElement input, inputs)
|
||||
{
|
||||
eti -> fromXml(input);
|
||||
etiToElementLabels(eti);
|
||||
@@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
||||
|
||||
//load uuid of connected elements
|
||||
QList <QDomElement> uuid_list = QET::findInDomElement(e, "links_uuids", "link_uuid");
|
||||
for (QDomElement qdo: uuid_list) tmp_uuids_link << qdo.attribute("uuid");
|
||||
foreach (QDomElement qdo, uuid_list) tmp_uuids_link << qdo.attribute("uuid");
|
||||
|
||||
//uuid of this element
|
||||
uuid_= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
|
||||
@@ -540,7 +540,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
if (!table_adr_id.isEmpty()) {
|
||||
// trouve le plus grand id
|
||||
int max_id_t = -1;
|
||||
for (int id_t: table_adr_id.values()) {
|
||||
foreach (int id_t, table_adr_id.values()) {
|
||||
if (id_t > max_id_t) max_id_t = id_t;
|
||||
}
|
||||
id_terminal = max_id_t + 1;
|
||||
@@ -549,7 +549,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
// enregistrement des bornes de l'appareil
|
||||
QDomElement xml_terminals = document.createElement("terminals");
|
||||
// pour chaque enfant de l'element
|
||||
for (Terminal *t: terminals()) {
|
||||
foreach(Terminal *t, terminals()) {
|
||||
// alors on enregistre la borne
|
||||
QDomElement terminal = t -> toXml(document);
|
||||
terminal.setAttribute("id", id_terminal);
|
||||
@@ -560,7 +560,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
|
||||
// enregistrement des champ de texte de l'appareil
|
||||
QDomElement inputs = document.createElement("inputs");
|
||||
for (ElementTextItem *eti: texts()) {
|
||||
foreach(ElementTextItem *eti, texts()) {
|
||||
inputs.appendChild(eti -> toXml(document));
|
||||
}
|
||||
element.appendChild(inputs);
|
||||
@@ -569,7 +569,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
//save the uuid of each other elements
|
||||
if (! isFree()) {
|
||||
QDomElement links_uuids = document.createElement("links_uuids");
|
||||
for (Element *elmt: connected_elements) {
|
||||
foreach (Element *elmt, connected_elements) {
|
||||
QDomElement link_uuid = document.createElement("link_uuid");
|
||||
link_uuid.setAttribute("uuid", elmt->uuid().toString());
|
||||
links_uuids.appendChild(link_uuid);
|
||||
@@ -599,7 +599,7 @@ QList <QPair <Terminal *, Terminal *> > Element::AlignedFreeTerminals() const
|
||||
{
|
||||
QList <QPair <Terminal *, Terminal *> > list;
|
||||
|
||||
for (Terminal *terminal: terminals())
|
||||
foreach (Terminal *terminal, terminals())
|
||||
{
|
||||
if (terminal->conductors().isEmpty())
|
||||
{
|
||||
@@ -627,7 +627,7 @@ void Element::initLink(QETProject *prj)
|
||||
if (tmp_uuids_link.isEmpty()) return;
|
||||
|
||||
ElementProvider ep(prj);
|
||||
for (Element *elmt: ep.fromUuids(tmp_uuids_link)) {
|
||||
foreach (Element *elmt, ep.fromUuids(tmp_uuids_link)) {
|
||||
elmt->linkToElement(this);
|
||||
}
|
||||
tmp_uuids_link.clear();
|
||||
@@ -676,7 +676,7 @@ bool comparPos(const Element *elmt1, const Element *elmt2) {
|
||||
void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QetGraphicsItem::mouseMoveEvent(event);
|
||||
for (Terminal *t: terminals())
|
||||
foreach (Terminal *t, terminals())
|
||||
{
|
||||
t -> drawHelpLine(true);
|
||||
}
|
||||
@@ -689,7 +689,7 @@ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QetGraphicsItem::mouseReleaseEvent(event);
|
||||
for (Terminal *t: terminals())
|
||||
foreach (Terminal *t, terminals())
|
||||
{
|
||||
t -> drawHelpLine(false);
|
||||
}
|
||||
@@ -704,7 +704,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
|
||||
for (Element *elmt: linkedElements())
|
||||
foreach (Element *elmt, linkedElements())
|
||||
elmt -> setHighlighted(true);
|
||||
|
||||
m_mouse_over = true;
|
||||
@@ -721,7 +721,7 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
||||
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
|
||||
for (Element *elmt: linkedElements())
|
||||
foreach (Element *elmt, linkedElements())
|
||||
elmt -> setHighlighted(false);
|
||||
|
||||
m_mouse_over = false;
|
||||
|
||||
@@ -210,7 +210,7 @@ void ElementTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
linked -> setSelected(true);
|
||||
|
||||
//Zoom to the linked element
|
||||
for (QGraphicsView *view: linked -> diagram() -> views()) {
|
||||
foreach(QGraphicsView *view, linked -> diagram() -> views()) {
|
||||
QRectF fit = linked -> sceneBoundingRect();
|
||||
fit.adjust(-200, -200, 200, 200);
|
||||
view -> fitInView(fit, Qt::KeepAspectRatioByExpanding);
|
||||
@@ -328,7 +328,7 @@ void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
//Also color the child text if parent is a slave and linked
|
||||
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
||||
for (QGraphicsItem *qgi: childItems())
|
||||
foreach (QGraphicsItem *qgi, childItems())
|
||||
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
||||
qgti -> setDefaultTextColor(Qt::blue);
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void ElementTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
//Also color the child text if parent is a slave and linked
|
||||
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
||||
for (QGraphicsItem *qgi: childItems())
|
||||
foreach (QGraphicsItem *qgi, childItems())
|
||||
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
||||
qgti -> setDefaultTextColor(Qt::black);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr,
|
||||
terminalsFromXml(e, table_id_adr);
|
||||
|
||||
// instancie les champs de texte decrits dans l'element XML
|
||||
for (QDomElement qde: QET::findInDomElement(e, "inputs", "input")) {
|
||||
foreach(QDomElement qde, QET::findInDomElement(e, "inputs", "input")) {
|
||||
qde.setAttribute("size", 9); // arbitraire
|
||||
if (ElementTextItem *new_input = CustomElement::parseInput(qde)) {
|
||||
new_input -> fromXml(qde);
|
||||
@@ -116,7 +116,7 @@ QRectF GhostElement::minimalBoundingRect() const {
|
||||
*/
|
||||
bool GhostElement::terminalsFromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
||||
// instancie les bornes decrites dans l'element XML
|
||||
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
|
||||
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
||||
if (!Terminal::valideXml(qde)) continue;
|
||||
|
||||
// modifie certains attributs pour que l'analyse par la classe CustomElement reussisse
|
||||
|
||||
@@ -79,7 +79,7 @@ void MasterElement::unlinkAllElements()
|
||||
// if this element is free no need to do something
|
||||
if (!isFree())
|
||||
{
|
||||
for (Element *elmt: connected_elements)
|
||||
foreach(Element *elmt, connected_elements)
|
||||
unlinkElement(elmt);
|
||||
emit linkedElementChanged();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
//Disable views context menu
|
||||
if (scene())
|
||||
for (QGraphicsView *view: scene()->views())
|
||||
foreach (QGraphicsView *view, scene()->views())
|
||||
view->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
first_move_ = true;
|
||||
@@ -164,6 +164,6 @@ void QetGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
//Enable views context menu
|
||||
if (e -> button() == Qt::LeftButton)
|
||||
if (scene())
|
||||
for (QGraphicsView *view: scene()->views())
|
||||
foreach (QGraphicsView *view, scene()->views())
|
||||
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ QPainterPath QetShapeItem::shape() const
|
||||
else
|
||||
vector = m_polygon;
|
||||
|
||||
for (QRectF r: m_handler.handlerRect(vector))
|
||||
foreach(QRectF r, m_handler.handlerRect(vector))
|
||||
path.addRect(r);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
|
||||
m_P2.setY(e.attribute("y2", 0).toDouble());
|
||||
}
|
||||
else
|
||||
for (QDomElement de: QET::findInDomElement(e, "points", "point"))
|
||||
foreach(QDomElement de, QET::findInDomElement(e, "points", "point"))
|
||||
m_polygon << QPointF(de.attribute("x", 0).toDouble(), de.attribute("y", 0).toDouble());
|
||||
|
||||
return (true);
|
||||
@@ -596,7 +596,7 @@ QDomElement QetShapeItem::toXml(QDomDocument &document) const
|
||||
else
|
||||
{
|
||||
QDomElement points = document.createElement("points");
|
||||
for (QPointF p: m_polygon)
|
||||
foreach(QPointF p, m_polygon)
|
||||
{
|
||||
QDomElement point = document.createElement("point");
|
||||
QPointF pf = mapToScene(p);
|
||||
|
||||
@@ -122,7 +122,7 @@ void ReportElement::unlinkAllElements()
|
||||
|
||||
QList <Element *> tmp_elmt = connected_elements;
|
||||
|
||||
for (Element *elmt: connected_elements)
|
||||
foreach(Element *elmt, connected_elements)
|
||||
{
|
||||
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
||||
disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
|
||||
@@ -139,7 +139,7 @@ void ReportElement::unlinkAllElements()
|
||||
}
|
||||
updateLabel();
|
||||
|
||||
for (Element *elmt: tmp_elmt)
|
||||
foreach(Element *elmt, tmp_elmt)
|
||||
{
|
||||
elmt -> setHighlighted(false);
|
||||
elmt -> unlinkAllElements();
|
||||
|
||||
@@ -83,7 +83,7 @@ void SlaveElement::unlinkAllElements()
|
||||
// if this element is free no need to do something
|
||||
if (!isFree())
|
||||
{
|
||||
for (Element *elmt: connected_elements)
|
||||
foreach(Element *elmt, connected_elements)
|
||||
unlinkElement(elmt);
|
||||
emit linkedElementChanged();
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo
|
||||
associes.
|
||||
*/
|
||||
Terminal::~Terminal() {
|
||||
for (Conductor *c: conductors_) delete c;
|
||||
foreach(Conductor *c, conductors_) delete c;
|
||||
delete br_;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ bool Terminal::addConductor(Conductor *conductor)
|
||||
Terminal *other_terminal = (conductor -> terminal1 == this) ? conductor->terminal2 : conductor->terminal1;
|
||||
|
||||
//Check if this terminal isn't already linked with other_terminal
|
||||
for (Conductor* cond: conductors_)
|
||||
foreach (Conductor* cond, conductors_)
|
||||
if (cond -> terminal1 == other_terminal || cond -> terminal2 == other_terminal)
|
||||
return false; //They already a conductor linked to this and other_terminal
|
||||
|
||||
@@ -418,14 +418,14 @@ Terminal* Terminal::alignedWithTerminal() const
|
||||
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
|
||||
|
||||
//Remove all terminals of the parent element
|
||||
for (Terminal *t: parent_element_ -> terminals())
|
||||
foreach (Terminal *t, parent_element_ -> terminals())
|
||||
qgi_list.removeAll(t);
|
||||
|
||||
if (qgi_list.isEmpty()) return nullptr;
|
||||
|
||||
//Get terminals only if orientation is opposed with this terminal
|
||||
QList <Terminal *> available_terminals;
|
||||
for (QGraphicsItem *qgi: qgi_list)
|
||||
foreach (QGraphicsItem *qgi, qgi_list)
|
||||
{
|
||||
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
|
||||
{
|
||||
@@ -448,7 +448,7 @@ Terminal* Terminal::alignedWithTerminal() const
|
||||
Terminal *nearest_terminal = available_terminals.takeFirst();
|
||||
|
||||
//Search the nearest terminal to this one
|
||||
for (Terminal *terminal: available_terminals)
|
||||
foreach (Terminal *terminal, available_terminals)
|
||||
{
|
||||
line.setP2(terminal -> dockConductor());
|
||||
if (line.length() < current_lenght)
|
||||
@@ -595,7 +595,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
use_properties = true;
|
||||
others_properties = (*conductors_list.begin())->properties();
|
||||
for (Conductor *conductor: conductors_list) {
|
||||
foreach (Conductor *conductor, conductors_list) {
|
||||
if (conductor->properties() != others_properties)
|
||||
use_properties = false;
|
||||
}
|
||||
@@ -632,7 +632,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
||||
* Update the path of conductor docked to this terminal
|
||||
*/
|
||||
void Terminal::updateConductor() {
|
||||
for (Conductor *conductor: conductors_)
|
||||
foreach (Conductor *conductor, conductors_)
|
||||
conductor->updatePath();
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ bool Terminal::isLinkedTo(Terminal *other_terminal) {
|
||||
if (other_terminal == this) return(false);
|
||||
|
||||
bool already_linked = false;
|
||||
for (Conductor *c: conductors_) {
|
||||
foreach (Conductor *c, conductors_) {
|
||||
if (c -> terminal1 == other_terminal || c -> terminal2 == other_terminal) {
|
||||
already_linked = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user