QmlDesigner: Move implementation code in the node instances

updateDirtyNodeRecursive and renderPreviewImage belongs to quick image and
not in the node instance server.

Change-Id: I629b89c748036c0614e78bcfa0c837cb16ca6374
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Marco Bubke
2013-04-15 13:28:48 +02:00
committed by Thomas Hartmann
parent f021ec50cd
commit 359ef53280
7 changed files with 61 additions and 16 deletions
@@ -65,7 +65,7 @@ void Qt5PreviewNodeInstanceServer::collectItemChangesAndSendChangeCommands()
{
static bool inFunction = false;
if (rootNodeInstance().internalSGItem() == 0)
if (!rootNodeInstance().holdsQuickItem())
return;
if (!inFunction && nodeInstanceClient()->bytesToWrite() < 10000) {
@@ -106,17 +106,14 @@ static void updateDirtyNodeRecursive(QQuickItem *parentItem)
QImage Qt5PreviewNodeInstanceServer::renderPreviewImage()
{
updateDirtyNodeRecursive(rootNodeInstance().internalSGItem());
rootNodeInstance().updateDirtyNodeRecursive();
QRectF boundingRect = rootNodeInstance().boundingRect();
QSize previewImageSize = boundingRect.size().toSize();
previewImageSize.scale(QSize(100, 100), Qt::KeepAspectRatio);
QImage previewImage;
if (boundingRect.isValid() && rootNodeInstance().internalSGItem())
previewImage = designerSupport()->renderImageForItem(rootNodeInstance().internalSGItem(), boundingRect, previewImageSize);
QImage previewImage = rootNodeInstance().renderPreviewImage(previewImageSize);
previewImage = previewImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);