mirror of
				https://github.com/fralx/LimeReport.git
				synced 2025-11-03 22:51:26 +03:00 
			
		
		
		
	Fix: ImageItem added isEmpty
This commit is contained in:
		@@ -111,14 +111,14 @@ void ImageItem::processPopUpAction(QAction *action)
 | 
				
			|||||||
    ItemDesignIntf::processPopUpAction(action);
 | 
					    ItemDesignIntf::processPopUpAction(action);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QImage getFileByResourcePath(QString resourcePath){
 | 
					QImage getFileByResourcePath(QString resourcePath) {
 | 
				
			||||||
    QFileInfo resourceFile(resourcePath);
 | 
					    QFileInfo resourceFile(resourcePath);
 | 
				
			||||||
    if (resourceFile.exists())
 | 
					    if (resourceFile.exists())
 | 
				
			||||||
        return QImage(resourcePath);
 | 
					        return QImage(resourcePath);
 | 
				
			||||||
    return QImage();
 | 
					    return QImage();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QImage ImageItem::drawImage()
 | 
					QImage ImageItem::drawImage() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (image().isNull())
 | 
					    if (image().isNull())
 | 
				
			||||||
        return getFileByResourcePath(m_resourcePath);
 | 
					        return getFileByResourcePath(m_resourcePath);
 | 
				
			||||||
@@ -410,7 +410,7 @@ void ImageItem::setImage(QImage value)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QImage ImageItem::image(){
 | 
					QImage ImageItem::image() const{
 | 
				
			||||||
    return m_picture;
 | 
					    return m_picture;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -439,3 +439,8 @@ void ImageItem::setFormat(Format format)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool LimeReport::ImageItem::isEmpty() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return drawImage().isNull();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@ public:
 | 
				
			|||||||
    ImageItem(QObject *owner, QGraphicsItem *parent);
 | 
					    ImageItem(QObject *owner, QGraphicsItem *parent);
 | 
				
			||||||
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 | 
					    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 | 
				
			||||||
    void setImage(QImage value);
 | 
					    void setImage(QImage value);
 | 
				
			||||||
    QImage image();
 | 
					    QImage image() const;
 | 
				
			||||||
    void setResourcePath(const QString &value);
 | 
					    void setResourcePath(const QString &value);
 | 
				
			||||||
    QString resourcePath() const;
 | 
					    QString resourcePath() const;
 | 
				
			||||||
    QString datasource() const;
 | 
					    QString datasource() const;
 | 
				
			||||||
@@ -108,7 +108,7 @@ protected:
 | 
				
			|||||||
    void loadPictureFromVariant(QVariant& data);
 | 
					    void loadPictureFromVariant(QVariant& data);
 | 
				
			||||||
    void preparePopUpMenu(QMenu &menu);
 | 
					    void preparePopUpMenu(QMenu &menu);
 | 
				
			||||||
    void processPopUpAction(QAction *action);
 | 
					    void processPopUpAction(QAction *action);
 | 
				
			||||||
    QImage drawImage();
 | 
					    QImage drawImage() const;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    QImage  m_picture;
 | 
					    QImage  m_picture;
 | 
				
			||||||
    bool m_useExternalPainter;
 | 
					    bool m_useExternalPainter;
 | 
				
			||||||
@@ -123,6 +123,10 @@ private:
 | 
				
			|||||||
    Format  m_format;
 | 
					    Format  m_format;
 | 
				
			||||||
    QString m_variable;
 | 
					    QString m_variable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // BaseDesignIntf interface
 | 
				
			||||||
 | 
					  public:
 | 
				
			||||||
 | 
					    bool isEmpty() const override;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user