summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scutilsprovider.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp8
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmltag.cpp14
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmluifactory.cpp3
-rw-r--r--src/plugins/scxmleditor/plugin_interface/stateitem.cpp7
-rw-r--r--src/plugins/scxmleditor/plugin_interface/tagtextitem.cpp3
-rw-r--r--src/plugins/scxmleditor/plugin_interface/textitem.cpp3
-rw-r--r--src/plugins/scxmleditor/plugin_interface/transitionitem.cpp3
-rw-r--r--src/plugins/scxmleditor/plugin_interface/undocommands.cpp6
10 files changed, 29 insertions, 22 deletions
diff --git a/src/plugins/scxmleditor/plugin_interface/scutilsprovider.cpp b/src/plugins/scxmleditor/plugin_interface/scutilsprovider.cpp
index b4b0f22742..2c53bc5b13 100644
--- a/src/plugins/scxmleditor/plugin_interface/scutilsprovider.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scutilsprovider.cpp
@@ -85,7 +85,7 @@ void SCUtilsProvider::checkInitialState(const QList<QGraphicsItem*> &items, Scxm
}
}
- foreach (QGraphicsItem *item, items) {
+ for (QGraphicsItem *item : items) {
if (item->type() >= StateType) {
auto stateItem = static_cast<StateItem*>(item);
if (stateItem)
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
index 97aee68d45..098aa6ec6a 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
@@ -312,7 +312,7 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con
QBuffer buffer(&d);
buffer.open(QIODevice::ReadOnly);
QXmlStreamReader xml(&buffer);
- foreach (ScxmlNamespace *ns, m_namespaces) {
+ for (ScxmlNamespace *ns : qAsConst(m_namespaces)) {
xml.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration(ns->prefix(), ns->name()));
}
@@ -412,7 +412,7 @@ QByteArray ScxmlDocument::content(const QVector<ScxmlTag*> &tags) const
if (writeScxml)
xml.writeStartElement("scxml");
- foreach (ScxmlTag *tag, tags) {
+ for (ScxmlTag *tag : tags) {
tag->writeXml(xml);
}
xml.writeEndDocument();
@@ -597,7 +597,7 @@ QString ScxmlDocument::nextUniqueId(const QString &key)
name = QString::fromLatin1("%1_%2").arg(key).arg(id);
// Check duplicate
- foreach (const ScxmlTag *tag, m_tags) {
+ for (const ScxmlTag *tag : qAsConst(m_tags)) {
if (tag->attribute("id") == name) {
bFound = true;
break;
@@ -619,7 +619,7 @@ QString ScxmlDocument::getUniqueCopyId(const ScxmlTag *tag)
while (true) {
bFound = false;
// Check duplicate
- foreach (const ScxmlTag *t, m_tags) {
+ for (const ScxmlTag *t : qAsConst(m_tags)) {
if (t->attribute("id") == name && t != tag) {
name = QString::fromLatin1("%1_Copy%2").arg(key).arg(counter);
bFound = true;
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
index f28b85dbb9..dc864d2e7a 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
@@ -272,7 +272,7 @@ bool ScxmlTag::hasData() const
if (!m_attributeNames.isEmpty() || !m_content.isEmpty())
return true;
- foreach (ScxmlTag *tag, m_childTags) {
+ for (ScxmlTag *tag : qAsConst(m_childTags)) {
if (tag->hasData())
return true;
}
@@ -282,7 +282,7 @@ bool ScxmlTag::hasData() const
bool ScxmlTag::hasChild(TagType type) const
{
- foreach (ScxmlTag *tag, m_childTags) {
+ for (ScxmlTag *tag : qAsConst(m_childTags)) {
if (tag->tagType() == type)
return true;
}
@@ -292,7 +292,7 @@ bool ScxmlTag::hasChild(TagType type) const
bool ScxmlTag::hasChild(const QString &name) const
{
- foreach (ScxmlTag *tag, m_childTags) {
+ for (ScxmlTag *tag : qAsConst(m_childTags)) {
if (tag->tagName() == name)
return true;
}
@@ -507,7 +507,7 @@ QVector<ScxmlTag*> ScxmlTag::allChildren() const
QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
{
QVector<ScxmlTag*> children;
- foreach (ScxmlTag *tag, m_childTags) {
+ for (ScxmlTag *tag : qAsConst(m_childTags)) {
if (tag->tagName() == name)
children << tag;
}
@@ -517,7 +517,7 @@ QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
ScxmlTag *ScxmlTag::child(const QString &name) const
{
- foreach (ScxmlTag *tag, m_childTags) {
+ for (ScxmlTag *tag : qAsConst(m_childTags)) {
if (tag->tagName() == name)
return tag;
}
@@ -639,8 +639,8 @@ void ScxmlTag::readXml(QXmlStreamReader &xml, bool checkCopyId)
else if (token == QXmlStreamReader::StartElement) {
if (m_tagType != Metadata && m_tagType != MetadataItem && xml.qualifiedName().toString() == "qt:editorinfo") {
// Read editorinfos
- QXmlStreamAttributes attributes = xml.attributes();
- foreach (QXmlStreamAttribute attr, attributes) {
+ const QXmlStreamAttributes attributes = xml.attributes();
+ for (QXmlStreamAttribute attr : attributes) {
m_editorInfo[attr.name().toString()] = attr.value().toString();
}
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
index 24e5789f08..8c2cc4302a 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
@@ -57,7 +57,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
return false;
QVector<TagType> childTags = allowedChildTypes(currentTag->tagType());
- foreach (const TagType &type, tagTypes) {
+ for (const TagType &type : qAsConst(tagTypes)) {
if (!childTags.contains(type))
return false;
}
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmluifactory.cpp b/src/plugins/scxmleditor/plugin_interface/scxmluifactory.cpp
index dd5aa43190..619c377813 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmluifactory.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmluifactory.cpp
@@ -93,7 +93,8 @@ void ScxmlUiFactory::initPlugins()
QStringList nameFilters;
nameFilters << "*.dll" << "*.so";
- foreach (QFileInfo dllFileInfo, pluginDir.entryInfoList(nameFilters)) {
+ const QList<QFileInfo> dllFileInfos = pluginDir.entryInfoList(nameFilters);
+ for (QFileInfo dllFileInfo : dllFileInfos) {
QPluginLoader loader(dllFileInfo.absoluteFilePath());
loader.load();
diff --git a/src/plugins/scxmleditor/plugin_interface/stateitem.cpp b/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
index 06007b023b..2d3aa582ef 100644
--- a/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
@@ -207,7 +207,8 @@ void StateItem::updateBoundingRect()
void StateItem::shrink()
{
QRectF trect;
- foreach (TransitionItem *item, outputTransitions()) {
+ const QVector<TransitionItem *> items = outputTransitions();
+ for (TransitionItem *item : items) {
if (item->targetType() == TransitionItem::InternalSameTarget || item->targetType() == TransitionItem::InternalNoTarget) {
trect = trect.united(item->wholeBoundingRect());
}
@@ -239,8 +240,8 @@ void StateItem::transitionsChanged()
{
QRectF rr = boundingRect();
QRectF rectInternalTransitions;
- QVector<TransitionItem*> internalTransitions = outputTransitions();
- foreach (TransitionItem *item, internalTransitions) {
+ const QVector<TransitionItem*> internalTransitions = outputTransitions();
+ for (TransitionItem *item : internalTransitions) {
if (item->targetType() <= TransitionItem::InternalNoTarget) {
QRectF br = mapFromItem(item, item->boundingRect()).boundingRect();
br.setLeft(rr.left() + 20);
diff --git a/src/plugins/scxmleditor/plugin_interface/tagtextitem.cpp b/src/plugins/scxmleditor/plugin_interface/tagtextitem.cpp
index 9c084328bd..97ab0053cb 100644
--- a/src/plugins/scxmleditor/plugin_interface/tagtextitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/tagtextitem.cpp
@@ -70,7 +70,8 @@ bool TagTextItem::needIgnore(const QPointF sPos)
{
// If we found QuickTransition-item or CornerGrabber at this point, we must ignore mouse press here
// So we can press QuickTransition/CornerGrabber item although there is transition lines front of these items
- foreach (QGraphicsItem *item, scene()->items(sPos)) {
+ const QList<QGraphicsItem *> items = scene()->items(sPos);
+ for (QGraphicsItem *item : items) {
if (item->type() == QuickTransitionType || (item->type() == CornerGrabberType && item->parentItem() != this))
return true;
}
diff --git a/src/plugins/scxmleditor/plugin_interface/textitem.cpp b/src/plugins/scxmleditor/plugin_interface/textitem.cpp
index 812fd562b4..0647c5e89e 100644
--- a/src/plugins/scxmleditor/plugin_interface/textitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/textitem.cpp
@@ -121,7 +121,8 @@ bool TextItem::needIgnore(const QPointF sPos) const
{
// If we found QuickTransition-item or CornerGrabber at this point, we must ignore mouse press here
// So we can press QuickTransition/CornerGrabber item although there is transition lines front of these items
- foreach (QGraphicsItem *item, scene()->items(sPos)) {
+ const QList<QGraphicsItem *> items = scene()->items(sPos);
+ for (QGraphicsItem *item : items) {
if (item->type() == QuickTransitionType || (item->type() == CornerGrabberType && item->parentItem() != this))
return true;
}
diff --git a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
index 84c3d66683..afed13f3f3 100644
--- a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
@@ -280,7 +280,8 @@ void TransitionItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (bLeftButton) {
// If we found QuickTransition-item or CornerGrabber at this point, we must ignore mouse press here
// So we can press QuickTransition/CornerGrabber item although there is transition lines front of these items
- foreach (QGraphicsItem *item, scene()->items(event->scenePos())) {
+ const QList<QGraphicsItem *> items = scene()->items(event->scenePos());
+ for (QGraphicsItem *item : items) {
if (item->type() == QuickTransitionType || (item->type() == CornerGrabberType && item->parentItem() != this)) {
event->ignore();
return;
diff --git a/src/plugins/scxmleditor/plugin_interface/undocommands.cpp b/src/plugins/scxmleditor/plugin_interface/undocommands.cpp
index b4bd0f75f9..c217a83cee 100644
--- a/src/plugins/scxmleditor/plugin_interface/undocommands.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/undocommands.cpp
@@ -354,7 +354,8 @@ void ChangeFullNameSpaceCommand::makeIdMap(ScxmlTag *tag, QHash<QString, QString
break;
}
- foreach (ScxmlTag *child, tag->allChildren()) {
+ const QVector<ScxmlTag *> children = tag->allChildren();
+ for (ScxmlTag *child : children) {
makeIdMap(child, map, use);
}
}
@@ -380,7 +381,8 @@ void ChangeFullNameSpaceCommand::updateNameSpace(ScxmlTag *tag, const QHash<QStr
tag->setAttribute(name, map[attr]);
}
- foreach (ScxmlTag *child, tag->allChildren()) {
+ const QVector<ScxmlTag *> children = tag->allChildren();
+ for (ScxmlTag *child : children) {
updateNameSpace(child, map);
}
}