Element of Qt interface to represent a Piece. More...
#include <Renderers/Qt2DPiece.hpp>
Public Member Functions | |
Qt2DPiece (const QString &fileName, int color, QGraphicsItem *parent=NULL) | |
~Qt2DPiece () | |
void | reset () |
int | color () const |
Q_SIGNAL void | pieceMoved (QPointF start, QPointF end, int color) |
Q_SIGNAL void | requestHelper (QPointF pos, int color) |
Q_SIGNAL void | stopHelper () |
Protected Member Functions | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
Element of Qt interface to represent a Piece.
Displays a SVG picture and allow the user to move it using drag & drop. Additionnaly, the right click will send the signals requestHelper() and stopHelper() at release. The Piece also know about the color actually implementing, that you can get with color() Finally, if a user move is incorrect, the piece can go back to the original position using reset()
Qt2DPiece::Qt2DPiece | ( | const QString & | fileName, | |
int | color, | |||
QGraphicsItem * | parent = NULL | |||
) | [explicit] |
fileName | the name of the file to load | |
parent |
Qt2DPiece::~Qt2DPiece | ( | ) |
Resets the Piece position
int Qt2DPiece::color | ( | ) | const [inline] |
Gets the color associated to the piece
void Qt2DPiece::reset | ( | ) |
Resets the Piece position