2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2015-02-20 14:56:22 +00:00
|
|
|
Copyright 2006-2015 The QElectroTech Team
|
2009-04-03 19:30:25 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef GHOST_ELEMENT_H
|
|
|
|
#define GHOST_ELEMENT_H
|
|
|
|
#include "customelement.h"
|
|
|
|
class QGraphicsItem;
|
|
|
|
class ElementsLocation;
|
|
|
|
class Terminal;
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
The GhostElement class inherits CustomElement. A GhostElement aims at
|
|
|
|
visually replacing a CustomElement whose definition could not be loaded.
|
|
|
|
This way, instead of not loading an element, thus potentially losing its
|
|
|
|
position, its orientation, its child text items and conductors, one can
|
|
|
|
substitute a GhostElement. The GhostElement will extrapolate the position
|
|
|
|
of terminals and text items from the rest of the diagram. It is visually
|
|
|
|
rendered using a simple rectangle.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
|
|
|
class GhostElement : public CustomElement {
|
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructor, destructor
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
2014-12-14 13:06:21 +00:00
|
|
|
GhostElement(const ElementsLocation &, QGraphicsItem * = 0);
|
2009-04-03 19:30:25 +00:00
|
|
|
virtual ~GhostElement();
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
2012-09-27 18:59:16 +00:00
|
|
|
virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);
|
2013-12-31 12:03:36 +00:00
|
|
|
virtual int linkType() const {return Simple;}
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QRectF minimalBoundingRect() const;
|
|
|
|
bool terminalsFromXml(QDomElement &, QHash<int, Terminal *> &);
|
2009-04-05 11:48:26 +00:00
|
|
|
void generateDrawings();
|
|
|
|
void generateDrawing(QPainter *);
|
2009-04-03 19:30:25 +00:00
|
|
|
};
|
|
|
|
#endif
|