libkpl  5.0
A Library for Graphical Presentation of Data Sets and Functions
lineitem.h
1/***************************************************************************
2 lineitem.h - description
3 -------------------
4 begin : Mon Apr 16 2001
5 copyright : (C) 2017 by Werner Stille
6 email : kpl@werner-stille.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef LINEITEM_H
19#define LINEITEM_H
20
21#include <QGraphicsLineItem>
22#include "vectoritem.h"
23
24class KConfigGroup;
25
30class Q_DECL_EXPORT LineItem : public VectorItem, public QGraphicsLineItem
31{
32public:
34 enum {Type = UserType + Line
38 };
51 LineItem(double x0 = 0, double y0 = 0, unsigned color = 0,
52 QGraphicsItem* parent = 0, double length = 1, bool visible = true,
53 Symbol symbol = SolidLine, double relSize = 1, double dir = 0);
58 LineItem(const LineItem& a);
65 LineItem(const KConfigGroup* plo, unsigned color = 0,
66 QGraphicsItem* parent = 0);
68 virtual ~LineItem();
70 QPixmap pixmap() const;
79 void setProperties(const QTransform& m);
84 inline void setSymbol(Symbol symbol) { m_symbol = symbol; };
86 inline Symbol symbol() const { return m_symbol; };
88 virtual int type() const { return Type; };
90 void update();
95 void writePlo(KConfigGroup* plo) const;
96
97protected:
99 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
102 double myDashOffset;
103 Symbol m_symbol;
104};
105
106#endif
Symbol
Symbol types.
Definition: kplitem.h:83
Line item class.
Definition: lineitem.h:31
void setProperties(const QTransform &m)
Sets properties according to transformation matrix.
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: lineitem.h:88
void writePlo(KConfigGroup *plo) const
Writes into plot file.
void setDashOffset()
Sets offset for dashed lines.
void setPenWidth()
Sets pen width.
void setSymbol(Symbol symbol)
Sets line type.
Definition: lineitem.h:84
QPixmap pixmap() const
Returns decoration pixmap for item list.
LineItem(double x0=0, double y0=0, unsigned color=0, QGraphicsItem *parent=0, double length=1, bool visible=true, Symbol symbol=SolidLine, double relSize=1, double dir=0)
Constructor.
Symbol symbol() const
Returns line type.
Definition: lineitem.h:86
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Updates position.
void setProperties()
Sets properties according to transformation matrix.
LineItem(const LineItem &a)
Copy constructor.
void update()
Applies changes and forces redrawing.
virtual ~LineItem()
Destructor.
LineItem(const KConfigGroup *plo, unsigned color=0, QGraphicsItem *parent=0)
Constructor.
Vector item class.
Definition: vectoritem.h:34