QElectroTech  0.8-dev
diagrameventaddshape.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 DIAGRAMEVENTADDSHAPE_H
19 #define DIAGRAMEVENTADDSHAPE_H
20 
21 #include "diagrameventinterface.h"
22 #include "qetshapeitem.h"
23 
29 {
30  Q_OBJECT
31 
32  public:
34 
35  ~DiagramEventAddShape() override;
36  void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
37  void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
38  void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override;
39  void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override;
40  void init() override;
41 
42  private:
43  void updateHelpCross (const QPointF &p);
44 
45  protected:
48  QGraphicsLineItem *m_help_horiz, *m_help_verti;
49 };
50 
51 #endif // DIAGRAMEVENTADDSHAPE_H
DiagramEventAddShape::updateHelpCross
void updateHelpCross(const QPointF &p)
DiagramEventAddShape::updateHelpCross Create and update the position of the cross to help user for dr...
Definition: diagrameventaddshape.cpp:211
QetShapeItem::removePoints
void removePoints(int number=1)
QetShapeItem::removePoints Number of point to remove on the polygon If number is superior to number o...
Definition: qetshapeitem.cpp:228
DiagramEventInterface::m_diagram
Diagram * m_diagram
Definition: diagrameventinterface.h:66
Diagram::background_color
static QColor background_color
background color of diagram
Definition: diagram.h:99
QetShapeItem::Rectangle
@ Rectangle
Definition: qetshapeitem.h:58
QetShapeItem::shapeType
ShapeType shapeType() const
Definition: qetshapeitem.h:77
DiagramEventInterface::finish
void finish()
diagramcommands.h
diagrameventaddshape.h
Diagram::addItem
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
Definition: diagram.cpp:1550
QetShapeItem::setNextPoint
void setNextPoint(QPointF P)
QetShapeItem::setNextPoint Add a new point to the curent polygon.
Definition: qetshapeitem.cpp:215
QetShapeItem::ShapeType
ShapeType
Definition: qetshapeitem.h:57
DiagramEventAddShape
The DiagramEventAddShape class This event manage the creation of a shape.
Definition: diagrameventaddshape.h:29
Diagram::border_and_titleblock
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
Definition: diagram.h:83
QetShapeItem::polygon
QPolygonF polygon
Definition: qetshapeitem.h:43
DiagramEventAddShape::m_help_verti
QGraphicsLineItem * m_help_verti
Definition: diagrameventaddshape.h:48
BorderTitleBlock::insideBorderRect
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
Definition: bordertitleblock.cpp:185
QetShapeItem::Ellipse
@ Ellipse
Definition: qetshapeitem.h:59
QetShapeItem::setRect
bool setRect(const QRectF &rect)
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an el...
Definition: qetshapeitem.cpp:140
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DiagramEventAddShape::m_help_horiz
QGraphicsLineItem * m_help_horiz
Definition: diagrameventaddshape.h:48
Diagram::removeItem
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Reimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
Definition: diagram.cpp:1581
Diagram::isReadOnly
bool isReadOnly() const
Diagram::isReadOnly.
Definition: diagram.cpp:2363
DiagramEventAddShape::~DiagramEventAddShape
~DiagramEventAddShape() override
DiagramEventAddShape::~DiagramEventAddShape.
Definition: diagrameventaddshape.cpp:42
AddItemCommand
The AddItemCommand class This command add an item in a diagram The item to add is template,...
Definition: diagramcommands.h:42
QetShapeItem::Polygon
@ Polygon
Definition: qetshapeitem.h:60
QetShapeItem::setP2
void setP2(const QPointF &P2)
QetShapeItem::setP2 Set the second point of this item. If this item is a polyline,...
Definition: qetshapeitem.cpp:104
Diagram::undoStack
QUndoStack & undoStack()
Diagram::undoStack.
Definition: diagram.h:397
QetShapeItem::rect
QRectF rect
Definition: qetshapeitem.h:41
diagrameventinterface.h
QetShapeItem::pointsCount
int pointsCount() const
QetShapeItem::pointCount.
Definition: qetshapeitem.cpp:206
DiagramEventAddShape::DiagramEventAddShape
DiagramEventAddShape(Diagram *diagram, QetShapeItem::ShapeType shape_type)
DiagramEventAddShape::DiagramEventAddShape Default constructor.
Definition: diagrameventaddshape.cpp:28
DiagramEventAddShape::init
void init() override
Definition: diagrameventaddshape.cpp:200
Diagram::snapToGrid
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
DiagramEventInterface::m_running
bool m_running
Definition: diagrameventinterface.h:67
QetShapeItem
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
Definition: qetshapeitem.h:36
qetshapeitem.h
DiagramEventAddShape::m_shape_item
QetShapeItem * m_shape_item
Definition: diagrameventaddshape.h:47
DiagramEventAddShape::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseReleaseEvent Action when mouse button is released.
Definition: diagrameventaddshape.cpp:135
DiagramEventInterface::m_abort
bool m_abort
Definition: diagrameventinterface.h:68
DiagramEventAddShape::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseMoveEvent Action when mouse move.
Definition: diagrameventaddshape.cpp:114
DiagramEventAddShape::m_shape_type
QetShapeItem::ShapeType m_shape_type
Definition: diagrameventaddshape.h:46
DiagramEventAddShape::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseDoubleClickEvent Action when mouse button is double clicked.
Definition: diagrameventaddshape.cpp:177
DiagramEventInterface
The DiagramEventInterface class isRunning() return true if action is running (do something)....
Definition: diagrameventinterface.h:46
QetShapeItem::setClosed
void setClosed(bool close)
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon.
Definition: qetshapeitem.cpp:176
diagram.h
DiagramEventAddShape::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mousePressEvent Action when mouse is pressed.
Definition: diagrameventaddshape.cpp:61