graphicsguide.h
Go to the documentation of this file.
1 /***************************************************************************
2  SocNetV: Social Network Visualizer
3  version: 3.1
4  Written in Qt
5 
6  graphicsguide.h - description
7  -------------------
8  copyright : (C) 2005-2023 by Dimitris B. Kalamaras
9  project site : https://socnetv.org
10 
11  ***************************************************************************/
12 
13 /*******************************************************************************
14 * This program is free software: you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation, either version 3 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
26 ********************************************************************************/
27 
28 #ifndef GRAPHICSGUIDE_H
29 #define GRAPHICSGUIDE_H
30 
31 
32 #include <QGraphicsItem>
33 #include <QObject>
34 
35 
36 class GraphicsWidget;
37 
38 static const int TypeGuide = QGraphicsItem::UserType+7;
39 static const int ZValueGuide = 10;
40 
41 class GraphicsGuide : public QObject, public QGraphicsItem {
42  Q_OBJECT
43  Q_INTERFACES (QGraphicsItem)
44 
45 public:
47  const double &x0, const double &y0, const double &radius );
49  const double &y0, const int &width);
50  bool isCircle();
51  void setCircle(const QPointF &center, const double &radius) ;
52  void setHorizontalLine(const QPointF &origin, const int &width) ;
53  double radius();
54  int width();
55  enum { Type = UserType + 7 };
56  int type() const { return Type; }
57  void die();
58 
59 
60 protected:
61  QRectF boundingRect() const;
62  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
63 
64 private:
66  double m_radius;
67  int m_width;
68  bool circle;
69 
70 };
71 
72 #endif
73 
74 
75 
Definition: graphicsguide.h:41
void die()
Definition: graphicsguide.cpp:108
@ Type
Definition: graphicsguide.h:55
GraphicsGuide(GraphicsWidget *, const double &x0, const double &y0, const double &radius)
Definition: graphicsguide.cpp:32
int m_width
Definition: graphicsguide.h:67
GraphicsWidget * graphicsWidget
Definition: graphicsguide.h:65
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: graphicsguide.cpp:95
double radius()
Definition: graphicsguide.cpp:57
void setCircle(const QPointF &center, const double &radius)
Definition: graphicsguide.cpp:65
bool isCircle()
Definition: graphicsguide.cpp:61
double m_radius
Definition: graphicsguide.h:66
bool circle
Definition: graphicsguide.h:68
int width()
Definition: graphicsguide.cpp:80
int type() const
Definition: graphicsguide.h:56
QRectF boundingRect() const
Definition: graphicsguide.cpp:85
void setHorizontalLine(const QPointF &origin, const int &width)
Definition: graphicsguide.cpp:73
Definition: graphicswidget.h:53
static const int TypeGuide
Definition: graphicsguide.h:38
static const int ZValueGuide
Definition: graphicsguide.h:39