12 const int FIELD_WIDTH=45; //GUI size
13 const int FIELD_HEIGHT=45;
19 QPropertyAnimation *a;
23 Animation(QRect _src, QString _name):src(_src),name(_name)
26 QPropertyAnimation* getAnimation(QWidget *i)
28 a->setTargetObject(i);
33 class Move : public Animation
36 Move(QRect _src, QRect _dst):Animation(_src,"Move")
38 a=new QPropertyAnimation();
39 a->setPropertyName("geometry");
41 a->setStartValue(_src);
45 class Hide : public Animation
48 Hide(QRect _src): Animation (_src,"Hide")
50 a=new QPropertyAnimation();
54 a->setPropertyName("geometry");
56 a->setStartValue(src);
60 class FieldView : public QWidget
64 explicit FieldView(QWidget *parent = 0);
65 PlayField* setPlayField(PlayField *pf);
72 QList<Animation*> *moves;
76 void solved(int moves);
77 void updateMoves(int moves);
80 void cellMoved(int w, int h, int wnew, int hnew);
81 void cellGone(int w, int h);
89 void mousePressEvent(QMouseEvent *event);
90 void mouseReleaseEvent(QMouseEvent *event);
91 virtual void updateWidgets();
93 //void paintCell(int x, int y, int cell, QPainter &painter);
94 QWidget *cellWidget(int w, int h);
95 QRect coo(int x, int y, int off=1)
97 return QRect(x*FV::FIELD_WIDTH+off,y*FV::FIELD_HEIGHT+off,FV::FIELD_WIDTH-off,FV::FIELD_HEIGHT-off);
99 QPoint cell(int worldX, int worldY)
101 return QPoint(width()/worldX, height()/worldY);
103 QPoint cell(const QPoint &pos)
105 return QPoint(pos.x()/FV::FIELD_WIDTH, pos.y()/FV::FIELD_HEIGHT);
110 #endif // FIELDVIEW_H