#include <QFontMetrics>
int PuzzleItem::moveCount_ = 0;
+bool PuzzleItem::manuallyMovable_ = false;
PuzzleItem::PuzzleItem(QGraphicsItem *parent) :
QGraphicsPixmapItem(parent)
void PuzzleItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- if(movable_) {
+ if(movable_ && manuallyMovable_) {
moveMeTo(GameView::instance()->emptyPlace());
QPointF tmp = currentPlace();
setCurrentPlace(GameView::instance()->emptyPlace());
moveCount_ = 0;
}
+void PuzzleItem::setManuallyMovable(const bool manuallyMovable)
+{
+ manuallyMovable_ = manuallyMovable;
+}
+
void PuzzleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QGraphicsPixmapItem::paint(painter, option, widget);