libkpl  4.1
A Library for Graphical Presentation of Data Sets and Functions
arrowitem.h
1 /***************************************************************************
2  arrowitem.h - description
3  -------------------
4  begin : Sat Apr 14 2001
5  copyright : (C) 2015 by Werner Stille
6  email : stille@uni-freiburg.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 ARROWITEM_H
19 #define ARROWITEM_H
20 
21 #include <QAbstractGraphicsShapeItem>
22 #include <QPolygonF>
23 #include "vectoritem.h"
24 
25 class QTransform;
26 
31 class KDE_EXPORT ArrowItem :
33 {
34 public:
36  enum {Type = UserType + Arrow
40  };
53  ArrowItem(double x0 = 0, double y0 = 0, unsigned color = 0,
54  QGraphicsItem* parent = 0, double length = 1, bool visible = true,
55  bool doubleHeaded = false, double relSize = 1, double dir = 0);
60  ArrowItem(const ArrowItem& a);
67  ArrowItem(const KConfigGroup* plo, unsigned color = 0,
68  QGraphicsItem* parent = 0);
70  virtual ~ArrowItem();
72  virtual QRectF boundingRect() const;
74  inline bool doubleHeaded() const { return m_doubleHeaded; };
76  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
77  QWidget* widget = 0);
79  QPixmap pixmap() const;
84  inline void setDoubleHeaded(bool b) { m_doubleHeaded = b; };
86  void setHead();
88  void setPenWidth();
93  void setProperties(const QTransform& m);
95  virtual int type() const { return Type; };
97  void update();
102  void writePlo(KConfigGroup* plo) const;
103 
104 protected:
106  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
108  void setProperties();
109  bool m_doubleHeaded;
110  double l2, lHead;
111  QPolygonF head;
112 };
113 
114 #endif
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void writePlo(KConfigGroup *plo, bool visible) const
Writes into plot file.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
void setDoubleHeaded(bool b)
Sets doubleheaded mode.
Definition: arrowitem.h:84
void update(const QRectF &rect)
Arrow item class.
Definition: arrowitem.h:31
bool doubleHeaded() const
Returns true for doubleheaded arrow.
Definition: arrowitem.h:74
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: arrowitem.h:95
static QPixmap pixmap(Symbol symbol)
Returns black decoration pixmap of plot symbol for use in dialog GUI.
virtual QRectF boundingRect() const =0
Vector item class.
Definition: vectoritem.h:34