libkpl  5.0
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) 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 RECTITEM_H
19 #define RECTITEM_H
20 
21 #include <QGraphicsRectItem>
22 #include "decoitem.h"
23 
28 class Q_DECL_EXPORT RectItem : public DecoItem, public QGraphicsRectItem
29 {
30 public:
32  enum {Type = UserType + Rectangle
34  };
49  RectItem(double x0 = 0, double y0 = 0, unsigned color = 0,
50  QGraphicsItem* parent = 0, double width = 3, double height = 2,
51  bool visible = true, FillStyle fillStyle = NoBrush,
52  Symbol symbol = SolidLine, double relSize = 1, double dir = 0);
57  RectItem(const RectItem& a);
64  RectItem(const KConfigGroup* plo, unsigned color = 0,
65  QGraphicsItem* parent = 0);
67  virtual ~RectItem();
69  inline double dir() const { return m_dir; };
71  inline FillStyle fillStyle() const { return m_fillStyle; };
73  inline double height() const { return m_height; };
75  QPixmap pixmap() const;
80  inline void setDir(double dir) { m_dir = dir; };
85  inline void setFillStyle(FillStyle style) { m_fillStyle = style; };
90  inline void setHeight( double height) { m_height = height; };
92  void setPenWidth();
97  void setProperties(const QTransform& m);
102  inline void setSymbol(Symbol symbol) { m_symbol = symbol; };
107  inline void setWidth( double width) { m_width = width; };
109  inline Symbol symbol() const { return m_symbol; };
111  virtual int type() const { return Type; };
113  void update();
115  inline double width() const { return m_width; };
120  void writePlo(KConfigGroup* plo) const;
121 
122 protected:
124  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
126  void setProperties();
127  FillStyle m_fillStyle;
128  double m_width, m_height, m_dir;
129  Symbol m_symbol;
130 };
131 
132 #endif
double width() const
Returns width in cm.
Definition: rectitem.h:115
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void setHeight(double height)
Sets height.
Definition: rectitem.h:90
Symbol
Symbol types.
Definition: kplitem.h:83
Symbol symbol() const
Returns line type.
Definition: rectitem.h:109
double height() const
Returns height in cm.
Definition: rectitem.h:73
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:111
void setFillStyle(FillStyle style)
Sets fill style.
Definition: rectitem.h:85
void setDir(double dir)
Sets rotation angle.
Definition: rectitem.h:80
void setWidth(double width)
Sets width.
Definition: rectitem.h:107
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:69
Decoration item class.
Definition: decoitem.h:35
FillStyle fillStyle() const
Returns fill style.
Definition: rectitem.h:71
void setSymbol(Symbol symbol)
Sets line type.
Definition: rectitem.h:102