Reputation: 153
so I'm currently making a scrabble game
and I have a QGraphicsScene with a grid on it. The grid is made out of tiles which are custom QGraphicsItems containing variables.
Now I also have another custom QGraphicsItem, which are the characters that should be placed on the tiles (so the other QGraphicsItems). How can I make the user put the characters on the tiles with some kind of drag and drop mechanism?
Thanks in advance
Upvotes: 1
Views: 489
Reputation: 27611
Assuming the user is using the mouse to move characters, when they release the mouse after dragging a character, search for the nearest grid item position and then animate the tile to that position, probably with QGraphicsItemAnimation.
Upvotes: 1