diff options
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp index af5336cd84..26772f42ce 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp @@ -29,7 +29,8 @@ #include "qt5rendernodeinstanceserver.h" -#include <QSGItem> +#include <QQuickItem> +#include <QQuickView> #include "servernodeinstance.h" #include "childrenchangeeventfilter.h" @@ -57,8 +58,8 @@ #include "completecomponentcommand.h" #include "componentcompletedcommand.h" #include "createscenecommand.h" -#include "sgitemnodeinstance.h" - +#include "quickitemnodeinstance.h" +#include "removesharedmemorycommand.h" #include "dummycontextobject.h" @@ -69,7 +70,7 @@ namespace QmlDesigner { Qt5RenderNodeInstanceServer::Qt5RenderNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5NodeInstanceServer(nodeInstanceClient) { - Internal::SGItemNodeInstance::createEffectItem(true); + Internal::QuickItemNodeInstance::createEffectItem(true); } void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() @@ -78,12 +79,20 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() if (!inFunction) { inFunction = true; - if (sgView() && nodeInstanceClient()->bytesToWrite() < 10000) { - foreach (QSGItem *item, allItems()) { - if (item && hasInstanceForObject(item)) { - ServerNodeInstance instance = instanceForObject(item); - if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask)) - m_dirtyInstanceSet.insert(instance); + DesignerSupport::polishItems(quickView()); + + if (quickView() && nodeInstanceClient()->bytesToWrite() < 10000) { + foreach (QQuickItem *item, allItems()) { + if (item) { + if (hasInstanceForObject(item) + && DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask)) { + m_dirtyInstanceSet.insert(instanceForObject(item)); + } else if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) { + ServerNodeInstance ancestorInstance = findNodeInstanceForItem(item->parentItem()); + if (ancestorInstance.isValid()) + m_dirtyInstanceSet.insert(ancestorInstance); + } + DesignerSupport::updateDirtyNode(item); } } @@ -94,8 +103,6 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() m_dirtyInstanceSet.clear(); } - resetAllItems(); - slowDownRenderTimer(); nodeInstanceClient()->flush(); nodeInstanceClient()->synchronizeWithClientProcess(); @@ -105,6 +112,18 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() } } +ServerNodeInstance Qt5RenderNodeInstanceServer::findNodeInstanceForItem(QQuickItem *item) const +{ + if (item) { + if (hasInstanceForObject(item)) + return instanceForObject(item); + else if (item->parentItem()) + return findNodeInstanceForItem(item->parentItem()); + } + + return ServerNodeInstance(); +} + void Qt5RenderNodeInstanceServer::createScene(const CreateSceneCommand &command) { @@ -144,4 +163,10 @@ void Qt5RenderNodeInstanceServer::completeComponent(const CompleteComponentComma nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(instanceList)); } +void QmlDesigner::Qt5RenderNodeInstanceServer::removeSharedMemory(const QmlDesigner::RemoveSharedMemoryCommand &command) +{ + if (command.typeName() == "Image") + ImageContainer::removeSharedMemorys(command.keyNumbers()); +} + } // namespace QmlDesigner |