libkpl  4.1
A Library for Graphical Presentation of Data Sets and Functions
rectitem.h
1 /***************************************************************************
2  rectitem.h - description
3  -------------------
4  begin : Sat Apr 28 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 RECTITEM_H
19 #define RECTITEM_H
20 
21 #include <QGraphicsRectItem>
22 #include "decoitem.h"
23 
28 class KDE_EXPORT RectItem : public DecoItem, public QGraphicsRectItem
29 {
30 public:
32  enum {Type = UserType + Rectangle
34  };
48  RectItem(double x0 = 0, double y0 = 0, unsigned color = 0,
49  QGraphicsItem* parent = 0, double width = 3, double height = 2,
50  bool visible = true, FillStyle fillStyle = NoBrush,
51  double relSize = 1, double dir = 0);
56  RectItem(const RectItem& a);
63  RectItem(const KConfigGroup* plo, unsigned color = 0,
64  QGraphicsItem* parent = 0);
66  virtual ~RectItem();
68  inline double dir() const { return m_dir; };
70  inline FillStyle fillStyle() const { return m_fillStyle; };
72  inline double height() const { return m_height; };
74  QPixmap pixmap() const;
79  inline void setDir(double dir) { m_dir = dir; };
84  inline void setFillStyle(FillStyle style) { m_fillStyle = style; };
89  inline void setHeight( double height) { m_height = height; };
91  void setPenWidth();
96  void setProperties(const QTransform& m);
101  inline void setWidth( double width) { m_width = width; };
103  virtual int type() const { return Type; };
105  void update();
107  inline double width() const { return m_width; };
112  void writePlo(KConfigGroup* plo) const;
113 
114 protected:
116  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
118  void setProperties();
119  FillStyle m_fillStyle;
120  double m_width, m_height, m_dir;
121 };
122 
123 #endif
double width() const
Returns width in cm.
Definition: rectitem.h:107
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
FillStyle
Fill styles.
Definition: kplitem.h:47
void setHeight(double height)
Sets height.
Definition: rectitem.h:89
double height() const
Returns height in cm.
Definition: rectitem.h:72
void writePlo(KConfigGroup *plo, bool visible) const
Writes into plot file.
void update(const QRectF &rect)
Rectangle item class.
Definition: rectitem.h:28
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: rectitem.h:103
void setFillStyle(FillStyle style)
Sets fill style.
Definition: rectitem.h:84
void setDir(double dir)
Sets rotation angle.
Definition: rectitem.h:79
void setWidth(double width)
Sets width.
Definition: rectitem.h:101
static QPixmap pixmap(Symbol symbol)
Returns black decoration pixmap of plot symbol for use in dialog GUI.
double dir() const
Returns rotation angle in deg.
Definition: rectitem.h:68
Decoration item class.
Definition: decoitem.h:36
FillStyle fillStyle() const
Returns fill style.
Definition: rectitem.h:70