forked from qt-creator/qt-creator
QmlDesigner.nodeInstances: fix rendering bugs
Qt::transparent != 0 !! Reviewed-by: Marco Bubke
This commit is contained in:
@@ -223,12 +223,12 @@ QImage GraphicsObjectNodeInstance::renderImage() const
|
|||||||
QRectF boundingRect = graphicsObject()->boundingRect();
|
QRectF boundingRect = graphicsObject()->boundingRect();
|
||||||
QSize boundingSize = boundingRect.size().toSize();
|
QSize boundingSize = boundingRect.size().toSize();
|
||||||
|
|
||||||
QImage image(boundingSize, QImage::Format_ARGB32);
|
QImage image(boundingSize, QImage::Format_ARGB32_Premultiplied);
|
||||||
|
|
||||||
if (image.isNull())
|
if (image.isNull())
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
image.fill(Qt::transparent);
|
image.fill(0x00000000);
|
||||||
|
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.translate(-boundingRect.topLeft());
|
painter.translate(-boundingRect.topLeft());
|
||||||
@@ -237,13 +237,12 @@ QImage GraphicsObjectNodeInstance::renderImage() const
|
|||||||
QStyleOptionGraphicsItem option;
|
QStyleOptionGraphicsItem option;
|
||||||
initOption(graphicsObject(), &option, painter.transform());
|
initOption(graphicsObject(), &option, painter.transform());
|
||||||
graphicsObject()->paint(&painter, &option);
|
graphicsObject()->paint(&painter, &option);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems())
|
foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems())
|
||||||
paintRecursively(graphicsItem, &painter);
|
paintRecursively(graphicsItem, &painter);
|
||||||
|
|
||||||
return image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsObjectNodeInstance::paintRecursively(QGraphicsItem *graphicsItem, QPainter *painter) const
|
void GraphicsObjectNodeInstance::paintRecursively(QGraphicsItem *graphicsItem, QPainter *painter) const
|
||||||
|
Reference in New Issue
Block a user