mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
QetShapeItem: improve code.
Other improvement related to the refactoring of QetShapeItem git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3134 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -50,11 +50,7 @@ Diagram* QetGraphicsItem::diagram() const{
|
||||
void QetGraphicsItem::setPos(const QPointF &p) {
|
||||
if (p == pos() || !is_movable_) return;
|
||||
if (scene() && snap_to_grid_) {
|
||||
// arrondit l'abscisse a 10 px pres
|
||||
int p_x = qRound(p.x() / (Diagram::xGrid * 1.0)) * Diagram::xGrid;
|
||||
// arrondit l'ordonnee a 10 px pres
|
||||
int p_y = qRound(p.y() / (Diagram::yGrid * 1.0)) * Diagram::yGrid;
|
||||
QGraphicsItem::setPos(p_x, p_y);
|
||||
QGraphicsItem::setPos(Diagram::snapToGrid(p));
|
||||
emit positionChange(pos());
|
||||
} else QGraphicsItem::setPos(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user