Public Member Functions | Protected Member Functions

Qt2DPiece Class Reference

Element of Qt interface to represent a Piece. More...

#include <Renderers/Qt2DPiece.hpp>

List of all members.

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)

Detailed Description

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()

See also:
Qt2DDisplay

Constructor & Destructor Documentation

Qt2DPiece::Qt2DPiece ( const QString &  fileName,
int  color,
QGraphicsItem *  parent = NULL 
) [explicit]
Parameters:
fileName the name of the file to load
parent 
Qt2DPiece::~Qt2DPiece (  ) 

Resets the Piece position


Member Function Documentation

int Qt2DPiece::color (  )  const [inline]

Gets the color associated to the piece

void Qt2DPiece::reset (  ) 

Resets the Piece position


The documentation for this class was generated from the following files:
 All Classes Functions Variables