QElectroTech  0.70
qetgraphicsitem.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QETGRAPHICSITEM_H
19 #define QETGRAPHICSITEM_H
20 
21 #include <QGraphicsObject>
22 #include "qet.h"
23 
24 class Diagram;
25 
26 class QetGraphicsItem : public QGraphicsObject
27 {
28  Q_OBJECT
29 
30  public:
31  //constructor destructor
32  QetGraphicsItem(QGraphicsItem *parent = nullptr);
33  ~QetGraphicsItem() override = 0;
34 
35  //public methode
36  Diagram *diagram () const;
37  virtual void setPos (const QPointF &p);
38  virtual void setPos (qreal x, qreal y);
39 
40  virtual bool isMovable () const {return is_movable_;}
41  virtual void setMovable (bool movable) { is_movable_ = movable;}
42 
43  virtual void editProperty () {}
44  virtual QString name ()const {return QString("");}
45 
47 
48  //protected method
49  protected:
50  void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
51  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
52  void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
53  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
54 
55  protected:
61 
62 };
63 
64 #endif // QETGRAPHICSITEM_H
~QetGraphicsItem() override=0
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
QetGraphicsItem::mouseMoveEvent handle mouse movement.
Diagram * diagram() const
QetGraphicsItem::diagram return the diagram of this item.
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
QetGraphicsItem::mouseReleaseEvent handle mouse release click.
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
QetGraphicsItem::mousePressEvent handle the mouse click.
QPointF m_mouse_to_origin_movement
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
QetGraphicsItem::mouseDoubleClickEvent handle the mouse double click.
QET::GraphicsItemState m_state
QET::GraphicsItemState state() const
QetGraphicsItem::state.
QetGraphicsItem(QGraphicsItem *parent=nullptr)
QetGraphicsItem::QetGraphicsItem Default constructor.
virtual void editProperty()
General state.
Definition: qet.h:37
virtual bool isMovable() const
GraphicsItemState
Definition: qet.h:36
virtual QString name() const
virtual void setMovable(bool movable)
virtual void setPos(const QPointF &p)
QetGraphicsItem::setPos set the position of the item to p.