QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const { if (rootNodeInstance().isValid()) return rootNodeInstance().allItemsRecursive(); return QList<QQuickItem*>(); }
void Qt4NodeInstanceServer::resizeCanvasSizeToRootItemSize() { QGraphicsObject *rootGraphicsObject = qobject_cast<QGraphicsObject*>(rootNodeInstance().internalObject()); if (rootGraphicsObject) { declarativeView()->scene()->addItem(rootGraphicsObject); declarativeView()->setSceneRect(rootGraphicsObject->boundingRect()); } }
void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command) { setupFileUrl(command.fileUrl()); setupImports(command.imports()); setupDummyData(command.fileUrl()); setupInstances(command); quickView()->resize(rootNodeInstance().boundingRect().size().toSize()); }
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(); }
QList<ServerNodeInstance> Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command) { setupFileUrl(command.fileUrl()); setupImports(command.imports()); setupDummyData(command.fileUrl()); QList<ServerNodeInstance> instanceList = setupInstances(command); sgView()->resize(rootNodeInstance().boundingRect().size().toSize()); return instanceList; }