1 #include "mainwindow.h"
2 #include <QApplication>
3 #include <windows.h>
4
5 //定义一个窗口类
6 class Window
7 {
8 public:
9 MainWindow *p;
10 int x;//大小
11 int y;
12 int cx;//位置
13 int cy;
14
15 public:
16 Window()
17 {
18 p = new MainWindow();
19 this->x = 0;
20 this->y = 0;
21 this->cx = 100;
22 this->cy = 100;
23 p->resize(this->x,this->y);
24 p->move(this->cx,this->cy);
25 p->show();
26 }
27 ~Window()
28 {
29 delete p;
30 }
31
32 void update()
33 {
34 p->resize(this->x,this->y);
35 p->move(this->cx,this->cy);
36 }
37
38 void changesize(int a,int b)
39 {
40 this->x = a;
41 this->y = b;
42 }
43
44 void changepos(int x,int y)
45 {
46 this->cx = x;
47 this->cy = y;
48 }
49 };
50
51 int main(int argc, char *argv[])
52 {
53 QApplication a(argc, argv);
54
55 Window *my1 = new Window();
56 while(1)
57 {
58 for(int i=100;i<800;i++)
59 {
60 my1->changesize(i,i);
61 my1->update();
62 Sleep(5);
63 }
64
65 for(int i=800;i>100;i--)
66 {
67 my1->changesize(i,i);
68 my1->update();
69 Sleep(5);
70 }
71 }
72
73
74 return a.exec();
75 }