LimeReport icon indicating copy to clipboard operation
LimeReport copied to clipboard

SVGItem variable

Open gorazdr opened this issue 4 years ago • 0 comments

Hello,

I found that if I set SVGItem variable svg image is not shown. Problem is that SVGItem::updateItemSize function is never called.

I added this overloaded function to lrsvgitem: bool SVGItem::isNeedUpdateSize(RenderPass) const { return m_image.isNull() ; }

Now the updateItemSize gets called.

The other bug I found is that in updateItemSize when variable is not empty you check if data.type is QVariant::Image but that does not work it should be QVariant::ByteArray.

Here is corrected code: } else if (!m_variable.isEmpty()){ QVariant data = dataManager->variable(m_variable); if (data.type() == QVariant::String){ m_image = imageFromResource(data.toString()); } else if (data.type() == QVariant::ByteArray) { m_image = data.value<QByteArray>() ; } }

Now you can load image from variable path or variable bytearray.

Thanks, Gorazd

gorazdr avatar Feb 19 '21 14:02 gorazdr