void Qt4InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() { static bool inFunction = false; if (!inFunction) { inFunction = true; QSet<ServerNodeInstance> informationChangedInstanceSet; QVector<InstancePropertyPair> propertyChangedList; bool adjustSceneRect = false; if (declarativeView()) { foreach (QGraphicsItem *item, declarativeView()->items()) { QGraphicsObject *graphicsObject = item->toGraphicsObject(); if (graphicsObject && hasInstanceForObject(graphicsObject)) { ServerNodeInstance instance = instanceForObject(graphicsObject); QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); if (d->dirtySceneTransform || d->geometryChanged || d->dirty) informationChangedInstanceSet.insert(instance); if (d->geometryChanged) { if (instance.isRootNodeInstance()) declarativeView()->scene()->setSceneRect(item->boundingRect()); } } } foreach (QGraphicsItem *item, declarativeView()->items()) { QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); d->ensureSceneTransform(); }
void RenderNodeInstanceServer::findItemChangesAndSendChangeCommands() { static bool inFunction = false; if (!inFunction) { inFunction = true; bool adjustSceneRect = false; if (delcarativeView()) { foreach (QGraphicsItem *item, delcarativeView()->items()) { QGraphicsObject *graphicsObject = item->toGraphicsObject(); if (graphicsObject && hasInstanceForObject(graphicsObject)) { ServerNodeInstance instance = instanceForObject(graphicsObject); QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); if((d->dirty && d->notifyBoundingRectChanged)|| (d->dirty && !d->dirtySceneTransform) || nonInstanceChildIsDirty(graphicsObject)) m_dirtyInstanceSet.insert(instance); if (d->geometryChanged) { if (instance.isRootNodeInstance()) delcarativeView()->scene()->setSceneRect(item->boundingRect()); } } } foreach (const InstancePropertyPair& property, changedPropertyList()) { const ServerNodeInstance instance = property.first; const QString propertyName = property.second; if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height")) adjustSceneRect = true; if (propertyName == "width" || propertyName == "height") m_dirtyInstanceSet.insert(instance); } clearChangedPropertyList(); resetAllItems(); if (!m_dirtyInstanceSet.isEmpty() && nodeInstanceClient()->bytesToWrite() < 10000) { nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(m_dirtyInstanceSet.toList())); m_dirtyInstanceSet.clear(); } if (adjustSceneRect) { QRectF boundingRect = rootNodeInstance().boundingRect(); if (boundingRect.isValid()) { delcarativeView()->setSceneRect(boundingRect); } } slowDownRenderTimer(); nodeInstanceClient()->flush(); nodeInstanceClient()->synchronizeWithClientProcess(); }
void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands() { static bool inFunction = false; if (!inFunction) { inFunction = true; QSet<ServerNodeInstance> informationChangedInstanceSet; QVector<InstancePropertyPair> propertyChangedList; bool adjustSceneRect = false; if (sgView()) { foreach (QSGItem *item, allItems()) { if (item && hasInstanceForObject(item)) { ServerNodeInstance instance = instanceForObject(item); DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask | DesignerSupport::Visible | DesignerSupport::ZValue | DesignerSupport::OpacityValue); if (DesignerSupport::dirty(item, informationsDirty)) informationChangedInstanceSet.insert(instance); if (DesignerSupport::dirty(item, DesignerSupport::ParentChanged)) { m_parentChangedSet.insert(instance); informationChangedInstanceSet.insert(instance); } // if (d->geometryChanged) { // if (instance.isRootNodeInstance()) // declarativeView()->scene()->setSceneRect(item->boundingRect()); // } } } foreach (const InstancePropertyPair& property, changedPropertyList()) { const ServerNodeInstance instance = property.first; const QString propertyName = property.second; if (instance.isValid()) { if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height")) adjustSceneRect = true; if (propertyName.contains("anchors")) informationChangedInstanceSet.insert(instance); propertyChangedList.append(property); } } resetAllItems(); clearChangedPropertyList(); sendTokenBack(); if (!informationChangedInstanceSet.isEmpty()) nodeInstanceClient()->informationChanged(createAllInformationChangedCommand(informationChangedInstanceSet.toList())); if (!propertyChangedList.isEmpty()) nodeInstanceClient()->valuesChanged(createValuesChangedCommand(propertyChangedList)); if (!m_parentChangedSet.isEmpty()) { sendChildrenChangedCommand(m_parentChangedSet.toList()); m_parentChangedSet.clear(); } // if (adjustSceneRect) { // QRectF boundingRect = rootNodeInstance().boundingRect(); // if (boundingRect.isValid()) { // declarativeView()->setSceneRect(boundingRect); // } // } if (!m_completedComponentList.isEmpty()) { nodeInstanceClient()->componentCompleted(createComponentCompletedCommand(m_completedComponentList)); m_completedComponentList.clear(); } slowDownRenderTimer(); nodeInstanceClient()->flush(); nodeInstanceClient()->synchronizeWithClientProcess(); } inFunction = false; }