0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

If resourcePath contains a simple path to an image file, that image will be shown in design mode.

This commit is contained in:
Arin Alexander 2019-08-07 12:40:42 +03:00
parent e9c917a052
commit afa4bcb9bf
2 changed files with 17 additions and 2 deletions

View File

@ -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 ImageItem::Format ImageItem::format() const
{ {
return m_format; return m_format;

View File

@ -61,8 +61,8 @@ public:
ImageItem(QObject *owner, QGraphicsItem *parent); ImageItem(QObject *owner, QGraphicsItem *parent);
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setImage(QImage value); void setImage(QImage value);
QImage image(){return m_picture;} QImage image();
void setResourcePath(const QString &value){m_resourcePath=value;} void setResourcePath(const QString &value);
QString resourcePath() const; QString resourcePath() const;
QString datasource() const; QString datasource() const;
void setDatasource(const QString &datasource); void setDatasource(const QString &datasource);