2020-03-18 13:34:11 +03:00
|
|
|
#ifndef SVGITEM_H
|
|
|
|
#define SVGITEM_H
|
|
|
|
|
2020-03-19 20:09:35 +03:00
|
|
|
#include "lreditableimageitemintf.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
#include "lritemdesignintf.h"
|
2020-03-18 13:34:11 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
namespace LimeReport {
|
|
|
|
class SVGItem: public ItemDesignIntf, public IEditableImageItem {
|
2020-03-18 13:34:11 +03:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath)
|
|
|
|
Q_PROPERTY(QByteArray image READ image WRITE setImage)
|
|
|
|
Q_PROPERTY(QString datasource READ datasource WRITE setDatasource)
|
|
|
|
Q_PROPERTY(QString field READ field WRITE setField)
|
|
|
|
Q_PROPERTY(int opacity READ opacity WRITE setOpacity)
|
|
|
|
Q_PROPERTY(QString variable READ variable WRITE setVariable)
|
|
|
|
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
SVGItem(QObject* owner, QGraphicsItem* parent);
|
|
|
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
2020-03-18 13:34:11 +03:00
|
|
|
|
2020-03-19 20:09:35 +03:00
|
|
|
QByteArray imageAsByteArray() const;
|
|
|
|
void setImageAsByteArray(QByteArray image);
|
|
|
|
QString fileFilter() const;
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
void preparePopUpMenu(QMenu& menu);
|
|
|
|
void processPopUpAction(QAction* action);
|
2020-03-19 20:09:35 +03:00
|
|
|
QWidget* defaultEditor();
|
|
|
|
|
2020-03-18 13:34:11 +03:00
|
|
|
QString resourcePath() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setResourcePath(const QString& resourcePath);
|
2020-03-18 13:34:11 +03:00
|
|
|
QByteArray image() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setImage(const QByteArray& image);
|
2020-03-18 13:34:11 +03:00
|
|
|
QString datasource() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setDatasource(const QString& datasource);
|
2020-03-18 13:34:11 +03:00
|
|
|
QString field() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setField(const QString& field);
|
2020-03-18 13:34:11 +03:00
|
|
|
QString variable() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setVariable(const QString& variable);
|
2021-02-20 15:40:13 +03:00
|
|
|
bool isNeedUpdateSize(RenderPass) const;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2020-03-18 13:34:11 +03:00
|
|
|
protected:
|
2024-09-04 17:31:16 +03:00
|
|
|
BaseDesignIntf* createSameTypeItem(QObject* owner, QGraphicsItem* parent);
|
|
|
|
void updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight);
|
2020-03-18 13:34:11 +03:00
|
|
|
QByteArray imageFromResource(QString resourcePath);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2020-03-18 13:34:11 +03:00
|
|
|
private:
|
|
|
|
QString m_resourcePath;
|
|
|
|
QByteArray m_image;
|
|
|
|
QString m_datasource;
|
|
|
|
QString m_field;
|
|
|
|
QString m_variable;
|
2020-03-19 20:09:35 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
public:
|
2020-03-18 13:34:11 +03:00
|
|
|
};
|
|
|
|
} // namespace LimeReport
|
|
|
|
#endif // SVGITEM_H
|