QElectroTech  0.8-dev
customelementpart.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 CUSTOM_ELEMENT_PART_H
19 #define CUSTOM_ELEMENT_PART_H
20 
21 #include "qet.h"
22 
23 class CustomElement;
25 class ElementScene;
26 class QETElementEditor;
27 class QUndoStack;
28 class QGraphicsItem;
29 class QGraphicsSceneMouseEvent;
30 
41  // constructors, destructor
42  public:
53  virtual ~CustomElementPart() {}
54 
55  private:
57 
58  // attributes
59  private:
61 
62  // methods
63  public:
67  virtual void fromXml(const QDomElement &) = 0;
71  virtual const QDomElement toXml(QDomDocument &) const = 0;
75  virtual void setProperty(const char *name, const QVariant &value) = 0;
79  virtual QVariant property(const char *name) const = 0;
84  virtual bool isUseless() const = 0;
85  virtual QRectF sceneGeometricRect() const = 0;
90  virtual void startUserTransformation(const QRectF &) = 0;
94  virtual void handleUserTransformation(const QRectF &,
95  const QRectF &) = 0;
97  virtual QETElementEditor *elementEditor() const;
102  virtual void updateCurrentPartEditor() const;
104  virtual ElementScene *elementScene() const;
106  virtual QUndoStack &undoStack() const;
108  virtual QString name() const = 0;
110  virtual QString xmlName() const = 0;
111 
112  virtual QGraphicsItem *toItem();
113 
115 
116  protected:
117  QList<QPointF> mapPoints(
118  const QRectF &,
119  const QRectF &,
120  const QList<QPointF> &);
121 };
122 #endif
ElementPrimitiveDecorator
Definition: elementprimitivedecorator.h:41
CustomElementPart::elementEditor
virtual QETElementEditor * elementEditor() const
Definition: customelementpart.cpp:22
CustomElementPart::name
virtual QString name() const =0
CustomElementPart::CustomElementPart
CustomElementPart(const CustomElementPart &)
QET::SnapScalingPointToGrid
@ SnapScalingPointToGrid
snap the point used to define the new bounding rectangle to the grid
Definition: qet.h:83
CustomElementPart::toXml
virtual const QDomElement toXml(QDomDocument &) const =0
CustomElementPart::toItem
virtual QGraphicsItem * toItem()
Definition: customelementpart.cpp:47
CustomElementPart::undoStack
virtual QUndoStack & undoStack() const
Definition: customelementpart.cpp:42
CustomElementPart::startUserTransformation
virtual void startUserTransformation(const QRectF &)=0
CustomElementPart::fromXml
virtual void fromXml(const QDomElement &)=0
CustomElementPart::element_editor
QETElementEditor * element_editor
Definition: customelementpart.h:60
qetelementeditor.h
qet.h
CustomElementPart::updateCurrentPartEditor
virtual void updateCurrentPartEditor() const
Definition: customelementpart.cpp:30
CustomElementPart::sceneGeometricRect
virtual QRectF sceneGeometricRect() const =0
CustomElementPart::xmlName
virtual QString xmlName() const =0
CustomElementPart::property
virtual QVariant property(const char *name) const =0
CustomElementPart::~CustomElementPart
virtual ~CustomElementPart()
~CustomElementPart Destructor
Definition: customelementpart.h:53
CustomElementPart::setProperty
virtual void setProperty(const char *name, const QVariant &value)=0
CustomElementPart::preferredScalingMethod
virtual QET::ScalingMethod preferredScalingMethod() const
Definition: customelementpart.cpp:58
CustomElementPart
The CustomElementPart class This abstract class represents a primitive of the visual representation o...
Definition: customelementpart.h:40
CustomElementPart::elementScene
virtual ElementScene * elementScene() const
Definition: customelementpart.cpp:37
CustomElementPart::mapPoints
QList< QPointF > mapPoints(const QRectF &, const QRectF &, const QList< QPointF > &)
Definition: customelementpart.cpp:69
QET::ScalingMethod
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive.
Definition: qet.h:81
ElementScene
The ElementScene class This class is the canvas allowing the visual edition of an electrial element....
Definition: elementscene.h:40
CustomElementPart::CustomElementPart
CustomElementPart(QETElementEditor *editor)
CustomElementPart Constructor.
Definition: customelementpart.h:48
customelementpart.h
CustomElementPart::isUseless
virtual bool isUseless() const =0
QETElementEditor
Definition: qetelementeditor.h:33
CustomElementPart::handleUserTransformation
virtual void handleUserTransformation(const QRectF &, const QRectF &)=0