From 2059a2a16437528e80736cc51445c7adb13cd484 Mon Sep 17 00:00:00 2001 From: Dmitry Zagorodnev Date: Thu, 20 Oct 2022 14:25:53 +0300 Subject: [PATCH 1/3] Fix: ImageItem added isEmpty --- limereport/items/lrimageitem.cpp | 11 ++++++++--- limereport/items/lrimageitem.h | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index 0459b67..00ed897 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -111,14 +111,14 @@ void ImageItem::processPopUpAction(QAction *action) ItemDesignIntf::processPopUpAction(action); } -QImage getFileByResourcePath(QString resourcePath){ +QImage getFileByResourcePath(QString resourcePath) { QFileInfo resourceFile(resourcePath); if (resourceFile.exists()) return QImage(resourcePath); return QImage(); } -QImage ImageItem::drawImage() +QImage ImageItem::drawImage() const { if (image().isNull()) return getFileByResourcePath(m_resourcePath); @@ -410,7 +410,7 @@ void ImageItem::setImage(QImage value) } } -QImage ImageItem::image(){ +QImage ImageItem::image() const{ return m_picture; } @@ -439,3 +439,8 @@ void ImageItem::setFormat(Format format) } } + +bool LimeReport::ImageItem::isEmpty() const +{ + return drawImage().isNull(); +} diff --git a/limereport/items/lrimageitem.h b/limereport/items/lrimageitem.h index 5640e8a..7d6127d 100644 --- a/limereport/items/lrimageitem.h +++ b/limereport/items/lrimageitem.h @@ -67,7 +67,7 @@ public: ImageItem(QObject *owner, QGraphicsItem *parent); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void setImage(QImage value); - QImage image(); + QImage image() const; void setResourcePath(const QString &value); QString resourcePath() const; QString datasource() const; @@ -108,7 +108,7 @@ protected: void loadPictureFromVariant(QVariant& data); void preparePopUpMenu(QMenu &menu); void processPopUpAction(QAction *action); - QImage drawImage(); + QImage drawImage() const; private: QImage m_picture; bool m_useExternalPainter; @@ -121,8 +121,12 @@ private: bool m_keepAspectRatio; bool m_center; Format m_format; - QString m_variable; + QString m_variable; + + // BaseDesignIntf interface + public: + bool isEmpty() const override; }; } From 4903abc40808c7f2eb7b1109b192cb7e3d61514d Mon Sep 17 00:00:00 2001 From: Dmitry Zagorodnev Date: Mon, 24 Oct 2022 13:07:25 +0300 Subject: [PATCH 2/3] + --- limereport/items/lrtextitem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index fb14eb6..4677892 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -389,6 +389,7 @@ void TextItem::setTextFont(TextPtr text, const QFont& value) const { void TextItem::adaptFontSize(TextPtr text) const{ QFont _font = transformToSceneFont(font()); do{ +// qApp->processEvents(); setTextFont(text,_font); if (_font.pixelSize()>2) _font.setPixelSize(_font.pixelSize()-1); From 2c5ed82376fc0d0a5137d2cded7f3bd4c4150509 Mon Sep 17 00:00:00 2001 From: Dmitry Zagorodnev Date: Mon, 24 Oct 2022 14:57:31 +0300 Subject: [PATCH 3/3] Fix: ImageItem::paint --- limereport/items/lrimageitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index 00ed897..4958807 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -364,7 +364,7 @@ void ImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, } if (shiftHeight > 0){ - point.setY(point.x()+shiftHeight/2); + point.setY(point.y()+shiftHeight/2); } else { cutY = fabs(shiftHeight/2); cutHeigth += shiftHeight;