mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Nettoyage dans les methodes Conductor::update*
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@985 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -105,36 +105,13 @@ Conductor::~Conductor() {
|
||||
}
|
||||
|
||||
/**
|
||||
Met a jour la representation graphique du conducteur.
|
||||
Met a jour la representation graphique du conducteur en recalculant son
|
||||
trace. Cette fonction est typiquement appelee lorsqu'une seule des bornes du
|
||||
conducteur a change de position.
|
||||
@param rect Rectangle a mettre a jour
|
||||
@see QGraphicsPathItem::update()
|
||||
*/
|
||||
void Conductor::update(const QRectF &rect) {
|
||||
// appelle la bonne fonction pour calculer l'aspect du conducteur
|
||||
if (nbSegments() && !conductor_profiles[currentPathType()].isNull()) {
|
||||
priv_modifieConductor(
|
||||
terminal1 -> dockConductor(), terminal1 -> orientation(),
|
||||
terminal2 -> dockConductor(), terminal2 -> orientation()
|
||||
);
|
||||
} else {
|
||||
priv_calculeConductor(
|
||||
terminal1 -> dockConductor(), terminal1 -> orientation(),
|
||||
terminal2 -> dockConductor(), terminal2 -> orientation()
|
||||
);
|
||||
}
|
||||
|
||||
calculateTextItemPosition();
|
||||
QGraphicsPathItem::update(rect);
|
||||
}
|
||||
|
||||
/**
|
||||
Met a jour la representation graphique du conducteur en considerant que la
|
||||
borne b a pour position pos. Cette fonction est appelee lorsqu'une seule
|
||||
des bornes du conducteur a change de position.
|
||||
@param rect Rectangle a mettre a jour
|
||||
@param b Borne
|
||||
@param newpos position de la borne b
|
||||
*/
|
||||
void Conductor::updateWithNewPos(const QRectF &rect) {
|
||||
void Conductor::updatePath(const QRectF &rect) {
|
||||
QPointF p1, p2;
|
||||
p1 = terminal1 -> dockConductor();
|
||||
p2 = terminal2 -> dockConductor();
|
||||
|
||||
@@ -61,8 +61,7 @@ class Conductor : public QObject, public QGraphicsPathItem {
|
||||
/// @return true si ce conducteur est detruit
|
||||
bool isDestroyed() const { return(destroyed); }
|
||||
Diagram *diagram() const;
|
||||
void updateWithNewPos(const QRectF &);
|
||||
void update(const QRectF & = QRectF());
|
||||
void updatePath(const QRectF & = QRectF());
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
QRectF boundingRect() const;
|
||||
virtual QPainterPath shape() const;
|
||||
|
||||
@@ -880,7 +880,7 @@ void Diagram::moveElements(const QPointF &diff, QGraphicsItem *dontmove) {
|
||||
|
||||
// recalcule les autres conducteurs
|
||||
foreach(Conductor *conductor, conductorsToUpdate()) {
|
||||
conductor -> updateWithNewPos(QRectF());
|
||||
conductor -> updatePath();
|
||||
}
|
||||
|
||||
// deplace les champs de texte
|
||||
|
||||
@@ -354,7 +354,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
|
||||
|
||||
// recalcule les autres conducteurs
|
||||
foreach(Conductor *conductor, content_to_move.conductorsToUpdate) {
|
||||
conductor -> updateWithNewPos(QRectF());
|
||||
conductor -> updatePath();
|
||||
}
|
||||
|
||||
// deplace les textes
|
||||
|
||||
@@ -379,7 +379,7 @@ void Terminal::updateConductor() {
|
||||
if (!scene() || !parentItem()) return;
|
||||
foreach (Conductor *conductor, conductors_) {
|
||||
if (conductor -> isDestroyed()) continue;
|
||||
conductor -> update(QRectF());
|
||||
conductor -> updatePath();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user