diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index c3fce2f..9952479 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -340,6 +340,21 @@ void ImageItem::setImage(QImage value) } } +QImage ImageItem::image(){ + if (m_picture.isNull() && !resourcePath().isEmpty() && itemMode() == DesignMode){ + QFileInfo fileInfo(m_resourcePath); + if (fileInfo.exists()){ + return QImage(m_resourcePath); + } + } + return m_picture; +} + +void ImageItem::setResourcePath(const QString &value){ + m_resourcePath=value; + update(); +} + ImageItem::Format ImageItem::format() const { return m_format; diff --git a/limereport/items/lrimageitem.h b/limereport/items/lrimageitem.h index 5d474e2..8eb7da7 100644 --- a/limereport/items/lrimageitem.h +++ b/limereport/items/lrimageitem.h @@ -61,8 +61,8 @@ public: ImageItem(QObject *owner, QGraphicsItem *parent); virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); void setImage(QImage value); - QImage image(){return m_picture;} - void setResourcePath(const QString &value){m_resourcePath=value;} + QImage image(); + void setResourcePath(const QString &value); QString resourcePath() const; QString datasource() const; void setDatasource(const QString &datasource);