mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Correction du positionnement des textes des conducteurs multifilaires lors du chargement d'un schema.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@890 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -42,6 +42,7 @@ Conductor::Conductor(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene
|
|||||||
terminal1(p1),
|
terminal1(p1),
|
||||||
terminal2(p2),
|
terminal2(p2),
|
||||||
destroyed(false),
|
destroyed(false),
|
||||||
|
text_item(0),
|
||||||
segments(NULL),
|
segments(NULL),
|
||||||
moving_point(false),
|
moving_point(false),
|
||||||
moving_segment(false),
|
moving_segment(false),
|
||||||
@@ -749,6 +750,9 @@ QVariant Conductor::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
// le conducteur vient de se faire deselectionner
|
// le conducteur vient de se faire deselectionner
|
||||||
setZValue(previous_z_value);
|
setZValue(previous_z_value);
|
||||||
}
|
}
|
||||||
|
} else if (change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemVisibleHasChanged) {
|
||||||
|
// permet de positionner correctement le texte du conducteur lors de son ajout a un schema
|
||||||
|
calculateTextItemPosition();
|
||||||
}
|
}
|
||||||
return(QGraphicsPathItem::itemChange(change, value));
|
return(QGraphicsPathItem::itemChange(change, value));
|
||||||
}
|
}
|
||||||
@@ -1070,6 +1074,7 @@ ConductorSegment *Conductor::middleSegment() {
|
|||||||
*/
|
*/
|
||||||
void Conductor::calculateTextItemPosition() {
|
void Conductor::calculateTextItemPosition() {
|
||||||
if (properties_.type != ConductorProperties::Multi) return;
|
if (properties_.type != ConductorProperties::Multi) return;
|
||||||
|
if (!text_item) return;
|
||||||
text_item -> setPos(middleSegment() -> middle());
|
text_item -> setPos(middleSegment() -> middle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user