QElectroTech  0.70
customelementpart.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 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 
39  // constructors, destructor
40  public:
47  virtual ~CustomElementPart() {}
48 
49  private:
51 
52  // attributes
53  private:
55 
56  // methods
57  public:
61  virtual void fromXml(const QDomElement &) = 0;
65  virtual const QDomElement toXml(QDomDocument &) const = 0;
69  virtual void setProperty(const char *name, const QVariant &value) = 0;
73  virtual QVariant property(const char *name) const = 0;
78  virtual bool isUseless() const = 0;
79  virtual QRectF sceneGeometricRect() const = 0;
83  virtual void startUserTransformation(const QRectF &) = 0;
87  virtual void handleUserTransformation(const QRectF &, const QRectF &) = 0;
89  virtual QETElementEditor *elementEditor() const;
94  virtual void updateCurrentPartEditor() const;
96  virtual ElementScene *elementScene() const;
98  virtual QUndoStack &undoStack() const;
100  virtual QString name() const = 0;
102  virtual QString xmlName() const = 0;
103 
104  virtual QGraphicsItem *toItem();
105 
107 
108  protected:
109  QList<QPointF> mapPoints(const QRectF &, const QRectF &, const QList<QPointF> &);
110 };
111 #endif
virtual QUndoStack & undoStack() const
virtual void fromXml(const QDomElement &)=0
virtual const QDomElement toXml(QDomDocument &) const =0
virtual QETElementEditor * elementEditor() const
virtual void startUserTransformation(const QRectF &)=0
virtual void setProperty(const char *name, const QVariant &value)=0
virtual QET::ScalingMethod preferredScalingMethod() const
QList< QPointF > mapPoints(const QRectF &, const QRectF &, const QList< QPointF > &)
virtual QGraphicsItem * toItem()
virtual ~CustomElementPart()
Destructor.
virtual void handleUserTransformation(const QRectF &, const QRectF &)=0
virtual QRectF sceneGeometricRect() const =0
QETElementEditor * element_editor
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive. ...
Definition: qet.h:79
virtual void updateCurrentPartEditor() const
virtual QString name() const =0
virtual QString xmlName() const =0
virtual QVariant property(const char *name) const =0
virtual ElementScene * elementScene() const
CustomElementPart(QETElementEditor *editor)
virtual bool isUseless() const =0