13 const int FIELD_WIDTH=45; //GUI size
14 const int FIELD_HEIGHT=45;
20 QPropertyAnimation *a;
24 Animation(QRect _src, QString _name):src(_src),name(_name)
27 QPropertyAnimation* getAnimation(QWidget *i)
29 a->setTargetObject(i);
34 class Move : public Animation
37 Move(QRect _src, QRect _dst):Animation(_src,"Move")
39 a=new QPropertyAnimation();
40 a->setPropertyName("geometry");
42 a->setStartValue(_src);
46 class Hide : public Animation
49 Hide(QRect _src): Animation (_src,"Hide")
51 a=new QPropertyAnimation();
55 a->setPropertyName("geometry");
57 a->setStartValue(src);
61 class FieldView : public QWidget
65 explicit FieldView(QWidget *parent = 0);
66 PlayField* setPlayField(PlayField *pf);
72 QStateMachine *machine;
76 QList<Animation*> *moves;
80 void solved(int moves);
81 void updateMoves(int moves);
84 void cellMoved(int w, int h, int wnew, int hnew);
85 void cellGone(int w, int h);
93 void mousePressEvent(QMouseEvent *event);
94 void mouseReleaseEvent(QMouseEvent *event);
95 virtual void updateWidgets();
97 //void paintCell(int x, int y, int cell, QPainter &painter);
98 QWidget *cellWidget(int w, int h);
99 QRect coo(int x, int y, int off=1)
101 return QRect(x*FV::FIELD_WIDTH+off,y*FV::FIELD_HEIGHT+off,FV::FIELD_WIDTH-off,FV::FIELD_HEIGHT-off);
103 QPoint cell(int worldX, int worldY)
105 return QPoint(width()/worldX, height()/worldY);
107 QPoint cell(const QPoint &pos)
109 return QPoint(pos.x()/FV::FIELD_WIDTH, pos.y()/FV::FIELD_HEIGHT);
114 #endif // FIELDVIEW_H