mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-07 22:22:33 +01:00
Replace foreach function by for, please try and report problem
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4900 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -89,14 +89,14 @@ DeletePartsCommand::DeletePartsCommand(
|
||||
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, 0, parent),
|
||||
deleted_parts(parts)
|
||||
{
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
for (QGraphicsItem *qgi: deleted_parts) {
|
||||
editor_scene_ -> qgiManager().manage(qgi);
|
||||
}
|
||||
}
|
||||
|
||||
/// Destructeur : detruit egalement les parties supprimees
|
||||
DeletePartsCommand::~DeletePartsCommand() {
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
for (QGraphicsItem *qgi: deleted_parts) {
|
||||
editor_scene_ -> qgiManager().release(qgi);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ DeletePartsCommand::~DeletePartsCommand() {
|
||||
/// Restaure les parties supprimees
|
||||
void DeletePartsCommand::undo() {
|
||||
editor_scene_ -> blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
for (QGraphicsItem *qgi: deleted_parts) {
|
||||
editor_scene_ -> addItem(qgi);
|
||||
}
|
||||
editor_scene_ -> blockSignals(false);
|
||||
@@ -113,7 +113,7 @@ void DeletePartsCommand::undo() {
|
||||
/// Supprime les parties
|
||||
void DeletePartsCommand::redo() {
|
||||
editor_scene_ -> blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
for (QGraphicsItem *qgi: deleted_parts) {
|
||||
editor_scene_ -> removeItem(qgi);
|
||||
}
|
||||
editor_scene_ -> blockSignals(false);
|
||||
@@ -149,7 +149,7 @@ PastePartsCommand::~PastePartsCommand() {
|
||||
void PastePartsCommand::undo() {
|
||||
// enleve les parties
|
||||
editor_scene_ -> blockSignals(true);
|
||||
foreach(QGraphicsItem *part, content_) {
|
||||
for (QGraphicsItem *part: content_) {
|
||||
editor_scene_ -> removeItem(part);
|
||||
}
|
||||
editor_scene_ -> blockSignals(false);
|
||||
@@ -166,7 +166,7 @@ void PastePartsCommand::redo() {
|
||||
else {
|
||||
// pose les parties
|
||||
editor_scene_ -> blockSignals(true);
|
||||
foreach(QGraphicsItem *part, content_) {
|
||||
for (QGraphicsItem *part: content_) {
|
||||
editor_scene_ -> addItem(part);
|
||||
}
|
||||
editor_scene_ -> blockSignals(false);
|
||||
@@ -240,7 +240,7 @@ MovePartsCommand::~MovePartsCommand() {
|
||||
|
||||
/// Annule le deplacement
|
||||
void MovePartsCommand::undo() {
|
||||
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
|
||||
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
|
||||
}
|
||||
|
||||
/// Refait le deplacement
|
||||
@@ -250,7 +250,7 @@ void MovePartsCommand::redo() {
|
||||
first_redo = false;
|
||||
return;
|
||||
}
|
||||
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(movement.x(), movement.y());
|
||||
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(movement.x(), movement.y());
|
||||
}
|
||||
|
||||
/*** AddPartCommand ***/
|
||||
@@ -353,7 +353,7 @@ ChangeZValueCommand::ChangeZValueCommand(
|
||||
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
|
||||
|
||||
// prend un snapshot des zValues
|
||||
foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());
|
||||
for (QGraphicsItem *qgi: items_list) undo_hash.insert(qgi, qgi -> zValue());
|
||||
|
||||
// choisit le nom en fonction du traitement
|
||||
if (option == BringForward) {
|
||||
@@ -377,12 +377,12 @@ ChangeZValueCommand::~ChangeZValueCommand() {
|
||||
|
||||
/// Annule les changements de zValue
|
||||
void ChangeZValueCommand::undo() {
|
||||
foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
|
||||
for (QGraphicsItem *qgi: undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
|
||||
}
|
||||
|
||||
/// Refait les changements de zValue
|
||||
void ChangeZValueCommand::redo() {
|
||||
foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
|
||||
for (QGraphicsItem *qgi: redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,15 +392,15 @@ void ChangeZValueCommand::redo() {
|
||||
void ChangeZValueCommand::applyBringForward(const QList<QGraphicsItem *> &items_list) {
|
||||
QList<QGraphicsItem *> non_selected_items = items_list;
|
||||
QList<QGraphicsItem *> selected_items;
|
||||
foreach(QGraphicsItem *qgi, non_selected_items) {
|
||||
for (QGraphicsItem *qgi: non_selected_items) {
|
||||
if (qgi -> isSelected()) {
|
||||
selected_items << qgi;
|
||||
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
||||
}
|
||||
}
|
||||
int z = 1;
|
||||
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
|
||||
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -418,7 +418,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
||||
}
|
||||
}
|
||||
int z = 1;
|
||||
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,7 +437,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
||||
}
|
||||
|
||||
int z = 1;
|
||||
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,15 +447,15 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
||||
void ChangeZValueCommand::applySendBackward(const QList<QGraphicsItem *> &items_list) {
|
||||
QList<QGraphicsItem *> non_selected_items = items_list;
|
||||
QList<QGraphicsItem *> selected_items;
|
||||
foreach(QGraphicsItem *qgi, non_selected_items) {
|
||||
for (QGraphicsItem *qgi: non_selected_items) {
|
||||
if (qgi -> isSelected()) {
|
||||
selected_items << qgi;
|
||||
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
||||
}
|
||||
}
|
||||
int z = 1;
|
||||
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
|
||||
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
|
||||
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,7 +569,7 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
|
||||
if (before == after) return;
|
||||
if (!before.width() || !before.height()) return; // cowardly flee division by zero FIXME?
|
||||
|
||||
foreach (CustomElementPart *part_item, scaled_primitives_) {
|
||||
for (CustomElementPart *part_item: scaled_primitives_) {
|
||||
part_item -> startUserTransformation(before);
|
||||
part_item -> handleUserTransformation(before, after);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ QRectF ElementPrimitiveDecorator::internalBoundingRect() const {
|
||||
}
|
||||
}
|
||||
QRectF rect = decorated_items_.first() -> sceneGeometricRect();
|
||||
foreach (CustomElementPart *item, decorated_items_) {
|
||||
for (CustomElementPart *item: decorated_items_) {
|
||||
rect = rect.united(item -> sceneGeometricRect());
|
||||
}
|
||||
return(rect);
|
||||
@@ -146,7 +146,7 @@ void ElementPrimitiveDecorator::setItems(const QList<CustomElementPart *> &items
|
||||
*/
|
||||
void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items) {
|
||||
QList<CustomElementPart *> primitives;
|
||||
foreach (QGraphicsItem *item, items) {
|
||||
for (QGraphicsItem *item: items) {
|
||||
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item)) {
|
||||
primitives << part_item;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
|
||||
*/
|
||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
||||
QList<QGraphicsItem *> list;
|
||||
foreach (CustomElementPart *part_item, decorated_items_) {
|
||||
for (CustomElementPart *part_item: decorated_items_) {
|
||||
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||
list << item;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ void ElementPrimitiveDecorator::keyPressEvent(QKeyEvent *e) {
|
||||
} else {
|
||||
keys_movement_ += movement;
|
||||
}
|
||||
foreach(QGraphicsItem *qgi, graphicsItems()) {
|
||||
for (QGraphicsItem *qgi: graphicsItems()) {
|
||||
qgi -> setPos(qgi -> pos() + movement);
|
||||
adjust();
|
||||
}
|
||||
@@ -469,7 +469,7 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
|
||||
void ElementPrimitiveDecorator::startMovement() {
|
||||
adjust();
|
||||
|
||||
foreach(CustomElementPart *item, decorated_items_) {
|
||||
for (CustomElementPart *item: decorated_items_) {
|
||||
item -> startUserTransformation(mapToScene(original_bounding_rect_).boundingRect());
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ CustomElementPart *ElementPrimitiveDecorator::singleItem() const {
|
||||
void ElementPrimitiveDecorator::translateItems(const QPointF &movement) {
|
||||
if (!decorated_items_.count()) return;
|
||||
|
||||
foreach(QGraphicsItem *qgi, graphicsItems()) {
|
||||
for (QGraphicsItem *qgi: graphicsItems()) {
|
||||
// this is a naive, proof-of-concept implementation; we actually need to take
|
||||
// the grid into account and create a command object in mouseReleaseEvent()
|
||||
qgi -> moveBy(movement.x(), movement.y());
|
||||
@@ -553,7 +553,7 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR
|
||||
QRectF scene_original_rect = mapToScene(original_rect).boundingRect();
|
||||
QRectF scene_new_rect = mapToScene(new_rect).boundingRect();
|
||||
|
||||
foreach(CustomElementPart *item, decorated_items_) {
|
||||
for (CustomElementPart *item: decorated_items_) {
|
||||
item -> handleUserTransformation(scene_original_rect, scene_new_rect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
||||
QDomElement description = xml_document.createElement("description");
|
||||
|
||||
//the graphic description of the element
|
||||
foreach(QGraphicsItem *qgi, zItems())
|
||||
for (QGraphicsItem *qgi: zItems())
|
||||
{
|
||||
//If the export concerns only the selection, the not selected part is ignored
|
||||
if (!all_parts && !qgi -> isSelected()) continue;
|
||||
@@ -416,7 +416,7 @@ void ElementScene::fromXml(
|
||||
*/
|
||||
QRectF ElementScene::elementSceneGeometricRect() const{
|
||||
QRectF esgr;
|
||||
foreach (QGraphicsItem *qgi, items()) {
|
||||
for (QGraphicsItem *qgi: items()) {
|
||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||
if (qgi -> type() == PartTextField::Type) continue;
|
||||
@@ -432,7 +432,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{
|
||||
aucune.
|
||||
*/
|
||||
bool ElementScene::containsTerminals() const {
|
||||
foreach(QGraphicsItem *qgi,items()) {
|
||||
for (QGraphicsItem *qgi:items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
return(true);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ QETElementEditor* ElementScene::editor() const {
|
||||
void ElementScene::slot_select(const ElementContent &content) {
|
||||
blockSignals(true);
|
||||
clearSelection();
|
||||
foreach(QGraphicsItem *qgi, content) qgi -> setSelected(true);
|
||||
for (QGraphicsItem *qgi: content) qgi -> setSelected(true);
|
||||
blockSignals(false);
|
||||
emit(selectionChanged());
|
||||
}
|
||||
@@ -539,7 +539,7 @@ void ElementScene::slot_deselectAll() {
|
||||
*/
|
||||
void ElementScene::slot_invertSelection() {
|
||||
blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(!qgi -> isSelected());
|
||||
for (QGraphicsItem *qgi: items()) qgi -> setSelected(!qgi -> isSelected());
|
||||
blockSignals(false);
|
||||
emit(selectionChanged());
|
||||
}
|
||||
@@ -698,7 +698,7 @@ void ElementScene::slot_sendBackward() {
|
||||
*/
|
||||
QList<CustomElementPart *> ElementScene::primitives() const {
|
||||
QList<CustomElementPart *> primitives_list;
|
||||
foreach (QGraphicsItem *item, items()) {
|
||||
for (QGraphicsItem *item: items()) {
|
||||
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||
primitives_list << primitive;
|
||||
}
|
||||
@@ -768,7 +768,7 @@ QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
|
||||
*/
|
||||
ElementContent ElementScene::selectedContent() const {
|
||||
ElementContent content;
|
||||
foreach(QGraphicsItem *qgi, zItems()) {
|
||||
for (QGraphicsItem *qgi: zItems()) {
|
||||
if (qgi -> isSelected()) content << qgi;
|
||||
}
|
||||
return(content);
|
||||
@@ -796,7 +796,7 @@ void ElementScene::reset()
|
||||
clearSelection();
|
||||
undoStack().clear();
|
||||
|
||||
foreach (QGraphicsItem *qgi, items())
|
||||
for (QGraphicsItem *qgi: items())
|
||||
{
|
||||
removeItem(qgi);
|
||||
qgiManager().release(qgi);
|
||||
@@ -813,7 +813,7 @@ void ElementScene::reset()
|
||||
*/
|
||||
QRectF ElementScene::elementContentBoundingRect(const ElementContent &content) const {
|
||||
QRectF bounding_rect;
|
||||
foreach(QGraphicsItem *qgi, content) {
|
||||
for (QGraphicsItem *qgi: content) {
|
||||
// skip non-primitives QGraphicsItems (paste area, selection decorator)
|
||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||
@@ -924,7 +924,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document, QStri
|
||||
*/
|
||||
ElementContent ElementScene::addContent(const ElementContent &content, QString *error_message) {
|
||||
Q_UNUSED(error_message);
|
||||
foreach(QGraphicsItem *part, content) {
|
||||
for (QGraphicsItem *part: content) {
|
||||
addPrimitive(part);
|
||||
}
|
||||
return(content);
|
||||
@@ -947,7 +947,7 @@ ElementContent ElementScene::addContentAtPos(const ElementContent &content, cons
|
||||
QPointF offset = pos - bounding_rect.topLeft();
|
||||
|
||||
// ajoute les parties avec le decalage adequat
|
||||
foreach(QGraphicsItem *part, content) {
|
||||
for (QGraphicsItem *part: content) {
|
||||
part -> setPos(part -> pos() + offset);
|
||||
addPrimitive(part);
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ void ElementScene::centerElementToOrigine() {
|
||||
if (center_y < 0) move_y -= 10;
|
||||
|
||||
//move each primitive by @move
|
||||
foreach (QGraphicsItem *qgi, items()) {
|
||||
for (QGraphicsItem *qgi: items()) {
|
||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||
//deselect item for disable decorator
|
||||
@@ -1075,7 +1075,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) {
|
||||
}
|
||||
|
||||
if (!command -> elementView()) {
|
||||
foreach (QGraphicsView *view, views()) {
|
||||
for (QGraphicsView *view: views()) {
|
||||
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
|
||||
command -> setElementView(element_view);
|
||||
break;
|
||||
|
||||
@@ -219,7 +219,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
||||
|
||||
//Check each pair of style
|
||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||
foreach (QString style, styles)
|
||||
for (QString style: styles)
|
||||
{
|
||||
if (!rx.exactMatch(style)) continue;
|
||||
QString style_name = rx.cap(1);
|
||||
|
||||
@@ -129,7 +129,7 @@ QList<QPointF> CustomElementPart::mapPoints(const QRectF &initial_selection_rect
|
||||
qreal new_top_left_x = new_selection_rect.x();
|
||||
qreal new_top_left_y = new_selection_rect.y();
|
||||
|
||||
foreach (QPointF point, points) {
|
||||
for (QPointF point: points) {
|
||||
QPointF point_offset = point - initial_top_left;
|
||||
new_points << QPointF(
|
||||
new_top_left_x + (point_offset.rx() * sx),
|
||||
|
||||
@@ -133,7 +133,7 @@ QRectF PartArc::boundingRect() const
|
||||
{
|
||||
QRectF r = AbstractPartEllipse::boundingRect();
|
||||
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
r |= rect;
|
||||
|
||||
return r;
|
||||
@@ -154,7 +154,7 @@ QPainterPath PartArc::shape() const
|
||||
shape = pps.createStroke(shape);
|
||||
|
||||
if (isSelected())
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
shape.addRect(rect);
|
||||
|
||||
return shape;
|
||||
|
||||
@@ -129,7 +129,7 @@ QRectF PartEllipse::boundingRect() const
|
||||
{
|
||||
QRectF r = AbstractPartEllipse::boundingRect();
|
||||
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
r |= rect;
|
||||
|
||||
return r;
|
||||
@@ -149,7 +149,7 @@ QPainterPath PartEllipse::shape() const
|
||||
shape = pps.createStroke(shape);
|
||||
|
||||
if (isSelected())
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
shape.addRect(rect);
|
||||
|
||||
return shape;
|
||||
|
||||
@@ -244,7 +244,7 @@ QPainterPath PartLine::shape() const
|
||||
shape = pps.createStroke(shape);
|
||||
|
||||
if (isSelected())
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||
shape.addRect(rect);
|
||||
|
||||
return shape;
|
||||
@@ -373,10 +373,10 @@ void PartLine::debugPaint(QPainter *painter)
|
||||
|
||||
painter -> setPen(Qt::red);
|
||||
|
||||
foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length))
|
||||
for (QPointF pointy: fourEndPoints(m_line.p1(), m_line.p2(), first_length))
|
||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
||||
|
||||
foreach(QPointF pointy, fourEndPoints(m_line.p2(), m_line.p1(), second_length))
|
||||
for (QPointF pointy: fourEndPoints(m_line.p2(), m_line.p1(), second_length))
|
||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
||||
|
||||
painter -> restore();
|
||||
@@ -402,7 +402,7 @@ QRectF PartLine::boundingRect() const
|
||||
bound = bound.normalized();
|
||||
bound.adjust(-adjust, -adjust, adjust, adjust);
|
||||
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||
bound |= rect;
|
||||
|
||||
return bound;
|
||||
|
||||
@@ -109,7 +109,7 @@ const QDomElement PartPolygon::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
QDomElement xml_element = xml_document.createElement("polygon");
|
||||
int i = 1;
|
||||
foreach(QPointF point, m_polygon) {
|
||||
for (QPointF point: m_polygon) {
|
||||
point = mapToScene(point);
|
||||
xml_element.setAttribute(QString("x%1").arg(i), QString("%1").arg(point.x()));
|
||||
xml_element.setAttribute(QString("y%1").arg(i), QString("%1").arg(point.y()));
|
||||
@@ -344,7 +344,7 @@ QPainterPath PartPolygon::shape() const
|
||||
shape = pps.createStroke(shape);
|
||||
|
||||
if (isSelected())
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
|
||||
for (QRectF rect: m_handler.handlerRect(m_polygon))
|
||||
shape.addRect(rect);
|
||||
|
||||
return shape;
|
||||
@@ -379,7 +379,7 @@ QRectF PartPolygon::boundingRect() const
|
||||
|
||||
r.adjust(-adjust, -adjust, adjust, adjust);
|
||||
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
|
||||
for (QRectF rect: m_handler.handlerRect(m_polygon))
|
||||
r |=rect;
|
||||
|
||||
return(r);
|
||||
|
||||
@@ -165,7 +165,7 @@ QPainterPath PartRectangle::shape() const
|
||||
shape = pps.createStroke(shape);
|
||||
|
||||
if (isSelected())
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
shape.addRect(rect);
|
||||
|
||||
return shape;
|
||||
@@ -196,7 +196,7 @@ QRectF PartRectangle::boundingRect() const
|
||||
QRectF r = m_rect.normalized();
|
||||
r.adjust(-adjust, -adjust, adjust, adjust);
|
||||
|
||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||
r |= rect;
|
||||
|
||||
return(r);
|
||||
|
||||
@@ -101,7 +101,7 @@ void PolygonEditor::updateForm() {
|
||||
if (!part) return;
|
||||
activeConnections(false);
|
||||
while(points_list.takeTopLevelItem(0)) {}
|
||||
foreach(QPointF point, part -> polygon()) {
|
||||
for (QPointF point: part -> polygon()) {
|
||||
point = part -> mapToScene(point);
|
||||
QStringList qsl;
|
||||
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
||||
|
||||
@@ -276,7 +276,7 @@ void QETElementEditor::setupActions() {
|
||||
QAction *add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), parts);
|
||||
QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
|
||||
|
||||
foreach (QAction *action, parts -> actions()) action -> setCheckable(true);
|
||||
for (QAction *action: parts -> actions()) action -> setCheckable(true);
|
||||
|
||||
connect(add_line, SIGNAL(triggered()), this, SLOT(addLine() ));
|
||||
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(addRect() ));
|
||||
@@ -433,7 +433,7 @@ void QETElementEditor::slot_updateMenus() {
|
||||
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
|
||||
|
||||
// actions dependant seulement de l'etat "lecture seule" de l'editeur
|
||||
foreach (QAction *action, parts -> actions()) {
|
||||
for (QAction *action: parts -> actions()) {
|
||||
action -> setEnabled(!read_only);
|
||||
}
|
||||
selectall -> setEnabled(!read_only);
|
||||
@@ -447,7 +447,7 @@ void QETElementEditor::slot_updateMenus() {
|
||||
cut -> setEnabled(selected_items);
|
||||
copy -> setEnabled(selected_items);
|
||||
edit_delete -> setEnabled(selected_items);
|
||||
foreach (QAction *action, m_depth_ag -> actions())
|
||||
for (QAction *action: m_depth_ag -> actions())
|
||||
action->setEnabled(selected_items);
|
||||
|
||||
// actions dependant du contenu du presse-papiers
|
||||
@@ -579,7 +579,7 @@ void QETElementEditor::slot_updateInformations() {
|
||||
if (selected_qgis.size() >= 2)
|
||||
{
|
||||
style_editable = true;
|
||||
foreach (QGraphicsItem *qgi, selected_qgis)
|
||||
for (QGraphicsItem *qgi: selected_qgis)
|
||||
{
|
||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
|
||||
cep_list << cep;
|
||||
@@ -689,7 +689,7 @@ bool QETElementEditor::checkElement()
|
||||
|
||||
{
|
||||
bool wrng = true;
|
||||
foreach (CustomElementPart *cep, ce_scene->primitives())
|
||||
for (CustomElementPart *cep: ce_scene->primitives())
|
||||
if (cep->property("tagg").toString() == "label") wrng = false;
|
||||
|
||||
///Error #1: element is master, slave or simple but havent got input tagged 'label'
|
||||
@@ -708,7 +708,7 @@ bool QETElementEditor::checkElement()
|
||||
{
|
||||
int text =0, terminal =0;
|
||||
|
||||
foreach(QGraphicsItem *qgi, ce_scene->items())
|
||||
for (QGraphicsItem *qgi: ce_scene->items())
|
||||
{
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
|
||||
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
|
||||
@@ -744,7 +744,7 @@ bool QETElementEditor::checkElement()
|
||||
|
||||
dialog_message += "<ol>";
|
||||
QList<QETWarning> total = warnings << errors;
|
||||
foreach(QETWarning warning, total) {
|
||||
for (QETWarning warning: total) {
|
||||
dialog_message += "<li>";
|
||||
dialog_message += QString(
|
||||
tr("<b>%1</b> : %2", "warning title: warning description")
|
||||
@@ -990,7 +990,7 @@ void QETElementEditor::addTerminal() {
|
||||
* Uncheck all action related to primitive
|
||||
*/
|
||||
void QETElementEditor::UncheckAddPrimitive() {
|
||||
foreach(QAction *action, parts->actions()) action -> setChecked(false);
|
||||
for (QAction *action: parts->actions()) action -> setChecked(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -177,7 +177,7 @@ void StyleEditor::updateForm()
|
||||
size_weight -> setCurrentIndex(first_part -> lineWeight());
|
||||
filling_color -> setCurrentIndex(first_part -> filling());
|
||||
|
||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
||||
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||
{
|
||||
if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false);
|
||||
if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1);
|
||||
@@ -236,7 +236,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
||||
|
||||
if (!isStyleEditable(part_list)) return false;
|
||||
|
||||
foreach (CustomElementPart *cep, part_list)
|
||||
for (CustomElementPart *cep: part_list)
|
||||
{
|
||||
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
||||
m_part_list << cegp;
|
||||
@@ -244,7 +244,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
||||
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||
m_cep_list << cegp;
|
||||
|
||||
updateForm();
|
||||
@@ -268,7 +268,7 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> cep_list)
|
||||
QStringList str;
|
||||
str << "arc" << "ellipse" << "line" << "polygon" << "rect";
|
||||
|
||||
foreach (CustomElementPart *cep, cep_list)
|
||||
for (CustomElementPart *cep: cep_list)
|
||||
if (!str.contains(cep -> xmlName()))
|
||||
return false;
|
||||
|
||||
@@ -307,7 +307,7 @@ void StyleEditor::makeUndo(const QString &undo_text, const char *property_name,
|
||||
}
|
||||
else if (!m_part_list.isEmpty())
|
||||
{
|
||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
||||
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||
{
|
||||
if (!undo)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user