To learn Qt, I'm creating something that resembles a chess board. I'm not going to implement the game logic; I just want to toy with mouse click events and drag events.
I want to be able to drag chess pieces (without drop for now), but the chess piece's mousePressEvent and mouseMoveEvent don't get triggered when I expect them to. I double checked it by putting breakpoints at the start of both event handling functions.
The GUI

Each chess piece is represented by an instance of this class.
class ChessPiece : public QGraphicsPixmapItem
To copy to clipboard, switch view to plain text mode
Each board tile is represented by an instance of this class.
class BoardTile : public QGraphicsItem
To copy to clipboard, switch view to plain text mode
===============================
chesspiece.h (snippet)
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
To copy to clipboard, switch view to plain text mode
If there are any important code snippets that you need to see to help me out, either ask me to post them or download the full source here. I work with QtCreator.
Bookmarks