mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Fixed ghost elements.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1944 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "qet.h"
|
||||
#include "terminal.h"
|
||||
#include "elementtextitem.h"
|
||||
#include "diagramcommands.h"
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@@ -53,7 +54,7 @@ GhostElement::~GhostElement() {
|
||||
ajouter les bons couples (id, adresse).
|
||||
@return true si l'import a reussi, false sinon
|
||||
*/
|
||||
bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
||||
bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool handle_inputs_rotation) {
|
||||
// instancie les bornes decrites dans l'element XML
|
||||
terminalsFromXml(e, table_id_adr);
|
||||
|
||||
@@ -78,14 +79,19 @@ bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr)
|
||||
// on peut desormais confectionner le rendu de l'element
|
||||
generateDrawings();
|
||||
|
||||
// position, selection et orientation
|
||||
// position, selection
|
||||
setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
|
||||
// orientation
|
||||
bool conv_ok;
|
||||
int read_ori = e.attribute("orientation").toInt(&conv_ok);
|
||||
if (!conv_ok || read_ori < 0 || read_ori > 3) read_ori = ori.defaultOrientation();
|
||||
setOrientation((QET::Orientation)read_ori);
|
||||
|
||||
if (handle_inputs_rotation) {
|
||||
RotateElementsCommand::rotateElement(this, (QET::Orientation)read_ori);
|
||||
} else {
|
||||
setOrientation((QET::Orientation)read_ori);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class GhostElement : public CustomElement {
|
||||
|
||||
// methodes
|
||||
public:
|
||||
bool fromXml(QDomElement &, QHash<int, Terminal *> &);
|
||||
virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);
|
||||
|
||||
protected:
|
||||
QRectF minimalBoundingRect() const;
|
||||
|
||||
Reference in New Issue
Block a user