QElectroTech  0.8-dev
diagrameventaddelement.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 DIAGRAMEVENTADDELEMENT_H
19 #define DIAGRAMEVENTADDELEMENT_H
20 
21 #include "diagrameventinterface.h"
22 #include "elementslocation.h"
23 
24 class Element;
25 
32 {
33  Q_OBJECT
34 
35  public:
36  DiagramEventAddElement(ElementsLocation &location, Diagram *diagram, QPointF pos = QPointF(0,0));
37  ~DiagramEventAddElement() override;
38 
39  void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
40  void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
41  void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override;
42  void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override;
43  void keyPressEvent (QKeyEvent *event) override;
44  void init() override;
45 
46  private:
47  bool buildElement();
48  void addElement();
49 
50  private:
54 };
55 
56 #endif // DIAGRAMEVENTADDELEMENT_H
ElementsLocation::exist
bool exist() const
ElementsLocation::exist.
Definition: elementslocation.cpp:472
DiagramEventInterface::m_diagram
Diagram * m_diagram
Definition: diagrameventinterface.h:66
DiagramEventAddElement::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
DiagramEventAddElement::keyPressEvent Press space key rotate the element to 90° (return true) else ca...
Definition: diagrameventaddelement.cpp:149
DiagramEventInterface::finish
void finish()
diagramcommands.h
Element::m_converted_text_from_xml_description
QHash< DynamicElementTextItem *, QPointF > m_converted_text_from_xml_description
Definition: element.h:197
DiagramEventAddElement::m_integrate_path
QString m_integrate_path
Definition: diagrameventaddelement.h:53
DiagramEventAddElement::DiagramEventAddElement
DiagramEventAddElement(ElementsLocation &location, Diagram *diagram, QPointF pos=QPointF(0, 0))
DiagramEventAddElement::DiagramEventAddElement Defaut constructor.
Definition: diagrameventaddelement.cpp:33
Diagram::freezeNewConductors
bool freezeNewConductors()
Diagram::freezeNewConductors.
Definition: diagram.cpp:2158
DiagramEventAddElement::~DiagramEventAddElement
~DiagramEventAddElement() override
DiagramEventAddElement::~DiagramEventAddElement Destructor Enable context menu for each view of diagr...
Definition: diagrameventaddelement.cpp:60
QETProject::importElement
ElementsLocation importElement(ElementsLocation &location)
QETProject::importElement Import the element represented by location to the embbeded collection of th...
Definition: qetproject.cpp:972
DiagramEventAddElement
The DiagramEventAddElement class This diagram event add a new element, for each left click button at ...
Definition: diagrameventaddelement.h:32
ConductorAutoNumerotation::numerate
void numerate()
ConductorAutoNumerotation::numerate execute the automatic numerotation.
Definition: conductorautonumerotation.cpp:56
Diagram::project
QETProject * project() const
Diagram::project.
Definition: diagram.cpp:2326
ElementsLocation::isElement
bool isElement() const
ElementsLocation::isElement.
Definition: elementslocation.cpp:412
DiagramEventAddElement::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddElement::mousePressEvent Do nothing, but return true for not transit the event to othe...
Definition: diagrameventaddelement.cpp:91
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DiagramEventAddElement::buildElement
bool buildElement()
DiagramEventAddElement::buildElement Build the element, if the element is build successfully,...
Definition: diagrameventaddelement.cpp:175
DiagramEventAddElement::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddElement::mouseReleaseEvent Right button finish this event (isRunning = false) and emit...
Definition: diagrameventaddelement.cpp:102
Element::setUpFormula
void setUpFormula(bool code_letter=true)
Element::setUpFormula Set up the formula used to create the label of this element.
Definition: element.cpp:1654
QET::Icons::Conductor
QIcon Conductor
Definition: qeticons.cpp:35
Diagram::removeItem
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Reimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
Definition: diagram.cpp:1581
DiagramEventAddElement::addElement
void addElement()
DiagramEventAddElement::addElement Add an element at the current pos en current rotation,...
Definition: diagrameventaddelement.cpp:203
elementslocation.h
DiagramEventAddElement::m_location
ElementsLocation m_location
Definition: diagrameventaddelement.h:51
DiagramEventAddElement::m_element
Element * m_element
Definition: diagrameventaddelement.h:52
ElementsLocation::projectCollectionPath
QString projectCollectionPath() const
ElementsLocation::projectCollectionPath.
Definition: elementslocation.cpp:176
AddItemCommand
The AddItemCommand class This command add an item in a diagram The item to add is template,...
Definition: diagramcommands.h:42
element.h
Element::name
QString name() const override
Element::name.
Definition: element.cpp:1756
QETProject::isFreezeNewConductors
bool isFreezeNewConductors()
QETProject::isFreezeNewConductors.
Definition: qetproject.cpp:707
Element
Definition: element.h:41
Element::freezeNewAddedElement
void freezeNewAddedElement()
Element::freezeNewAddedElement Freeze this label if needed.
Definition: element.cpp:1724
ElementFactory::Instance
static ElementFactory * Instance()
Definition: elementfactory.h:38
conductorautonumerotation.h
ElementsLocation
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition: elementslocation.h:46
ConductorAutoNumerotation
The ConductorAutoNumerotation class.
Definition: conductorautonumerotation.h:33
Conductor::setFreezeLabel
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false.
Definition: conductor.cpp:2035
diagrameventinterface.h
elementfactory.h
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
DiagramEventAddElement::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddElement::mouseMoveEvent Move the element to new pos of mouse the event is always accep...
Definition: diagrameventaddelement.cpp:77
Conductor
Definition: conductor.h:43
diagrameventaddelement.h
DiagramEventInterface
The DiagramEventInterface class isRunning() return true if action is running (do something)....
Definition: diagrameventinterface.h:46
QetGraphicsItem::setPos
virtual void setPos(const QPointF &p)
Definition: qetgraphicsitem.cpp:49
DiagramEventInterface::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
DiagramEventInterface::keyPressEvent By default, press escape key abort the curent action.
Definition: diagrameventinterface.cpp:59
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
diagram.h
Element::m_dynamic_text_list
QList< DynamicElementTextItem * > m_dynamic_text_list
Definition: element.h:223
DiagramEventAddElement::init
void init() override
DiagramEventAddElement::init Init this event.
Definition: diagrameventaddelement.cpp:165
DiagramEventAddElement::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddElement::mouseDoubleClickEvent If mouse left double clic, finish this event (isRunning...
Definition: diagrameventaddelement.cpp:129