forked from qt-creator/qt-creator
QmlDesigner: Remove foreach / Q_FOREACH usage mostly in components
Task-number: QTCREATORBUG-27464 Change-Id: Id7c1ebdc83ef355fe7a978ce57757f63005de0ab Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -134,17 +134,17 @@ void PathItem::writePathToProperty()
|
||||
|
||||
ModelNode pathNode = pathModelNode(formEditorItem());
|
||||
|
||||
pathNode.view()->executeInTransaction("PathItem::writePathToProperty", [this, &pathNode](){
|
||||
pathNode.view()->executeInTransaction("PathItem::writePathToProperty", [this, &pathNode]() {
|
||||
QList<ModelNode> pathSegmentNodes = pathNode.nodeListProperty("pathElements").toModelNodeList();
|
||||
|
||||
foreach (ModelNode pathSegment, pathSegmentNodes)
|
||||
for (ModelNode pathSegment : pathSegmentNodes)
|
||||
pathSegment.destroy();
|
||||
|
||||
if (!m_cubicSegments.isEmpty()) {
|
||||
pathNode.variantProperty("startX").setValue(m_cubicSegments.constFirst().firstControlPoint().coordinate().x());
|
||||
pathNode.variantProperty("startY").setValue(m_cubicSegments.constFirst().firstControlPoint().coordinate().y());
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, m_cubicSegments) {
|
||||
for (const CubicSegment &cubicSegment : qAsConst(m_cubicSegments)) {
|
||||
writePathAttributes(pathNode, cubicSegment.attributes());
|
||||
writePathPercent(pathNode, cubicSegment.percent());
|
||||
|
||||
@@ -171,7 +171,7 @@ void PathItem::writePathAsCubicSegmentsOnly()
|
||||
|
||||
QList<ModelNode> pathSegmentNodes = pathNode.nodeListProperty("pathElements").toModelNodeList();
|
||||
|
||||
foreach (ModelNode pathSegment, pathSegmentNodes)
|
||||
for (ModelNode pathSegment : pathSegmentNodes)
|
||||
pathSegment.destroy();
|
||||
|
||||
if (!m_cubicSegments.isEmpty()) {
|
||||
@@ -179,7 +179,7 @@ void PathItem::writePathAsCubicSegmentsOnly()
|
||||
pathNode.variantProperty("startY").setValue(m_cubicSegments.constFirst().firstControlPoint().coordinate().y());
|
||||
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, m_cubicSegments) {
|
||||
for (const CubicSegment &cubicSegment : qAsConst(m_cubicSegments)) {
|
||||
writePathAttributes(pathNode, cubicSegment.attributes());
|
||||
writePathPercent(pathNode, cubicSegment.percent());
|
||||
writeCubicPath(pathNode, cubicSegment);
|
||||
@@ -234,7 +234,7 @@ static void drawCubicSegments(const QList<CubicSegment> &cubicSegments, QPainter
|
||||
|
||||
QPainterPath curvePainterPath(cubicSegments.constFirst().firstControlPoint().coordinate());
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, cubicSegments)
|
||||
for (const CubicSegment &cubicSegment : cubicSegments)
|
||||
addCubicSegmentToPainterPath(cubicSegment, curvePainterPath);
|
||||
|
||||
painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
|
||||
@@ -269,7 +269,7 @@ static void drawControlLines(const QList<CubicSegment> &cubicSegments, QPainter
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, cubicSegments)
|
||||
for (const CubicSegment &cubicSegment : cubicSegments)
|
||||
drawControlLine(cubicSegment, painter);
|
||||
|
||||
painter->restore();
|
||||
@@ -313,7 +313,7 @@ static void drawControlPoints(const QList<ControlPoint> &controlPoints, const QL
|
||||
{
|
||||
painter->save();
|
||||
|
||||
foreach (const ControlPoint &controlPoint, controlPoints)
|
||||
for (const ControlPoint &controlPoint : controlPoints)
|
||||
drawControlPoint(controlPoint, selectionPoints, painter);
|
||||
|
||||
painter->restore();
|
||||
@@ -337,7 +337,7 @@ static void drawPostionOverlays(const QList<SelectionPoint> &selectedPoints, QPa
|
||||
painter->setFont(font);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
|
||||
foreach (const SelectionPoint &selectedPoint, selectedPoints)
|
||||
for (const SelectionPoint &selectedPoint : selectedPoints)
|
||||
drawPositionOverlay(selectedPoint.controlPoint, painter);
|
||||
|
||||
painter->restore();
|
||||
@@ -465,7 +465,7 @@ static QRectF boundingRectForPath(const QList<ControlPoint> &controlPoints)
|
||||
double yMinimum = 0.;
|
||||
double yMaximum = 0.;
|
||||
|
||||
foreach (const ControlPoint & controlPoint, controlPoints) {
|
||||
for (const ControlPoint & controlPoint : controlPoints) {
|
||||
xMinimum = qMin(xMinimum, controlPoint.coordinate().x());
|
||||
xMaximum = qMax(xMaximum, controlPoint.coordinate().x());
|
||||
yMinimum = qMin(yMinimum, controlPoint.coordinate().y());
|
||||
@@ -507,7 +507,8 @@ void PathItem::readControlPoints()
|
||||
QMap<QString, QVariant> actualAttributes;
|
||||
double percent = -1.0;
|
||||
|
||||
foreach (const ModelNode &childNode, pathNode.nodeListProperty("pathElements").toModelNodeList()) {
|
||||
const QList<ModelNode> childNodes = pathNode.nodeListProperty("pathElements").toModelNodeList();
|
||||
for (const ModelNode &childNode : childNodes) {
|
||||
|
||||
if (childNode.type() == "QtQuick.PathAttribute") {
|
||||
actualAttributes.insert(childNode.variantProperty("name").value().toString(), childNode.variantProperty("value").value());
|
||||
@@ -554,7 +555,7 @@ static CubicSegment getMinimumDistanceSegment(const QPointF &pickPoint, const QL
|
||||
CubicSegment minimumDistanceSegment;
|
||||
double actualMinimumDistance = maximumDistance;
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, cubicSegments) {
|
||||
for (const CubicSegment &cubicSegment : cubicSegments) {
|
||||
double tSegment = 0.;
|
||||
double cubicSegmentMinimumDistance = cubicSegment.minimumDistance(pickPoint, tSegment);
|
||||
if (cubicSegmentMinimumDistance < actualMinimumDistance) {
|
||||
@@ -689,7 +690,7 @@ const QList<ControlPoint> PathItem::controlPoints() const
|
||||
if (!m_cubicSegments.isEmpty())
|
||||
controlPointList.append(m_cubicSegments.constFirst().firstControlPoint());
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, m_cubicSegments) {
|
||||
for (const CubicSegment &cubicSegment : qAsConst(m_cubicSegments)) {
|
||||
controlPointList.append(cubicSegment.secondControlPoint());
|
||||
controlPointList.append(cubicSegment.thirdControlPoint());
|
||||
controlPointList.append(cubicSegment.fourthControlPoint());
|
||||
@@ -703,7 +704,7 @@ const QList<ControlPoint> PathItem::controlPoints() const
|
||||
|
||||
bool hasLineOrQuadPathElements(const QList<ModelNode> &modelNodes)
|
||||
{
|
||||
foreach (const ModelNode &modelNode, modelNodes) {
|
||||
for (const ModelNode &modelNode : modelNodes) {
|
||||
if (modelNode.type() == "QtQuick.PathLine"
|
||||
|| modelNode.type() == "QtQuick.PathQuad")
|
||||
return true;
|
||||
@@ -752,7 +753,7 @@ static bool controlPointIsNearMousePosition(const ControlPoint &controlPoint, co
|
||||
|
||||
static bool controlPointsAreNearMousePosition(const QList<ControlPoint> &controlPoints, const QPointF &mousePosition)
|
||||
{
|
||||
foreach (const ControlPoint &controlPoint, controlPoints) {
|
||||
for (const ControlPoint &controlPoint : controlPoints) {
|
||||
if (controlPointIsNearMousePosition(controlPoint, mousePosition))
|
||||
return true;
|
||||
}
|
||||
@@ -762,7 +763,7 @@ static bool controlPointsAreNearMousePosition(const QList<ControlPoint> &control
|
||||
|
||||
static ControlPoint pickControlPoint(const QList<ControlPoint> &controlPoints, const QPointF &mousePosition)
|
||||
{
|
||||
foreach (const ControlPoint &controlPoint, controlPoints) {
|
||||
for (const ControlPoint &controlPoint : controlPoints) {
|
||||
if (controlPointIsNearMousePosition(controlPoint, mousePosition))
|
||||
return controlPoint;
|
||||
}
|
||||
@@ -837,7 +838,7 @@ void PathItem::updatePathModelNodes(const QList<SelectionPoint> &changedPoints)
|
||||
RewriterTransaction rewriterTransaction =
|
||||
formEditorItem()->qmlItemNode().view()->beginRewriterTransaction(QByteArrayLiteral("PathItem::createCubicSegmentContextMenu"));
|
||||
|
||||
foreach (SelectionPoint changedPoint, changedPoints)
|
||||
for (SelectionPoint changedPoint : changedPoints)
|
||||
changedPoint.controlPoint.updateModelNode();
|
||||
|
||||
rewriterTransaction.commit();
|
||||
@@ -923,7 +924,7 @@ QList<CubicSegment> cubicSegmentsContainingControlPoint(const ControlPoint &cont
|
||||
{
|
||||
QList<CubicSegment> cubicSegmentsHasControlPoint;
|
||||
|
||||
foreach (const CubicSegment &cubicSegment, allCubicSegments) {
|
||||
for (const CubicSegment &cubicSegment : allCubicSegments) {
|
||||
if (cubicSegment.controlPoints().contains(controlPoint))
|
||||
cubicSegmentsHasControlPoint.append(cubicSegment);
|
||||
}
|
||||
|
@@ -119,13 +119,13 @@ QList<ControlPoint> PathSelectionManipulator::allControlPoints()
|
||||
{
|
||||
QList<ControlPoint> controlPoints;
|
||||
|
||||
foreach (const SelectionPoint &selectionPoint, m_singleSelectedPoints)
|
||||
for (const SelectionPoint &selectionPoint : qAsConst(m_singleSelectedPoints))
|
||||
controlPoints.append(selectionPoint.controlPoint);
|
||||
|
||||
foreach (const SelectionPoint &selectionPoint, m_automaticallyAddedSinglePoints)
|
||||
for (const SelectionPoint &selectionPoint : qAsConst(m_automaticallyAddedSinglePoints))
|
||||
controlPoints.append(selectionPoint.controlPoint);
|
||||
|
||||
foreach (const SelectionPoint &selectionPoint, m_multiSelectedPoints)
|
||||
for (const SelectionPoint &selectionPoint : qAsConst(m_multiSelectedPoints))
|
||||
controlPoints.append(selectionPoint.controlPoint);
|
||||
|
||||
return controlPoints;
|
||||
@@ -155,7 +155,8 @@ void PathSelectionManipulator::updateMultiSelection(const QPointF &updatePoint)
|
||||
|
||||
QRectF selectionRect(m_startPoint, updatePoint);
|
||||
|
||||
foreach (const ControlPoint &controlPoint, m_pathItem->controlPoints()) {
|
||||
const QList<ControlPoint> controlPoints = m_pathItem->controlPoints();
|
||||
for (const ControlPoint &controlPoint : controlPoints) {
|
||||
if (selectionRect.contains(controlPoint.coordinate()))
|
||||
addMultiSelectionControlPoint(controlPoint);
|
||||
}
|
||||
@@ -236,7 +237,7 @@ QPointF manipulatedVector(const QPointF &vector, Qt::KeyboardModifiers keyboardM
|
||||
|
||||
static void moveControlPoints(const QList<SelectionPoint> &movePoints, const QPointF &offsetVector)
|
||||
{
|
||||
foreach (SelectionPoint movePoint, movePoints)
|
||||
for (SelectionPoint movePoint : movePoints)
|
||||
movePoint.controlPoint.setCoordinate(movePoint.startPosition + offsetVector);
|
||||
}
|
||||
|
||||
@@ -266,11 +267,11 @@ bool PathSelectionManipulator::isMoving() const
|
||||
|
||||
void PathSelectionManipulator::updateMultiSelectedStartPoint()
|
||||
{
|
||||
QList<SelectionPoint> oldSelectionPoints = m_multiSelectedPoints;
|
||||
const QList<SelectionPoint> oldSelectionPoints = m_multiSelectedPoints;
|
||||
|
||||
m_multiSelectedPoints.clear();
|
||||
|
||||
foreach (SelectionPoint selectionPoint, oldSelectionPoints) {
|
||||
for (SelectionPoint selectionPoint : oldSelectionPoints) {
|
||||
selectionPoint.startPosition = selectionPoint.controlPoint.coordinate();
|
||||
m_multiSelectedPoints.append(selectionPoint);
|
||||
}
|
||||
|
@@ -277,7 +277,7 @@ void PathTool::instancesParentChanged(const QList<FormEditorItem *> & /*itemLis
|
||||
void PathTool::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
|
||||
{
|
||||
using ModelNodePropertyNamePair = QPair<ModelNode, PropertyName>;
|
||||
foreach (const ModelNodePropertyNamePair &propertyPair, propertyList) {
|
||||
for (const ModelNodePropertyNamePair &propertyPair : propertyList) {
|
||||
if (propertyPair.first == m_pathItem->formEditorItem()->qmlItemNode().modelNode()
|
||||
&& propertyPair.second == "path")
|
||||
m_pathItem->updatePath();
|
||||
|
@@ -78,7 +78,7 @@ bool variantPropertyInEditedPath(const VariantProperty &variantProperty, const M
|
||||
|
||||
bool changesEditedPath(const QList<VariantProperty> &propertyList, const ModelNode &editingPathViewModelNode)
|
||||
{
|
||||
foreach (const VariantProperty variantProperty, propertyList) {
|
||||
for (const VariantProperty &variantProperty : propertyList) {
|
||||
if (variantPropertyInEditedPath(variantProperty, editingPathViewModelNode))
|
||||
return true;
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ QmlJS::SimpleReaderNode::Ptr templateConfiguration()
|
||||
QStringList variantToStringList(const QVariant &variant) {
|
||||
QStringList stringList;
|
||||
|
||||
foreach (const QVariant &singleValue, variant.toList())
|
||||
for (const QVariant &singleValue : variant.toList())
|
||||
stringList << singleValue.toString();
|
||||
|
||||
return stringList;
|
||||
@@ -410,7 +410,8 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
|
||||
if (propertyEditorBenchmark().isInfoEnabled())
|
||||
time.start();
|
||||
|
||||
foreach (const PropertyName &propertyName, qmlObjectNode.modelNode().metaInfo().propertyNames())
|
||||
const QList<PropertyName> propertyNames = qmlObjectNode.modelNode().metaInfo().propertyNames();
|
||||
for (const PropertyName &propertyName : propertyNames)
|
||||
createPropertyEditorValue(qmlObjectNode, propertyName, qmlObjectNode.instanceValue(propertyName), propertyEditor);
|
||||
|
||||
setupLayoutAttachedProperties(qmlObjectNode, propertyEditor);
|
||||
@@ -508,7 +509,8 @@ void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl
|
||||
{
|
||||
NodeMetaInfo metaInfo = propertyEditor->model()->metaInfo(typeName);
|
||||
|
||||
foreach (const PropertyName &propertyName, metaInfo.propertyNames())
|
||||
const QList<PropertyName> propertyNames = metaInfo.propertyNames();
|
||||
for (const PropertyName &propertyName : propertyNames)
|
||||
setupPropertyEditorValue(propertyName, propertyEditor, QString::fromUtf8(metaInfo.propertyTypeName(propertyName)));
|
||||
|
||||
auto valueObject = qobject_cast<PropertyEditorValue *>(variantToQObject(
|
||||
@@ -898,7 +900,8 @@ void PropertyEditorQmlBackend::setValueforAuxiliaryProperties(const QmlObjectNod
|
||||
QUrl PropertyEditorQmlBackend::getQmlUrlForMetaInfo(const NodeMetaInfo &metaInfo, TypeName &className)
|
||||
{
|
||||
if (metaInfo.isValid()) {
|
||||
foreach (const NodeMetaInfo &info, metaInfo.classHierarchy()) {
|
||||
const QList<NodeMetaInfo> hierarchy = metaInfo.classHierarchy();
|
||||
for (const NodeMetaInfo &info : hierarchy) {
|
||||
QUrl fileUrl = fileToUrl(locateQmlFile(info, QString::fromUtf8(qmlFileName(info))));
|
||||
if (fileUrl.isValid()) {
|
||||
className = info.typeName();
|
||||
|
@@ -600,10 +600,10 @@ void PropertyEditorNodeWrapper::remove()
|
||||
}
|
||||
m_modelNode = QmlDesigner::ModelNode();
|
||||
|
||||
foreach (const QString &propertyName, m_valuesPropertyMap.keys())
|
||||
const QStringList propertyNames = m_valuesPropertyMap.keys();
|
||||
for (const QString &propertyName : propertyNames)
|
||||
m_valuesPropertyMap.clear(propertyName);
|
||||
foreach (QObject *object, m_valuesPropertyMap.children())
|
||||
delete object;
|
||||
qDeleteAll(m_valuesPropertyMap.children());
|
||||
emit propertiesChanged();
|
||||
emit existsChanged();
|
||||
}
|
||||
@@ -633,12 +633,13 @@ void PropertyEditorNodeWrapper::setup()
|
||||
Q_ASSERT(m_editorValue->modelNode().isValid());
|
||||
if ((m_editorValue->modelNode().isValid() && m_modelNode.isValid())) {
|
||||
QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
|
||||
foreach ( const QString &propertyName, m_valuesPropertyMap.keys())
|
||||
const QStringList propertyNames = m_valuesPropertyMap.keys();
|
||||
for (const QString &propertyName : propertyNames)
|
||||
m_valuesPropertyMap.clear(propertyName);
|
||||
foreach (QObject *object, m_valuesPropertyMap.children())
|
||||
delete object;
|
||||
qDeleteAll(m_valuesPropertyMap.children());
|
||||
|
||||
foreach (const QmlDesigner::PropertyName &propertyName, m_modelNode.metaInfo().propertyNames()) {
|
||||
const QList<QmlDesigner::PropertyName> propertyNameList = m_modelNode.metaInfo().propertyNames();
|
||||
for (const QmlDesigner::PropertyName &propertyName : propertyNameList) {
|
||||
if (qmlObjectNode.isValid()) {
|
||||
auto valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
||||
valueObject->setName(propertyName);
|
||||
|
@@ -463,7 +463,8 @@ void PropertyEditorView::setupQmlBackend()
|
||||
TypeName diffClassName;
|
||||
if (commonAncestor.isValid()) {
|
||||
diffClassName = commonAncestor.typeName();
|
||||
foreach (const NodeMetaInfo &metaInfo, commonAncestor.classHierarchy()) {
|
||||
const QList<NodeMetaInfo> hierarchy = commonAncestor.classHierarchy();
|
||||
for (const NodeMetaInfo &metaInfo : hierarchy) {
|
||||
if (PropertyEditorQmlBackend::checkIfUrlExists(qmlSpecificsFile))
|
||||
break;
|
||||
qmlSpecificsFile = PropertyEditorQmlBackend::getQmlFileUrl(metaInfo.typeName() + "Specifics", metaInfo);
|
||||
@@ -640,7 +641,7 @@ void PropertyEditorView::propertiesRemoved(const QList<AbstractProperty>& proper
|
||||
if (noValidSelection())
|
||||
return;
|
||||
|
||||
foreach (const AbstractProperty &property, propertyList) {
|
||||
for (const AbstractProperty &property : propertyList) {
|
||||
ModelNode node(property.parentModelNode());
|
||||
|
||||
if (node.isRootNode() && !m_selectedNode.isRootNode())
|
||||
@@ -678,7 +679,7 @@ void PropertyEditorView::variantPropertiesChanged(const QList<VariantProperty>&
|
||||
if (noValidSelection())
|
||||
return;
|
||||
|
||||
foreach (const VariantProperty &property, propertyList) {
|
||||
for (const VariantProperty &property : propertyList) {
|
||||
ModelNode node(property.parentModelNode());
|
||||
|
||||
if (propertyIsAttachedLayoutProperty(property.name()))
|
||||
@@ -701,7 +702,7 @@ void PropertyEditorView::bindingPropertiesChanged(const QList<BindingProperty>&
|
||||
if (noValidSelection())
|
||||
return;
|
||||
|
||||
foreach (const BindingProperty &property, propertyList) {
|
||||
for (const BindingProperty &property : propertyList) {
|
||||
ModelNode node(property.parentModelNode());
|
||||
|
||||
if (property.isAliasExport())
|
||||
@@ -809,7 +810,7 @@ void PropertyEditorView::instancePropertyChanged(const QList<QPair<ModelNode, Pr
|
||||
m_locked = true;
|
||||
|
||||
using ModelNodePropertyPair = QPair<ModelNode, PropertyName>;
|
||||
foreach (const ModelNodePropertyPair &propertyPair, propertyList) {
|
||||
for (const ModelNodePropertyPair &propertyPair : propertyList) {
|
||||
const ModelNode modelNode = propertyPair.first;
|
||||
const QmlObjectNode qmlObjectNode(modelNode);
|
||||
const PropertyName propertyName = propertyPair.second;
|
||||
|
@@ -592,11 +592,11 @@ QStringList QmlAnchorBindingProxy::possibleTargetItems() const
|
||||
itemList.removeOne(m_qmlItemNode);
|
||||
//We currently have no instanceChildren().
|
||||
//So we double check here if the instanceParents are equal.
|
||||
foreach (const QmlItemNode &node, itemList)
|
||||
for (const QmlItemNode &node : qAsConst(itemList))
|
||||
if (node.isValid() && (node.instanceParent().modelNode() != m_qmlItemNode.instanceParent().modelNode()))
|
||||
itemList.removeAll(node);
|
||||
|
||||
foreach (const QmlItemNode &itemNode, itemList) {
|
||||
for (const QmlItemNode &itemNode : qAsConst(itemList)) {
|
||||
if (itemNode.isValid() && !itemNode.id().isEmpty())
|
||||
stringList.append(itemNode.id());
|
||||
}
|
||||
|
@@ -546,7 +546,7 @@ void RichTextEditor::setupFontActions()
|
||||
w->setEditable(true);
|
||||
|
||||
const QList<int> standardSizes = QFontDatabase::standardSizes();
|
||||
foreach (int size, standardSizes)
|
||||
for (const int size : standardSizes)
|
||||
w->addItem(QString::number(size));
|
||||
w->setCurrentText(QString::number(ui->textEdit->currentCharFormat().font().pointSize()));
|
||||
connect(w, &QComboBox::textActivated, [this](const QString &p) {
|
||||
|
@@ -286,8 +286,8 @@ bool StatesEditorView::validStateName(const QString &name) const
|
||||
{
|
||||
if (name == tr("base state"))
|
||||
return false;
|
||||
QList<QmlModelState> modelStates = rootStateGroup().allStates();
|
||||
foreach (const QmlModelState &state, modelStates) {
|
||||
const QList<QmlModelState> modelStates = rootStateGroup().allStates();
|
||||
for (const QmlModelState &state : modelStates) {
|
||||
if (state.name() == name)
|
||||
return false;
|
||||
}
|
||||
@@ -491,7 +491,7 @@ void StatesEditorView::modelAboutToBeDetached(Model *model)
|
||||
|
||||
void StatesEditorView::propertiesRemoved(const QList<AbstractProperty>& propertyList)
|
||||
{
|
||||
foreach (const AbstractProperty &property, propertyList) {
|
||||
for (const AbstractProperty &property : propertyList) {
|
||||
if (property.name() == "states" && property.parentModelNode().isRootNode())
|
||||
resetModel();
|
||||
if (property.name() == "when" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
|
||||
@@ -548,7 +548,7 @@ void StatesEditorView::bindingPropertiesChanged(const QList<BindingProperty> &pr
|
||||
{
|
||||
Q_UNUSED(propertyChange)
|
||||
|
||||
foreach (const BindingProperty &property, propertyList) {
|
||||
for (const BindingProperty &property : propertyList) {
|
||||
if (property.name() == "when" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
|
||||
resetModel();
|
||||
}
|
||||
@@ -588,7 +588,7 @@ void StatesEditorView::instancesPreviewImageChanged(const QVector<ModelNode> &no
|
||||
|
||||
int minimumIndex = 10000;
|
||||
int maximumIndex = -1;
|
||||
foreach (const ModelNode &node, nodeList) {
|
||||
for (const ModelNode &node : nodeList) {
|
||||
if (node.isRootNode()) {
|
||||
minimumIndex = qMin(minimumIndex, 0);
|
||||
maximumIndex = qMax(maximumIndex, 0);
|
||||
|
@@ -240,7 +240,7 @@ void TextTool::instancesParentChanged(const QList<FormEditorItem *> & /*itemLis
|
||||
void TextTool::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
|
||||
{
|
||||
using ModelNodePropertyNamePair = QPair<ModelNode, PropertyName>;
|
||||
foreach (const ModelNodePropertyNamePair &propertyPair, propertyList) {
|
||||
for (const ModelNodePropertyNamePair &propertyPair : propertyList) {
|
||||
if (propertyPair.first == textItem()->formEditorItem()->qmlItemNode().modelNode()
|
||||
&& propertyPair.second == "text")
|
||||
textItem()->updateText();
|
||||
|
@@ -86,7 +86,8 @@ void EnterTabDesignerAction::updateContext()
|
||||
&& selectedModelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView")) {
|
||||
|
||||
const NodeAbstractProperty defaultProperty = selectedModelNode.defaultNodeAbstractProperty();
|
||||
foreach (const QmlDesigner::ModelNode &childModelNode, defaultProperty.directSubNodes()) {
|
||||
const QList<QmlDesigner::ModelNode> childModelNodes = defaultProperty.directSubNodes();
|
||||
for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) {
|
||||
createActionForTab(childModelNode);
|
||||
}
|
||||
}
|
||||
|
@@ -61,10 +61,11 @@ void TabViewIndexModel::setupModel()
|
||||
if (m_modelNode.isValid()
|
||||
&& m_modelNode.metaInfo().isValid()
|
||||
&& m_modelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView")) {
|
||||
|
||||
foreach (const QmlDesigner::ModelNode &childModelNode, m_modelNode.defaultNodeAbstractProperty().directSubNodes()) {
|
||||
const QList<QmlDesigner::ModelNode> childModelNodes
|
||||
= m_modelNode.defaultNodeAbstractProperty().directSubNodes();
|
||||
for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) {
|
||||
if (childModelNode.metaInfo().isValid()
|
||||
&& childModelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")) {
|
||||
&& childModelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")) {
|
||||
QmlDesigner::QmlItemNode itemNode(childModelNode);
|
||||
if (itemNode.isValid()) {
|
||||
m_tabViewIndexModel.append(itemNode.instanceValue("title").toString());
|
||||
|
@@ -67,7 +67,8 @@ static inline QHash<PropertyName, QVariant> getProperties(const ModelNode &node)
|
||||
{
|
||||
QHash<PropertyName, QVariant> propertyHash;
|
||||
if (QmlObjectNode::isValidQmlObjectNode(node)) {
|
||||
foreach (const AbstractProperty &abstractProperty, node.properties()) {
|
||||
const QList<AbstractProperty> abstractProperties = node.properties();
|
||||
for (const AbstractProperty &abstractProperty : abstractProperties) {
|
||||
if (abstractProperty.isVariantProperty()
|
||||
|| (abstractProperty.isBindingProperty()
|
||||
&& !abstractProperty.name().contains("anchors.")))
|
||||
@@ -91,9 +92,10 @@ static inline QHash<PropertyName, QVariant> getProperties(const ModelNode &node)
|
||||
|
||||
static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash)
|
||||
{
|
||||
QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData();
|
||||
const QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData();
|
||||
|
||||
foreach (const PropertyName &propertyName, auxiliaryData.keys()) {
|
||||
const QList<PropertyName> propertyNames = auxiliaryData.keys();
|
||||
for (const PropertyName &propertyName : propertyNames) {
|
||||
if (node.hasAuxiliaryData(propertyName))
|
||||
node.setAuxiliaryData(propertyName, QVariant());
|
||||
}
|
||||
@@ -281,7 +283,7 @@ bool DocumentManager::hasCurrentDesignDocument() const
|
||||
|
||||
void DocumentManager::removeEditors(const QList<Core::IEditor *> &editors)
|
||||
{
|
||||
foreach (Core::IEditor *editor, editors)
|
||||
for (Core::IEditor *editor : editors)
|
||||
delete m_designDocumentHash.take(editor).data();
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,7 @@ void OpenUiQmlFileDialog::setUiQmlFiles(const QString &projectPath, const QStrin
|
||||
{
|
||||
QDir projectDir(projectPath);
|
||||
|
||||
foreach (const QString &fileName, stringList) {
|
||||
for (const QString &fileName : stringList) {
|
||||
QListWidgetItem *item = new QListWidgetItem(projectDir.relativeFilePath(fileName), ui->listWidget);
|
||||
item->setData(Qt::UserRole, fileName);
|
||||
ui->listWidget->addItem(item);
|
||||
|
@@ -369,7 +369,8 @@ static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileNam
|
||||
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(fileName);
|
||||
|
||||
if (currentProject) {
|
||||
foreach (const Utils::FilePath &fileName, currentProject->files(ProjectExplorer::Project::SourceFiles)) {
|
||||
const QList<Utils::FilePath> fileNames = currentProject->files(ProjectExplorer::Project::SourceFiles);
|
||||
for (const Utils::FilePath &fileName : fileNames) {
|
||||
if (fileName.endsWith(".ui.qml"))
|
||||
list.append(fileName.toString());
|
||||
}
|
||||
|
Reference in New Issue
Block a user