mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
+ Agrandissement des pts de deplacement des conducteurs lorsqu'on clique dessus.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@802 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -93,6 +93,8 @@ Conductor::Conductor(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene
|
||||
this,
|
||||
SLOT(displayedTextChanged())
|
||||
);
|
||||
// taille du carre de saisie du segment
|
||||
RectMoveSeg_Scale = 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,10 +510,10 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
if (i > 1) {
|
||||
qp -> fillRect(
|
||||
QRectF(
|
||||
((previous_point.x() + point.x()) / 2.0 ) - pretty_offset,
|
||||
((previous_point.y() + point.y()) / 2.0 ) - pretty_offset,
|
||||
2.0,
|
||||
2.0
|
||||
((previous_point.x() + point.x()) / 2.0 ) - pretty_offset * RectMoveSeg_Scale,
|
||||
((previous_point.y() + point.y()) / 2.0 ) - pretty_offset * RectMoveSeg_Scale,
|
||||
2.0 * RectMoveSeg_Scale,
|
||||
2.0 * RectMoveSeg_Scale
|
||||
),
|
||||
square_brush
|
||||
);
|
||||
@@ -601,11 +603,12 @@ void Conductor::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
} else if (hasClickedOn(press_point, segment -> middle())) {
|
||||
moving_point = false;
|
||||
moving_segment = true;
|
||||
RectMoveSeg_Scale = 2.0;
|
||||
previous_z_value = zValue();
|
||||
setZValue(5000.0);
|
||||
moved_segment = segment;
|
||||
break;
|
||||
}
|
||||
}else RectMoveSeg_Scale = 1.0;
|
||||
segment = segment -> nextSegment();
|
||||
}
|
||||
}
|
||||
@@ -620,17 +623,19 @@ void Conductor::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
@param e L'evenement decrivant le deplacement de souris.
|
||||
*/
|
||||
void Conductor::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
// position pointee par la souris
|
||||
qreal mouse_x = e -> pos().x();
|
||||
qreal mouse_y = e -> pos().y();
|
||||
|
||||
// clic gauche
|
||||
if (e -> buttons() & Qt::LeftButton) {
|
||||
// position pointee par la souris
|
||||
qreal mouse_x = e -> pos().x();
|
||||
qreal mouse_y = e -> pos().y();
|
||||
|
||||
bool snap_conductors_to_grid = e -> modifiers() ^ Qt::ShiftModifier;
|
||||
if (snap_conductors_to_grid) {
|
||||
mouse_x = qRound(mouse_x / (Diagram::xGrid * 1.0)) * Diagram::xGrid;
|
||||
mouse_y = qRound(mouse_y / (Diagram::yGrid * 1.0)) * Diagram::yGrid;
|
||||
}
|
||||
|
||||
if (moving_point) {
|
||||
// la modification par points revient bientot
|
||||
/*
|
||||
|
||||
@@ -93,6 +93,8 @@ class Conductor : public QObject, public QGraphicsPathItem {
|
||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *);
|
||||
|
||||
private:
|
||||
/// taille du carre de saisie du segment
|
||||
int RectMoveSeg_Scale;
|
||||
/// caracteristiques du conducteur
|
||||
ConductorProperties properties_;
|
||||
/// booleen indiquant si le fil est encore valide
|
||||
|
||||
Reference in New Issue
Block a user