mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
bug fix: cross ref item have wrong behavior when rotate is master. (thanks mmiacca)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2984 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -31,15 +31,14 @@
|
||||
* @param elmt element to dispaly the cross ref
|
||||
* @param parent parent QetGraphicsItem
|
||||
*/
|
||||
CrossRefItem::CrossRefItem(Element *elmt, QetGraphicsItem *parent) :
|
||||
QetGraphicsItem(parent),
|
||||
CrossRefItem::CrossRefItem(Element *elmt, QGraphicsItem *parent) :
|
||||
QGraphicsObject(parent),
|
||||
element_ (elmt)
|
||||
{
|
||||
snap_to_grid_=false;
|
||||
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
|
||||
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||
connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(autoPos()));
|
||||
connect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
|
||||
connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
|
||||
connect(elmt->diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
@@ -50,7 +49,7 @@ CrossRefItem::CrossRefItem(Element *elmt, QetGraphicsItem *parent) :
|
||||
CrossRefItem::~CrossRefItem() {
|
||||
disconnect(element_, SIGNAL(positionChange(QPointF)), this, SLOT(autoPos()));
|
||||
disconnect(element_, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
|
||||
disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
|
||||
disconnect(element_->diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +188,7 @@ void CrossRefItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
*/
|
||||
void CrossRefItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
element_->setHighlighted(true);
|
||||
QetGraphicsItem::mouseMoveEvent(e);
|
||||
QGraphicsObject::mouseMoveEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +198,7 @@ void CrossRefItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
*/
|
||||
void CrossRefItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
element_->setHighlighted(false);
|
||||
QetGraphicsItem::mouseReleaseEvent(e);
|
||||
QGraphicsObject::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,13 +29,13 @@ class element;
|
||||
* It's the responsability of the parent to informe displayed slave are moved,
|
||||
* by calling the slot @updateLabel
|
||||
*/
|
||||
class CrossRefItem : public QetGraphicsItem
|
||||
class CrossRefItem : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//Methods
|
||||
public:
|
||||
explicit CrossRefItem(Element *elmt, QetGraphicsItem *parent = 0);
|
||||
explicit CrossRefItem(Element *elmt, QGraphicsItem *parent = 0);
|
||||
~CrossRefItem();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
|
||||
@@ -55,7 +55,10 @@ void MasterElement::linkToElement(Element *elmt) {
|
||||
elmt->linkToElement(this);
|
||||
|
||||
if (elmt->kindInformations()["type"].toString() != "power") {
|
||||
if (!cri_) cri_ = new CrossRefItem(this, this); //create cross ref item if not yet
|
||||
if (!cri_) {
|
||||
cri_ = new CrossRefItem(this); //create cross ref item if not yet
|
||||
diagram()->addItem(cri_);
|
||||
}
|
||||
connect(elmt, SIGNAL(positionChange(QPointF)), cri_, SLOT(updateLabel()));
|
||||
cri_->updateLabel();
|
||||
}
|
||||
@@ -93,6 +96,7 @@ void MasterElement::unlinkElement(Element *elmt) {
|
||||
if (elmt->kindInformations()["type"].toString() != "power") delete_cri = false;
|
||||
|
||||
if (delete_cri) {
|
||||
diagram()->removeItem(cri_);
|
||||
delete cri_;
|
||||
cri_ = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user