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 
24 class KConfigGroup;
25 
30 class Q_DECL_EXPORT LineItem : public VectorItem, public QGraphicsLineItem
31 {
32 public:
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;
72  void setDashOffset();
74  void setPenWidth();
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 
97 protected:
99  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
101  void setProperties();
102  double myDashOffset;
103  Symbol m_symbol;
104 };
105 
106 #endif
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void writePlo(KConfigGroup *plo, bool visible) const
Writes into plot file.
Symbol
Symbol types.
Definition: kplitem.h:83
void update(const QRectF &rect)
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: lineitem.h:88
Symbol symbol() const
Returns line type.
Definition: lineitem.h:86
static QPixmap pixmap(Symbol symbol)
Returns black decoration pixmap of plot symbol for use in dialog GUI.
Vector item class.
Definition: vectoritem.h:33
void setSymbol(Symbol symbol)
Sets line type.
Definition: lineitem.h:84
Line item class.
Definition: lineitem.h:30