diff --git a/conductor.cpp b/conductor.cpp index 0cbae0639..bdd6c55a1 100644 --- a/conductor.cpp +++ b/conductor.cpp @@ -41,6 +41,8 @@ Conductor::Conductor(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene terminal2(p2), destroyed(false), segments(NULL), + moving_point(false), + moving_segment(false), previous_z_value(zValue()), modified_path(false), has_to_save_profile(false) diff --git a/element.cpp b/element.cpp index 3cfe17eb7..40274c878 100644 --- a/element.cpp +++ b/element.cpp @@ -258,11 +258,21 @@ void Element::setPos(qreal x, qreal y) { setPos(QPointF(x, y)); } +/** + Gere l'enfoncement d'un bouton de la souris +*/ +void Element::mousePressEvent(QGraphicsSceneMouseEvent *e) { + if (!isSelected() && e -> modifiers() & Qt::ControlModifier) { + setSelected(true); + } + QGraphicsItem::mousePressEvent(e); +} + /** Gere les mouvements de souris lies a l'element */ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { - if (e -> buttons() & Qt::LeftButton) { + if (isSelected() && e -> buttons() & Qt::LeftButton) { QPointF oldPos = pos(); setPos(mapToParent(e -> pos()) - matrix().map(e -> buttonDownPos(Qt::LeftButton))); if (Diagram *diagram_ptr = diagram()) { diff --git a/element.h b/element.h index 79847c90c..e4a858f5c 100644 --- a/element.h +++ b/element.h @@ -114,6 +114,7 @@ class Element : public QGraphicsItem { protected: void drawAxes(QPainter *, const QStyleOptionGraphicsItem *); + void mousePressEvent(QGraphicsSceneMouseEvent *); void mouseMoveEvent(QGraphicsSceneMouseEvent *); void mouseReleaseEvent(QGraphicsSceneMouseEvent *);