Qt-interest Archive, October 2007
QGraphicsItem snap to grid
Message 1 in thread
Hello Guys,
Do you have a suggestion for the most efficient way to handle the snap to
grid feature to QGraphicsItem-s in QGraphicsView/scene when moving the
selected items?
I suppose I should reimplement one of the mouseMove event, (probably the
QGraphicsScene's one)
Do you have an idea or experience with this problem?
thanks a lot,
--
[ signature omitted ]
Message 2 in thread
On 8 ÐÐÑ. 2007, at 22:51, Norbert Szabà wrote:
> Hello Guys,
>
> Do you have a suggestion for the most efficient way to handle the
> snap to grid feature to QGraphicsItem-s in QGraphicsView/scene when
> moving the selected items?
> I suppose I should reimplement one of the mouseMove event,
> (probably the QGraphicsScene's one)
> Do you have an idea or experience with this problem?
It is good idea to reimplement QGraphicsItem::itemChange()
for your items. In such method for ItemPositionChange you can suggest
new x,y coords snapped to your grid.
Oleksandr Yakovlyev
yshurik@xxxxxxxxx
Kiev, Ukraine
Message 3 in thread
2007/10/8, Oleksandr Yakovlyev <yshurik@xxxxxxxxx>:
>
>
> On 8 окт. 2007, at 22:51, Norbert Szabó wrote:
>
> Hello Guys,
>
> Do you have a suggestion for the most efficient way to handle the snap to
> grid feature to QGraphicsItem-s in QGraphicsView/scene when moving the
> selected items?
> I suppose I should reimplement one of the mouseMove event, (probably the
> QGraphicsScene's one)
> Do you have an idea or experience with this problem?
>
>
> It is good idea to reimplement QGraphicsItem::itemChange()
> for your items. In such method for ItemPositionChange you can suggest
> new x,y coords snapped to your grid.
>
>
> Oleksandr Yakovlyev
> yshurik@xxxxxxxxx
> Kiev, Ukraine
>
>
>
This method escaped my attention, it's really a good solution!
Thank you very much,
Norbert Szabo