0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 17:14:40 +03:00

Watermark property can be changed by context menu

This commit is contained in:
Arin Alex 2018-03-22 20:26:07 +03:00
parent 15345d44a7
commit 785b6cec67
3 changed files with 23 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include "lrdesignelementsfactory.h" #include "lrdesignelementsfactory.h"
#include "lrglobal.h" #include "lrglobal.h"
#include "lrdatasourcemanager.h" #include "lrdatasourcemanager.h"
#include "lrpagedesignintf.h"
namespace{ namespace{
@ -76,6 +77,20 @@ void ImageItem::loadPictureFromVariant(QVariant& data){
} }
} }
void ImageItem::preparePopUpMenu(QMenu &menu)
{
QAction* action = menu.addAction(tr("Watermark"));
action->setCheckable(true);
action->setChecked(isWatermark());
}
void ImageItem::processPopUpAction(QAction *action)
{
if (action->text().compare(tr("Watermark")) == 0){
page()->setPropertyToSelectedItems("watermark",action->isChecked());
}
}
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{ {

View File

@ -87,6 +87,8 @@ protected:
bool isNeedUpdateSize(RenderPass) const; bool isNeedUpdateSize(RenderPass) const;
bool drawDesignBorders() const {return m_picture.isNull();} bool drawDesignBorders() const {return m_picture.isNull();}
void loadPictureFromVariant(QVariant& data); void loadPictureFromVariant(QVariant& data);
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
private: private:
QImage m_picture; QImage m_picture;
QString m_resourcePath; QString m_resourcePath;

View File

@ -111,6 +111,9 @@ void TextItem::preparePopUpMenu(QMenu &menu)
action->setCheckable(true); action->setCheckable(true);
action->setChecked(backgroundMode() == TransparentMode); action->setChecked(backgroundMode() == TransparentMode);
action = menu.addAction(tr("Watermark"));
action->setCheckable(true);
action->setChecked(isWatermark());
} }
void TextItem::processPopUpAction(QAction *action) void TextItem::processPopUpAction(QAction *action)
@ -137,6 +140,9 @@ void TextItem::processPopUpAction(QAction *action)
setProperty("backgroundMode",OpaqueMode); setProperty("backgroundMode",OpaqueMode);
} }
} }
if (action->text().compare(tr("Watermark")) == 0){
page()->setPropertyToSelectedItems("watermark",action->isChecked());
}
} }
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) { void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {