mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 09:40:52 +01:00
Lors du deplacement d'un champ de texte rattache a un conducteur, ce dernier est desormais mis en evidence.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@988 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *parent_diagram) :
|
||||
DiagramTextItem(parent_conductor, parent_diagram),
|
||||
parent_conductor_(parent_conductor),
|
||||
moved_by_user_(false)
|
||||
moved_by_user_(false),
|
||||
first_move_(true)
|
||||
{
|
||||
// par defaut, les DiagramTextItem sont Selectable et Movable
|
||||
// cela nous convient, on ne touche pas a ces flags
|
||||
@@ -42,7 +43,8 @@ ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *paren
|
||||
ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor, Diagram *parent_diagram) :
|
||||
DiagramTextItem(text, parent_conductor, parent_diagram),
|
||||
parent_conductor_(parent_conductor),
|
||||
moved_by_user_(false)
|
||||
moved_by_user_(false),
|
||||
first_move_(true)
|
||||
{
|
||||
// par defaut, les DiagramTextItem sont Selectable et Movable
|
||||
// cela nous convient, on ne touche pas a ces flags
|
||||
@@ -128,6 +130,7 @@ void ConductorTextItem::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
if ((flags() & QGraphicsItem::ItemIsMovable) && (e -> buttons() & Qt::LeftButton)) {
|
||||
before_mov_pos_ = pos();
|
||||
}
|
||||
first_move_ = true;
|
||||
DiagramTextItem::mousePressEvent(e);
|
||||
}
|
||||
|
||||
@@ -147,10 +150,17 @@ void ConductorTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
if (parent_conductor_) {
|
||||
if (parent_conductor_ -> isNearConductor(intended_pos)) {
|
||||
setPos(intended_pos);
|
||||
parent_conductor_ -> setHighlighted(Conductor::Normal);
|
||||
} else {
|
||||
parent_conductor_ -> setHighlighted(Conductor::Alert);
|
||||
}
|
||||
}
|
||||
|
||||
} else e -> ignore();
|
||||
|
||||
if (first_move_) {
|
||||
first_move_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,6 +184,10 @@ void ConductorTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
|
||||
diagram_ptr -> undoStack().push(undo_object);
|
||||
}
|
||||
|
||||
if (parent_conductor_) {
|
||||
parent_conductor_ -> setHighlighted(Conductor::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(e -> modifiers() & Qt::ControlModifier)) {
|
||||
|
||||
Reference in New Issue
Block a user