forked from qt-creator/qt-creator
qml2puppet: Remove foreach usage
Change-Id: I00af71e640a46962f987f7eb7d360f04d68f23ea Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -14,7 +14,7 @@ ChangeValuesCommand::ChangeValuesCommand(const QVector<PropertyValueContainer> &
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<PropertyValueContainer> ChangeValuesCommand::valueChanges() const
|
const QVector<PropertyValueContainer> ChangeValuesCommand::valueChanges() const
|
||||||
{
|
{
|
||||||
return m_valueChangeVector;
|
return m_valueChangeVector;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ public:
|
|||||||
ChangeValuesCommand();
|
ChangeValuesCommand();
|
||||||
explicit ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector);
|
explicit ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector);
|
||||||
|
|
||||||
QVector<PropertyValueContainer> valueChanges() const;
|
const QVector<PropertyValueContainer> valueChanges() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<PropertyValueContainer> m_valueChangeVector;
|
QVector<PropertyValueContainer> m_valueChangeVector;
|
||||||
|
@@ -15,7 +15,7 @@ CompleteComponentCommand::CompleteComponentCommand(const QVector<qint32> &contai
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<qint32> CompleteComponentCommand::instances() const
|
const QVector<qint32> CompleteComponentCommand::instances() const
|
||||||
{
|
{
|
||||||
return m_instanceVector;
|
return m_instanceVector;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ public:
|
|||||||
CompleteComponentCommand();
|
CompleteComponentCommand();
|
||||||
explicit CompleteComponentCommand(const QVector<qint32> &container);
|
explicit CompleteComponentCommand(const QVector<qint32> &container);
|
||||||
|
|
||||||
QVector<qint32> instances() const;
|
const QVector<qint32> instances() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<qint32> m_instanceVector;
|
QVector<qint32> m_instanceVector;
|
||||||
|
@@ -15,7 +15,7 @@ RemoveInstancesCommand::RemoveInstancesCommand(const QVector<qint32> &idVector)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<qint32> RemoveInstancesCommand::instanceIds() const
|
const QVector<qint32> RemoveInstancesCommand::instanceIds() const
|
||||||
{
|
{
|
||||||
return m_instanceIdVector;
|
return m_instanceIdVector;
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
RemoveInstancesCommand();
|
RemoveInstancesCommand();
|
||||||
explicit RemoveInstancesCommand(const QVector<qint32> &idVector);
|
explicit RemoveInstancesCommand(const QVector<qint32> &idVector);
|
||||||
|
|
||||||
QVector<qint32> instanceIds() const;
|
const QVector<qint32> instanceIds() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<qint32> m_instanceIdVector;
|
QVector<qint32> m_instanceIdVector;
|
||||||
|
@@ -14,7 +14,7 @@ RemovePropertiesCommand::RemovePropertiesCommand(const QVector<PropertyAbstractC
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<PropertyAbstractContainer> RemovePropertiesCommand::properties() const
|
const QVector<PropertyAbstractContainer> RemovePropertiesCommand::properties() const
|
||||||
{
|
{
|
||||||
return m_properties;
|
return m_properties;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ public:
|
|||||||
RemovePropertiesCommand();
|
RemovePropertiesCommand();
|
||||||
explicit RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties);
|
explicit RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties);
|
||||||
|
|
||||||
QVector<PropertyAbstractContainer> properties() const;
|
const QVector<PropertyAbstractContainer> properties() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<PropertyAbstractContainer> m_properties;
|
QVector<PropertyAbstractContainer> m_properties;
|
||||||
|
@@ -15,7 +15,7 @@ ReparentInstancesCommand::ReparentInstancesCommand(const QVector<ReparentContain
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<ReparentContainer> ReparentInstancesCommand::reparentInstances() const
|
const QVector<ReparentContainer> ReparentInstancesCommand::reparentInstances() const
|
||||||
{
|
{
|
||||||
return m_reparentInstanceVector;
|
return m_reparentInstanceVector;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ public:
|
|||||||
ReparentInstancesCommand();
|
ReparentInstancesCommand();
|
||||||
explicit ReparentInstancesCommand(const QVector<ReparentContainer> &container);
|
explicit ReparentInstancesCommand(const QVector<ReparentContainer> &container);
|
||||||
|
|
||||||
QVector<ReparentContainer> reparentInstances() const;
|
const QVector<ReparentContainer> reparentInstances() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<ReparentContainer> m_reparentInstanceVector;
|
QVector<ReparentContainer> m_reparentInstanceVector;
|
||||||
|
@@ -87,7 +87,8 @@ int NodeInstanceSignalSpy::qt_metacall(QMetaObject::Call call, int methodId, voi
|
|||||||
ObjectNodeInstance::Pointer nodeInstance = m_objectNodeInstance.toStrongRef();
|
ObjectNodeInstance::Pointer nodeInstance = m_objectNodeInstance.toStrongRef();
|
||||||
|
|
||||||
if (nodeInstance && nodeInstance->nodeInstanceServer() && nodeInstance->isValid()) {
|
if (nodeInstance && nodeInstance->nodeInstanceServer() && nodeInstance->isValid()) {
|
||||||
foreach (const PropertyName &propertyName, m_indexPropertyHash.values(methodId))
|
const QList<PropertyName> values = m_indexPropertyHash.values(methodId);
|
||||||
|
for (const PropertyName &propertyName : values)
|
||||||
nodeInstance->nodeInstanceServer()->notifyPropertyChange(nodeInstance->instanceId(), propertyName);
|
nodeInstance->nodeInstanceServer()->notifyPropertyChange(nodeInstance->instanceId(), propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -300,7 +300,7 @@ static void removeObjectFromList(const QQmlProperty &property,
|
|||||||
|
|
||||||
listReference.clear();
|
listReference.clear();
|
||||||
|
|
||||||
foreach (QObject *object, objectList)
|
for (QObject *object : std::as_const(objectList))
|
||||||
listReference.append(object);
|
listReference.append(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +761,8 @@ QObject *ObjectNodeInstance::createComponentWrap(const QString &nodeSource, cons
|
|||||||
|
|
||||||
if (component->isError()) {
|
if (component->isError()) {
|
||||||
qWarning() << "Error in:" << Q_FUNC_INFO << component->url().toString();
|
qWarning() << "Error in:" << Q_FUNC_INFO << component->url().toString();
|
||||||
foreach (const QQmlError &error, component->errors())
|
const QList<QQmlError> errors = component->errors();
|
||||||
|
for (const QQmlError &error : errors)
|
||||||
qWarning() << error;
|
qWarning() << error;
|
||||||
qWarning() << "file data:\n" << data;
|
qWarning() << "file data:\n" << data;
|
||||||
}
|
}
|
||||||
@@ -812,7 +813,8 @@ QObject *ObjectNodeInstance::createComponent([[maybe_unused]] const QString &com
|
|||||||
|
|
||||||
if (component.isError()) {
|
if (component.isError()) {
|
||||||
qDebug() << componentPath;
|
qDebug() << componentPath;
|
||||||
foreach (const QQmlError &error, component.errors())
|
const QList<QQmlError> errors = component.errors();
|
||||||
|
for (const QQmlError &error : errors)
|
||||||
qWarning() << error;
|
qWarning() << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,7 +849,8 @@ QObject *ObjectNodeInstance::createCustomParserObject(const QString &nodeSource,
|
|||||||
|
|
||||||
if (component.isError()) {
|
if (component.isError()) {
|
||||||
qWarning() << "Error in:" << Q_FUNC_INFO << component.url().toString();
|
qWarning() << "Error in:" << Q_FUNC_INFO << component.url().toString();
|
||||||
foreach (const QQmlError &error, component.errors())
|
const QList<QQmlError> errors = component.errors();
|
||||||
|
for (const QQmlError &error : errors)
|
||||||
qWarning() << error;
|
qWarning() << error;
|
||||||
qWarning() << "file data:\n" << data;
|
qWarning() << "file data:\n" << data;
|
||||||
}
|
}
|
||||||
|
@@ -1448,7 +1448,7 @@ Qt5InformationNodeInstanceServer::~Qt5InformationNodeInstanceServer()
|
|||||||
|
|
||||||
void Qt5InformationNodeInstanceServer::sendTokenBack()
|
void Qt5InformationNodeInstanceServer::sendTokenBack()
|
||||||
{
|
{
|
||||||
foreach (const TokenCommand &command, m_tokenList)
|
for (const TokenCommand &command : std::as_const(m_tokenList))
|
||||||
nodeInstanceClient()->token(command);
|
nodeInstanceClient()->token(command);
|
||||||
|
|
||||||
m_tokenList.clear();
|
m_tokenList.clear();
|
||||||
@@ -1471,7 +1471,8 @@ bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuic
|
|||||||
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, item->childItems()) {
|
const QList<QQuickItem *> childItems = item->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems) {
|
||||||
if (!hasInstanceForObject(childItem)) {
|
if (!hasInstanceForObject(childItem)) {
|
||||||
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
@@ -1971,7 +1972,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
QVector<InstancePropertyPair> propertyChangedList;
|
QVector<InstancePropertyPair> propertyChangedList;
|
||||||
|
|
||||||
if (quickWindow()) {
|
if (quickWindow()) {
|
||||||
foreach (QQuickItem *item, allItems()) {
|
for (QQuickItem *item : allItems()) {
|
||||||
if (item && hasInstanceForObject(item)) {
|
if (item && hasInstanceForObject(item)) {
|
||||||
ServerNodeInstance instance = instanceForObject(item);
|
ServerNodeInstance instance = instanceForObject(item);
|
||||||
|
|
||||||
@@ -1987,7 +1988,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const InstancePropertyPair& property, changedPropertyList()) {
|
for (const InstancePropertyPair& property : changedPropertyList()) {
|
||||||
const ServerNodeInstance instance = property.first;
|
const ServerNodeInstance instance = property.first;
|
||||||
if (instance.isValid()) {
|
if (instance.isValid()) {
|
||||||
if (property.second.contains("anchors"))
|
if (property.second.contains("anchors"))
|
||||||
@@ -2031,7 +2032,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
|
|
||||||
void Qt5InformationNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
void Qt5InformationNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||||
{
|
{
|
||||||
foreach (const ReparentContainer &container, command.reparentInstances()) {
|
for (const ReparentContainer &container : command.reparentInstances()) {
|
||||||
if (hasInstanceForId(container.instanceId())) {
|
if (hasInstanceForId(container.instanceId())) {
|
||||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||||
if (instance.isValid()) {
|
if (instance.isValid()) {
|
||||||
@@ -2094,7 +2095,7 @@ void Qt5InformationNodeInstanceServer::sendChildrenChangedCommand(const QList<Se
|
|||||||
QSet<ServerNodeInstance> parentSet;
|
QSet<ServerNodeInstance> parentSet;
|
||||||
QList<ServerNodeInstance> noParentList;
|
QList<ServerNodeInstance> noParentList;
|
||||||
|
|
||||||
foreach (const ServerNodeInstance &child, childList) {
|
for (const ServerNodeInstance &child : childList) {
|
||||||
if (child.isValid()) {
|
if (child.isValid()) {
|
||||||
if (!child.hasParent()) {
|
if (!child.hasParent()) {
|
||||||
noParentList.append(child);
|
noParentList.append(child);
|
||||||
@@ -2109,7 +2110,7 @@ void Qt5InformationNodeInstanceServer::sendChildrenChangedCommand(const QList<Se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const ServerNodeInstance &parent, parentSet)
|
for (const ServerNodeInstance &parent : std::as_const(parentSet))
|
||||||
nodeInstanceClient()->childrenChanged(createChildrenChangedCommand(parent, parent.childItems()));
|
nodeInstanceClient()->childrenChanged(createChildrenChangedCommand(parent, parent.childItems()));
|
||||||
|
|
||||||
if (!noParentList.isEmpty())
|
if (!noParentList.isEmpty())
|
||||||
@@ -2122,7 +2123,8 @@ void Qt5InformationNodeInstanceServer::completeComponent(const CompleteComponent
|
|||||||
Qt5NodeInstanceServer::completeComponent(command);
|
Qt5NodeInstanceServer::completeComponent(command);
|
||||||
|
|
||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
foreach (qint32 instanceId, command.instances()) {
|
QList<qint32> instances = command.instances();
|
||||||
|
for (qint32 instanceId : instances) {
|
||||||
if (hasInstanceForId(instanceId)) {
|
if (hasInstanceForId(instanceId)) {
|
||||||
ServerNodeInstance instance = instanceForId(instanceId);
|
ServerNodeInstance instance = instanceForId(instanceId);
|
||||||
if (instance.isValid()) {
|
if (instance.isValid()) {
|
||||||
|
@@ -147,7 +147,7 @@ void Qt5NodeInstanceServer::resizeCanvasToRootItem()
|
|||||||
|
|
||||||
void Qt5NodeInstanceServer::resetAllItems()
|
void Qt5NodeInstanceServer::resetAllItems()
|
||||||
{
|
{
|
||||||
foreach (QQuickItem *item, allItems())
|
for (QQuickItem *item : allItems())
|
||||||
QQuickDesignerSupport::resetDirty(item);
|
QQuickDesignerSupport::resetDirty(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,13 +167,14 @@ QList<QQuickItem*> subItems(QQuickItem *parentItem)
|
|||||||
QList<QQuickItem*> itemList;
|
QList<QQuickItem*> itemList;
|
||||||
itemList.append(parentItem->childItems());
|
itemList.append(parentItem->childItems());
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, parentItem->childItems())
|
const QList<QQuickItem *> childItems = parentItem->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems)
|
||||||
itemList.append(subItems(childItem));
|
itemList.append(subItems(childItem));
|
||||||
|
|
||||||
return itemList;
|
return itemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
|
const QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
|
||||||
{
|
{
|
||||||
if (rootNodeInstance().isValid())
|
if (rootNodeInstance().isValid())
|
||||||
return rootNodeInstance().allItemsRecursive();
|
return rootNodeInstance().allItemsRecursive();
|
||||||
|
@@ -57,7 +57,7 @@ protected:
|
|||||||
void resizeCanvasToRootItem() override;
|
void resizeCanvasToRootItem() override;
|
||||||
void resetAllItems();
|
void resetAllItems();
|
||||||
void setupScene(const CreateSceneCommand &command) override;
|
void setupScene(const CreateSceneCommand &command) override;
|
||||||
QList<QQuickItem*> allItems() const;
|
const QList<QQuickItem*> allItems() const;
|
||||||
bool rootIsRenderable3DObject() const;
|
bool rootIsRenderable3DObject() const;
|
||||||
|
|
||||||
struct RenderViewData {
|
struct RenderViewData {
|
||||||
|
@@ -56,7 +56,7 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
|||||||
|
|
||||||
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
|
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
|
||||||
bool windowDirty = false;
|
bool windowDirty = false;
|
||||||
foreach (QQuickItem *item, allItems()) {
|
for (QQuickItem *item : allItems()) {
|
||||||
if (item) {
|
if (item) {
|
||||||
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
|
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
|
||||||
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::AllMask)) {
|
if (QQuickDesignerSupport::isDirty(item, QQuickDesignerSupport::AllMask)) {
|
||||||
|
@@ -67,7 +67,7 @@ void Qt5TestNodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &comman
|
|||||||
void Qt5TestNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
|
void Qt5TestNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
|
||||||
{
|
{
|
||||||
bool hasDynamicProperties = false;
|
bool hasDynamicProperties = false;
|
||||||
foreach (const PropertyValueContainer &container, command.valueChanges()) {
|
for (const PropertyValueContainer &container : command.valueChanges()) {
|
||||||
hasDynamicProperties |= container.isDynamic();
|
hasDynamicProperties |= container.isDynamic();
|
||||||
setInstancePropertyVariant(container);
|
setInstancePropertyVariant(container);
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ void Qt5TestNodeInstanceServer::removeInstances(const RemoveInstancesCommand &co
|
|||||||
if (activeStateInstance().isValid())
|
if (activeStateInstance().isValid())
|
||||||
activeStateInstance().deactivateState();
|
activeStateInstance().deactivateState();
|
||||||
|
|
||||||
foreach (qint32 instanceId, command.instanceIds()) {
|
for (qint32 instanceId : command.instanceIds()) {
|
||||||
removeInstanceRelationsip(instanceId);
|
removeInstanceRelationsip(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ void Qt5TestNodeInstanceServer::removeInstances(const RemoveInstancesCommand &co
|
|||||||
void Qt5TestNodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
|
void Qt5TestNodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
|
||||||
{
|
{
|
||||||
bool hasDynamicProperties = false;
|
bool hasDynamicProperties = false;
|
||||||
foreach (const PropertyAbstractContainer &container, command.properties()) {
|
for (const PropertyAbstractContainer &container : command.properties()) {
|
||||||
hasDynamicProperties |= container.isDynamic();
|
hasDynamicProperties |= container.isDynamic();
|
||||||
resetInstanceProperty(container);
|
resetInstanceProperty(container);
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ void Qt5TestNodeInstanceServer::removeProperties(const RemovePropertiesCommand &
|
|||||||
|
|
||||||
void Qt5TestNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
void Qt5TestNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||||
{
|
{
|
||||||
foreach (const ReparentContainer &container, command.reparentInstances()) {
|
for (const ReparentContainer &container : command.reparentInstances()) {
|
||||||
if (hasInstanceForId(container.instanceId())) {
|
if (hasInstanceForId(container.instanceId())) {
|
||||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||||
if (instance.isValid()) {
|
if (instance.isValid()) {
|
||||||
@@ -201,7 +201,7 @@ void Qt5TestNodeInstanceServer::completeComponent(const CompleteComponentCommand
|
|||||||
{
|
{
|
||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
|
|
||||||
foreach (qint32 instanceId, command.instances()) {
|
for (qint32 instanceId : command.instances()) {
|
||||||
if (hasInstanceForId(instanceId)) {
|
if (hasInstanceForId(instanceId)) {
|
||||||
ServerNodeInstance instance = instanceForId(instanceId);
|
ServerNodeInstance instance = instanceForId(instanceId);
|
||||||
instance.doComponentComplete();
|
instance.doComponentComplete();
|
||||||
@@ -242,7 +242,7 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
|||||||
QSet<ServerNodeInstance> parentChangedSet;
|
QSet<ServerNodeInstance> parentChangedSet;
|
||||||
|
|
||||||
if (quickWindow()) {
|
if (quickWindow()) {
|
||||||
foreach (QQuickItem *item, allItems()) {
|
for (QQuickItem *item : allItems()) {
|
||||||
if (item && hasInstanceForObject(item)) {
|
if (item && hasInstanceForObject(item)) {
|
||||||
ServerNodeInstance instance = instanceForObject(item);
|
ServerNodeInstance instance = instanceForObject(item);
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const InstancePropertyPair& property, changedPropertyList()) {
|
for (const InstancePropertyPair& property : changedPropertyList()) {
|
||||||
const ServerNodeInstance instance = property.first;
|
const ServerNodeInstance instance = property.first;
|
||||||
if (instance.isValid()) {
|
if (instance.isValid()) {
|
||||||
if (property.second.contains("anchors"))
|
if (property.second.contains("anchors"))
|
||||||
@@ -292,7 +292,7 @@ void Qt5TestNodeInstanceServer::sendChildrenChangedCommand(const QList<ServerNod
|
|||||||
QSet<ServerNodeInstance> parentSet;
|
QSet<ServerNodeInstance> parentSet;
|
||||||
QList<ServerNodeInstance> noParentList;
|
QList<ServerNodeInstance> noParentList;
|
||||||
|
|
||||||
foreach (const ServerNodeInstance &child, childList) {
|
for (const ServerNodeInstance &child : childList) {
|
||||||
if (!child.hasParent()) {
|
if (!child.hasParent()) {
|
||||||
noParentList.append(child);
|
noParentList.append(child);
|
||||||
} else {
|
} else {
|
||||||
@@ -305,7 +305,7 @@ void Qt5TestNodeInstanceServer::sendChildrenChangedCommand(const QList<ServerNod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const ServerNodeInstance &parent, parentSet) {
|
for (const ServerNodeInstance &parent : std::as_const(parentSet)) {
|
||||||
ChildrenChangedCommand command = createChildrenChangedCommand(parent, parent.childItems());
|
ChildrenChangedCommand command = createChildrenChangedCommand(parent, parent.childItems());
|
||||||
command.sort();
|
command.sort();
|
||||||
nodeInstanceClient()->childrenChanged(command);
|
nodeInstanceClient()->childrenChanged(command);
|
||||||
@@ -329,7 +329,8 @@ bool Qt5TestNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *
|
|||||||
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(item, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, item->childItems()) {
|
const QList<QQuickItem *> childItems = item->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems) {
|
||||||
if (!hasInstanceForObject(childItem)) {
|
if (!hasInstanceForObject(childItem)) {
|
||||||
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
if (QQuickDesignerSupport::isDirty(childItem, informationsDirty))
|
||||||
return true;
|
return true;
|
||||||
|
@@ -95,7 +95,8 @@ QList<ServerNodeInstance> QuickItemNodeInstance::childItems() const
|
|||||||
{
|
{
|
||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, quickItem()->childItems())
|
const QList<QQuickItem *> childItems = quickItem()->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems)
|
||||||
{
|
{
|
||||||
if (childItem && nodeInstanceServer()->hasInstanceForObject(childItem)) {
|
if (childItem && nodeInstanceServer()->hasInstanceForObject(childItem)) {
|
||||||
instanceList.append(nodeInstanceServer()->instanceForObject(childItem));
|
instanceList.append(nodeInstanceServer()->instanceForObject(childItem));
|
||||||
@@ -216,7 +217,8 @@ static QList<QQuickItem *> allChildItemsRecursive(QQuickItem *parentItem)
|
|||||||
|
|
||||||
itemList.append(parentItem->childItems());
|
itemList.append(parentItem->childItems());
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, parentItem->childItems())
|
const QList<QQuickItem *> childItems = parentItem->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems)
|
||||||
itemList.append(allChildItemsRecursive(childItem));
|
itemList.append(allChildItemsRecursive(childItem));
|
||||||
|
|
||||||
return itemList;
|
return itemList;
|
||||||
@@ -556,8 +558,8 @@ bool QuickItemNodeInstance::isRenderable() const
|
|||||||
QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const
|
QList<ServerNodeInstance> QuickItemNodeInstance::stateInstances() const
|
||||||
{
|
{
|
||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem());
|
const QList<QObject*> stateList = QQuickDesignerSupport::statesForItem(quickItem());
|
||||||
foreach (QObject *state, stateList)
|
for (QObject *state : stateList)
|
||||||
{
|
{
|
||||||
if (state && nodeInstanceServer()->hasInstanceForObject(state))
|
if (state && nodeInstanceServer()->hasInstanceForObject(state))
|
||||||
instanceList.append(nodeInstanceServer()->instanceForObject(state));
|
instanceList.append(nodeInstanceServer()->instanceForObject(state));
|
||||||
@@ -596,7 +598,8 @@ Qt5NodeInstanceServer *QuickItemNodeInstance::qt5NodeInstanceServer() const
|
|||||||
|
|
||||||
void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) const
|
void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) const
|
||||||
{
|
{
|
||||||
foreach (QQuickItem *childItem, parentItem->childItems()) {
|
const QList<QQuickItem *> childItems = parentItem->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems) {
|
||||||
if (!nodeInstanceServer()->hasInstanceForObject(childItem))
|
if (!nodeInstanceServer()->hasInstanceForObject(childItem))
|
||||||
updateDirtyNodesRecursive(childItem);
|
updateDirtyNodesRecursive(childItem);
|
||||||
}
|
}
|
||||||
@@ -704,7 +707,8 @@ QList<ServerNodeInstance> QuickItemNodeInstance::childItemsForChild(QQuickItem *
|
|||||||
QList<ServerNodeInstance> instanceList;
|
QList<ServerNodeInstance> instanceList;
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
foreach (QQuickItem *childItem, item->childItems())
|
const QList<QQuickItem *> childItems = item->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems)
|
||||||
{
|
{
|
||||||
if (childItem && nodeInstanceServer()->hasInstanceForObject(childItem)) {
|
if (childItem && nodeInstanceServer()->hasInstanceForObject(childItem)) {
|
||||||
instanceList.append(nodeInstanceServer()->instanceForObject(childItem));
|
instanceList.append(nodeInstanceServer()->instanceForObject(childItem));
|
||||||
@@ -738,7 +742,8 @@ bool QuickItemNodeInstance::anyItemHasContent(QQuickItem *quickItem)
|
|||||||
if (quickItem->flags().testFlag(QQuickItem::ItemHasContents))
|
if (quickItem->flags().testFlag(QQuickItem::ItemHasContents))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, quickItem->childItems()) {
|
const QList<QQuickItem *> childItems = quickItem->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems) {
|
||||||
if (anyItemHasContent(childItem))
|
if (anyItemHasContent(childItem))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -748,7 +753,8 @@ bool QuickItemNodeInstance::anyItemHasContent(QQuickItem *quickItem)
|
|||||||
|
|
||||||
bool QuickItemNodeInstance::childItemsHaveContent(QQuickItem *quickItem)
|
bool QuickItemNodeInstance::childItemsHaveContent(QQuickItem *quickItem)
|
||||||
{
|
{
|
||||||
foreach (QQuickItem *childItem, quickItem->childItems()) {
|
const QList<QQuickItem *> childItems = quickItem->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems) {
|
||||||
if (anyItemHasContent(childItem))
|
if (anyItemHasContent(childItem))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1003,7 +1009,8 @@ QPair<PropertyName, ServerNodeInstance> QuickItemNodeInstance::anchor(const Prop
|
|||||||
bool QuickItemNodeInstance::isAnchoredBySibling() const
|
bool QuickItemNodeInstance::isAnchoredBySibling() const
|
||||||
{
|
{
|
||||||
if (quickItem()->parentItem()) {
|
if (quickItem()->parentItem()) {
|
||||||
foreach (QQuickItem *siblingItem, quickItem()->parentItem()->childItems()) { // search in siblings for a anchor to this item
|
const QList<QQuickItem *> childItems = quickItem()->parentItem()->childItems();
|
||||||
|
for (QQuickItem *siblingItem : childItems) { // search in siblings for a anchor to this item
|
||||||
if (siblingItem) {
|
if (siblingItem) {
|
||||||
if (QQuickDesignerSupport::isAnchoredTo(siblingItem, quickItem()))
|
if (QQuickDesignerSupport::isAnchoredTo(siblingItem, quickItem()))
|
||||||
return true;
|
return true;
|
||||||
|
@@ -223,7 +223,7 @@ QVariant fixResourcePaths(const QVariant &value)
|
|||||||
const QString path = QLatin1String("qrc:") + url.path();
|
const QString path = QLatin1String("qrc:") + url.path();
|
||||||
if (!qmlDesignerRCPath().isEmpty()) {
|
if (!qmlDesignerRCPath().isEmpty()) {
|
||||||
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
||||||
foreach (const QString &qrcPath, searchPaths) {
|
for (const QString &qrcPath : searchPaths) {
|
||||||
const QStringList qrcDefintion = qrcPath.split(QLatin1Char('='));
|
const QStringList qrcDefintion = qrcPath.split(QLatin1Char('='));
|
||||||
if (qrcDefintion.count() == 2) {
|
if (qrcDefintion.count() == 2) {
|
||||||
QString fixedPath = path;
|
QString fixedPath = path;
|
||||||
@@ -243,7 +243,7 @@ QVariant fixResourcePaths(const QVariant &value)
|
|||||||
if (str.contains(QLatin1String("qrc:"))) {
|
if (str.contains(QLatin1String("qrc:"))) {
|
||||||
if (!qmlDesignerRCPath().isEmpty()) {
|
if (!qmlDesignerRCPath().isEmpty()) {
|
||||||
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
const QStringList searchPaths = qmlDesignerRCPath().split(QLatin1Char(';'));
|
||||||
foreach (const QString &qrcPath, searchPaths) {
|
for (const QString &qrcPath : searchPaths) {
|
||||||
const QStringList qrcDefintion = qrcPath.split(QLatin1Char('='));
|
const QStringList qrcDefintion = qrcPath.split(QLatin1Char('='));
|
||||||
if (qrcDefintion.count() == 2) {
|
if (qrcDefintion.count() == 2) {
|
||||||
QString fixedPath = str;
|
QString fixedPath = str;
|
||||||
@@ -377,13 +377,14 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta
|
|||||||
QList<QObject*> childList = object->children();
|
QList<QObject*> childList = object->children();
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
foreach (QQuickItem *childItem, item->childItems()) {
|
const QList<QQuickItem *> childItems = item->childItems();
|
||||||
|
for (QQuickItem *childItem : childItems){
|
||||||
if (!childList.contains(childItem))
|
if (!childList.contains(childItem))
|
||||||
childList.append(childItem);
|
childList.append(childItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QObject *child, childList) {
|
for (QObject *child : std::as_const(childList)) {
|
||||||
if (!nodeInstanceServer->hasInstanceForObject(child))
|
if (!nodeInstanceServer->hasInstanceForObject(child))
|
||||||
doComponentCompleteRecursive(child, nodeInstanceServer);
|
doComponentCompleteRecursive(child, nodeInstanceServer);
|
||||||
}
|
}
|
||||||
@@ -583,7 +584,7 @@ QAbstractFileEngine *QrcEngineHandler::create(const QString &fileName) const
|
|||||||
|
|
||||||
if (fileName.startsWith(":/")) {
|
if (fileName.startsWith(":/")) {
|
||||||
const QStringList searchPaths = qmlDesignerRCPath().split(';');
|
const QStringList searchPaths = qmlDesignerRCPath().split(';');
|
||||||
foreach (const QString &qrcPath, searchPaths) {
|
for (const QString &qrcPath : searchPaths) {
|
||||||
const QStringList qrcDefintion = qrcPath.split('=');
|
const QStringList qrcDefintion = qrcPath.split('=');
|
||||||
if (qrcDefintion.count() == 2) {
|
if (qrcDefintion.count() == 2) {
|
||||||
QString fixedPath = fileName;
|
QString fixedPath = fileName;
|
||||||
|
Reference in New Issue
Block a user