25#include <QGraphicsItem>
26#include <QTextDocument>
62 double xOff = 1,
double yOff = 0, QGraphicsItem* parent =
nullptr,
63 const QString&
text = QString(),
bool visible =
true,
79 LegendItem(
const KConfigGroup* plo,
unsigned colorSymbol,
unsigned colorText,
81 QGraphicsItem* parent =
nullptr);
87 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
88 QWidget* widget =
nullptr)
override;
133 inline QString
text()
const {
return m_text; };
135 inline unsigned textColor()
const {
return m_textColor; };
137 inline double textX()
const {
return m_textX; };
139 inline double textY()
const {
return m_textY; };
141 virtual int type()
const override {
return Type; };
160 unsigned m_textColor;
161 double m_textX, m_textY, m_symbolSize;
unsigned color() const
Returns color.
Definition decoitem.h:56
DecoItem(unsigned color=0, double x0=0, double y0=0, double relSize=1)
Constructor.
double y0() const
Returns y position in cm.
Definition decoitem.h:87
double x0() const
Returns x position in cm.
Definition decoitem.h:85
@ Legend
Legend item for explaining of symbols or lines.
Definition kplitem.h:64
Symbol
Symbol types.
Definition kplitem.h:83
@ SolidLine
Solid line.
Definition kplitem.h:102
double relSize() const
Returns relative size of item.
Definition kplitem.h:189
void setTextX(double x)
Sets x offset for text.
Definition legenditem.h:122
virtual QRectF boundingRect() const override
Calculates bounding rectangle.
void setText(const QString &text)
Sets text.
Definition legenditem.h:112
@ Type
Specific QGraphicsItem type number of LegendItem for function type().
Definition legenditem.h:40
LegendItem(double x0=0, double y0=0, unsigned colorSymbol=0, unsigned colorText=0, Symbol symbol=SolidLine, double xOff=1, double yOff=0, QGraphicsItem *parent=nullptr, const QString &text=QString(), bool visible=true, double relSize=1, double symbolSize=1)
Constructor.
void setSymbolSize(double symbolSize)
Sets symbol size.
Definition legenditem.h:107
QPixmap pixmap() const
Returns decoration pixmap for item list.
unsigned textColor() const
Returns text color.
Definition legenditem.h:135
double symbolSize() const
Returns relative symbol size.
Definition legenditem.h:131
void init()
Performs initialization.
void setProperties(const QTransform &m)
Sets properties according to transformation matrix.
virtual int type() const override
Returns specific QGraphicsItem type number.
Definition legenditem.h:141
void setProperties()
Sets properties according to transformation matrix.
void setSize()
Sets size according to transformation matrix.
QRectF textRect() const
Returns text rectangle.
LegendItem(const KConfigGroup *plo, unsigned colorSymbol, unsigned colorText, Symbol symbol, double frameWidth, QGraphicsItem *parent=nullptr)
Constructor.
LegendItem(const LegendItem &a)
Copy constructor.
double textY() const
Returns y offset for text in cm.
Definition legenditem.h:139
virtual ~LegendItem()
Destructor.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Paints item.
double textX() const
Returns x offset for text in cm.
Definition legenditem.h:137
Symbol symbol() const
Returns symbol type.
Definition legenditem.h:129
void update()
Applies changes and forces redrawing.
void setSymbol(Symbol symbol)
Sets symbol type.
Definition legenditem.h:102
void writePlo(KConfigGroup *plo) const
Writes into plot file.
QString text() const
Returns text.
Definition legenditem.h:133
void setTextColor(unsigned color)
Sets text color.
Definition legenditem.h:117
void setTextY(double y)
Sets y offset for text.
Definition legenditem.h:127
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Updates position.