Преглед на файлове

Limpiando codigo. Todavia no entiendo todo

Rafael Arce Nazario преди 9 години
родител
ревизия
44c305727c
променени са 4 файла, в които са добавени 145 реда и са изтрити 181 реда
  1. 78
    97
      frog.cpp
  2. 9
    4
      frog.h
  3. 54
    80
      mainwindow.cpp
  4. 4
    0
      mainwindow.h

+ 78
- 97
frog.cpp Целия файл

@@ -7,27 +7,30 @@
7 7
 #include "mainwindow.h"
8 8
 #include "ui_mainwindow.h"
9 9
 
10
-frog::frog(QWidget *parent) :
11
-    QWidget(parent)
12
-{
13
-    myTimer= new QTimer(this);
14
-    flag = xFlag = false;
10
+
11
+// Constructor for the frog class
12
+
13
+frog::frog(QWidget *parent) : QWidget(parent) {
14
+
15 15
     Ysapo = 190;
16 16
     A = B = C = 0;
17
+
18
+    myTimer= new QTimer(this);
19
+    flag = xFlag = false;
20
+
21
+    // These are the x positions of the background?
17 22
     temp = 580;
18 23
     temp2 = 0;
24
+
19 25
     backFlag = false;
20 26
     moved = false;
21
-    textBool = false;
22
-    buttonCounter = 0;
23
-    xnenu = -(rand() %30);
24
-    Xsapo = xnenu;
25
-    initialX = Xsapo;
26
-    xnenu2 = (rand() % 100) + 100;
27
-    xnenu3 = xnenu2 + (rand() % 100) + 200;
27
+    showText = false;
28
+
29
+    computeNenuPositions();
28 30
 }
29 31
 
30
-void frog::updatenenu(){
32
+
33
+void frog::computeNenuPositions() {
31 34
     xnenu = -(rand() % 30);
32 35
     Xsapo = xnenu;
33 36
     initialX = Xsapo;
@@ -43,44 +46,35 @@ void frog::reset(){
43 46
     temp2 = 0;
44 47
     backFlag = false;
45 48
     moved = false;
46
-    buttonCounter = 0;
47
-    textBool = false;
49
+    showText = false;
48 50
     repaint();
49 51
 
50 52
     myTimer->stop();
51 53
     delete myTimer;
52 54
     myTimer = new QTimer;
53 55
     connect(myTimer, SIGNAL(timeout()), this, SLOT(mySlot()));
54
-    xnenu = -(rand() %30);
55
-    Xsapo = xnenu;
56
-    initialX = Xsapo;
57
-    xnenu2 = (rand() % 100) + 100;
58
-    xnenu3 = xnenu2 + (rand() % 100) + 200;
59 56
 
57
+    computeNenuPositions();
60 58
 }
61 59
 
62
-void frog::paintEvent(QPaintEvent *event){
60
+void frog::paintEvent(QPaintEvent *){
63 61
     QPainter p(this);
64
-    QString frogger = ":/images/Frogger1.png";
62
+    QString frogger  = ":/images/Frogger1.png";
65 63
     QString frogger2 = ":/images/Frogger2.png";
66 64
     QString frogger3 = ":/images/Frogger3.png";
67
-    QString leaf = ":/images/Nenufar1.png";
68
-    QString back = ":/images/background.jpg";
65
+    QString leaf     = ":/images/Nenufar1.png";
66
+    QString back     = ":/images/background.jpg";
69 67
 
70
-//    Condiciones que permitian un rango de error (no caer en la x exacta de los nenufares)
68
+    //    Condiciones que permitian un rango de error (no caer en la x exacta de los nenufares)
71 69
 
72 70
     if(backFlag == true || (Xsapo <= (xnenu3 + 55) && Xsapo >= (xnenu3 - 55) && Ysapo == 190)
73 71
             || (Xsapo > xnenu && Ysapo == 190 && Xsapo < (xnenu2-55))
74 72
             || (Xsapo > xnenu2 && Ysapo == 190 && Xsapo < (xnenu3-55))
75 73
             || (Xsapo > xnenu3 && Ysapo == 190)){
76 74
 
77
-//    if(backFlag == true || (Ysapo == 190 && (Xsapo != xnenu && Xsapo != xnenu2))){
78
-        if (inter1Label == NULL){
79
-            delete inter1Label;
80
-        }
81
-        if (inter2Label == NULL){
82
-            delete inter2Label;
83
-        }
75
+        if (inter1Label == NULL)    delete inter1Label;
76
+        if (inter2Label == NULL)    delete inter2Label;
77
+
84 78
         backFlag = true;
85 79
         myTimer->stop();
86 80
         delete myTimer;
@@ -88,8 +82,6 @@ void frog::paintEvent(QPaintEvent *event){
88 82
         QThread::msleep(5);
89 83
         connect(myTimer, SIGNAL(timeout()), this, SLOT(mySlot()));
90 84
 
91
-
92
-
93 85
         p.drawPixmap(temp2,-5,600,400,QPixmap(back));
94 86
         p.drawPixmap(temp,-5,600,400,QPixmap(back));
95 87
 
@@ -99,67 +91,57 @@ void frog::paintEvent(QPaintEvent *event){
99 91
         p.drawPixmap(xnenu3,250,125,60,QPixmap(leaf));
100 92
         p.drawText(xnenu3+45,290,"x2 = " + QString::number(xnenu3));
101 93
 
102
-
103
-
104 94
         Xsapo=Xsapo-1;
105 95
         xnenu=xnenu-1;
106 96
         xnenu2=xnenu2-1;
107 97
         xnenu3=xnenu3-1;
98
+
99
+
100
+        // para que???
108 101
         temp= temp - 1;
109 102
         temp2 = temp2 -1;
110 103
 
111
-
112 104
         repaint();
113 105
 
114
-
115
-
116 106
         if(temp == 0 || xnenu3 == -10 || Xsapo == 0){
117 107
             backFlag = false;
118 108
             temp = 580;
119 109
             temp2 = 0;
120 110
             moved = true;
121
-            textBool = false;
122
-            updatenenu();
111
+            showText = false;
112
+            computeNenuPositions();
123 113
         }
124 114
 
125 115
     }
126 116
     else{
127
-          QFont font = p.font();
128
-          font.setBold(true);
129
-          p.setFont(font);
130
-
131
-          p.drawPixmap(temp2,-5,600,400,QPixmap(back));
132
-          p.drawPixmap(temp,-5,600,400,QPixmap(back));
133
-          p.drawPixmap(xnenu,250,125,60,QPixmap(leaf));
134
-          p.drawPixmap(xnenu2,250,125,60,QPixmap(leaf));
135
-          p.drawPixmap(xnenu3,250,125,60,QPixmap(leaf));
136
-
137
-//          Cambiada la condicion para que sea exacta la caida en el nenufar
138
-//          if(Xsapo < (xnenu2 + 55) && Ysapo == 190 && Xsapo > (xnenu2-55)){
139
-//               textBool = true;
140
-//          }
141
-
142
-          if(Ysapo == 190 && Xsapo == xnenu2){
143
-            textBool = true;
144
-          }
145
-
146
-          if(textBool){
147
-              p.drawText(xnenu2+35,290,"x1 = " + QString::number(xnenu2));
148
-              p.drawText(xnenu3+35,290,"x2 = " + QString::number(xnenu3));
149
-              p.drawPixmap(xnenu,250,125,60,QPixmap(leaf));
150
-          }
151
-          else{
152
-              p.drawText(xnenu2+35,290,"x2 = " + QString::number(xnenu2));
153
-          }
117
+        QFont font = p.font();
118
+        font.setBold(true);
119
+        p.setFont(font);
120
+
121
+        p.drawPixmap(temp2,-5,600,400,QPixmap(back));
122
+        p.drawPixmap(temp,-5,600,400,QPixmap(back));
123
+        p.drawPixmap(xnenu,250,125,60,QPixmap(leaf));
124
+        p.drawPixmap(xnenu2,250,125,60,QPixmap(leaf));
125
+        p.drawPixmap(xnenu3,250,125,60,QPixmap(leaf));
126
+
127
+        showText = (Ysapo == 190 && Xsapo == xnenu2);
128
+
129
+        if(showText){
130
+            p.drawText(xnenu2+35,290,"x1 = " + QString::number(xnenu2));
131
+            p.drawText(xnenu3+35,290,"x2 = " + QString::number(xnenu3));
132
+            p.drawPixmap(xnenu,250,125,60,QPixmap(leaf));
133
+        }
134
+        else
135
+            p.drawText(xnenu2+35,290,"x2 = " + QString::number(xnenu2));
154 136
 
155 137
     }
156 138
 
157
-//    Cambiada la condicion para que sea exacta la caida en el nenufar
139
+    //    Cambiada la condicion para que sea exacta la caida en el nenufar
158 140
     if(Xsapo > (xnenu + 55) && Ysapo == 190 && Xsapo < (xnenu2-55)
159
-        || (Xsapo > (xnenu2 + 55) && Ysapo == 190 && Xsapo < (xnenu3-55))
160
-        || (Xsapo > (xnenu3 + 55) && Ysapo == 190)){
141
+            || (Xsapo > (xnenu2 + 55) && Ysapo == 190 && Xsapo < (xnenu3-55))
142
+            || (Xsapo > (xnenu3 + 55) && Ysapo == 190)){
161 143
 
162
-//    if(Ysapo == 190 && (Xsapo != xnenu && Xsapo != xnenu2 && Xsapo != xnenu3)){
144
+        //    if(Ysapo == 190 && (Xsapo != xnenu && Xsapo != xnenu2 && Xsapo != xnenu3)){
163 145
         p.drawPixmap(Xsapo, Ysapo + 30, 100, 80, QPixmap(frogger3));
164 146
     }
165 147
     else if(Ysapo < 190){
@@ -167,7 +149,7 @@ void frog::paintEvent(QPaintEvent *event){
167 149
     }else if(Ysapo == 190){
168 150
         qDebug() << "xsapo: " << Xsapo << "xnenu2: " << xnenu2;
169 151
         p.drawPixmap(Xsapo,Ysapo,100,100,QPixmap(frogger));
170
-        if(!textBool){
152
+        if(!showText){
171 153
             p.drawText(xnenu+45,290,"x1 = " + QString::number(xnenu+10));
172 154
         }
173 155
     }
@@ -179,45 +161,44 @@ frog::~frog(){
179 161
 }
180 162
 
181 163
 
182
-void frog::mySlot(){
164
+void frog::animate(){
183 165
     float interX1 = 0;
184 166
     float interX2 = 0;
185
-    float temp = 0;
186 167
     float y = 0;
187 168
     float xtemp = 0;
188 169
     float xEnd = 0;
189 170
 
190 171
 
172
+    // use the functions implemented by the programmer to
173
+    // compute the x-intercept.
191 174
 
192 175
     interX1 = QuadraticMinus(A,B,C);
193 176
     interX2 = QuadraticPlus(A,B,C);
194 177
 
195
-    if(interX1 > interX2){
196
-        temp = interX1;
197
-        interX1 = interX2;
198
-        interX2 = temp;
199
-    }
200
-    if(moved){
178
+    if (interX1 > interX2) std::swap(interX1, interX2);
179
+
180
+
181
+    if (moved) {
201 182
         moved = false;
202
-        buttonCounter = 1;
203 183
         initialX = Xsapo;
204 184
     }
205 185
 
206 186
     xEnd = interX2 + initialX;
207
-        y = 1;
208
-        xtemp = 1;
209
-        if(!xFlag){
210
-            Ysapo = Ysapo - y;
211
-            Xsapo = Xsapo + xtemp;
212
-        }
213
-        else if(xFlag){
214
-            Ysapo = Ysapo + y;
215
-            Xsapo = Xsapo + xtemp;
216
-        }
187
+    y = 1;
188
+    xtemp = 1;
217 189
 
218
-        if(int(Xsapo) == int(xEnd/2)){
219
-            xFlag = true;
220
-        }
190
+    if(!xFlag){
191
+        Ysapo = Ysapo - y;
192
+        Xsapo = Xsapo + xtemp;
193
+    }
194
+    else if(xFlag){
195
+        Ysapo = Ysapo + y;
196
+        Xsapo = Xsapo + xtemp;
197
+    }
198
+
199
+    if(int(Xsapo) == int(xEnd/2)){
200
+        xFlag = true;
201
+    }
221 202
 
222 203
     repaint();
223 204
     if((int(Xsapo) == int(xEnd) && xFlag == true) || Ysapo == 190){
@@ -227,7 +208,7 @@ void frog::mySlot(){
227 208
         myTimer->stop();
228 209
         delete myTimer;
229 210
         myTimer = new QTimer;
230
-        connect(myTimer, SIGNAL(timeout()), this, SLOT(mySlot()));
211
+        connect(myTimer, SIGNAL(timeout()), this, SLOT(animate()));
231 212
 
232 213
         initialX = Xsapo;
233 214
         xFlag = false;
@@ -240,7 +221,7 @@ void frog::run(int aa, int bb, int cc){
240 221
     A = aa;
241 222
     B = bb;
242 223
     C = cc;
243
-    buttonCounter++;
224
+//    buttonCounter++;
244 225
 
245 226
     connect(myTimer, SIGNAL(timeout()), this, SLOT(mySlot()));
246 227
     myTimer->start(25);

+ 9
- 4
frog.h Целия файл

@@ -14,11 +14,16 @@ class frog : public QWidget
14 14
 public:
15 15
     explicit frog(QWidget *parent = 0);
16 16
     float Ysapo, Xsapo, initialX;
17
-    bool flag, xFlag, backFlag, moved, textBool;
18
-    int A, B, C, buttonCounter,temp,temp2,xnenu,xnenu2,xnenu3;
17
+    bool flag, xFlag, backFlag, moved, showText;
18
+
19
+    // coefficients from the quadratic formula
20
+    int A, B, C;
21
+
22
+    int temp,temp2,xnenu,xnenu2,xnenu3;
19 23
 
20 24
     double QuadraticPlus(int a, int b, int c);
21 25
     double QuadraticMinus(int a, int b, int c);
26
+    void computeNenuPositions();
22 27
     ~frog();
23 28
 
24 29
 private:
@@ -28,10 +33,10 @@ private:
28 33
 signals:
29 34
 
30 35
 public slots:
31
-    void mySlot();
36
+    void animate();
32 37
     void run(int, int, int);
33 38
     void reset();
34
-    void updatenenu();
39
+
35 40
 
36 41
 protected:
37 42
     void paintEvent(QPaintEvent *event);

+ 54
- 80
mainwindow.cpp Целия файл

@@ -14,7 +14,6 @@ MainWindow::MainWindow(QWidget *parent) :
14 14
 {
15 15
     quadraticFormulaCheck();
16 16
 
17
-
18 17
     ui->setupUi(this);
19 18
     scene= new QGraphicsScene(this);
20 19
     scene->setSceneRect(QRectF(QPointF(0,0), QPointF(0,0)));
@@ -32,15 +31,12 @@ MainWindow::MainWindow(QWidget *parent) :
32 31
     ui->RunPushButton->move(10,385);
33 32
     ui->retryButton->move(180,385);
34 33
 
35
-
36
-
37 34
     frogger = new frog;
38 35
 
39 36
     globalTimer = new QTimer;
40 37
     scene->addWidget(frogger);
41 38
 
42 39
     ui->RunPushButton->setEnabled(false);
43
-
44 40
 }
45 41
 
46 42
 
@@ -50,26 +46,35 @@ MainWindow::~MainWindow()
50 46
     delete scene;
51 47
 }
52 48
 
49
+// This function validates if the results from the QuadraticPlus and QuadraticMinus
50
+// functions are correct. If they are not, then the program exits.
53 51
 
54 52
 void MainWindow::quadraticFormulaCheck()
55 53
 {
56
-    // float firstX;
57 54
     double resultFromFunction;
58 55
     bool pass = true;
56
+
57
+
58
+    // The values and valuesForMinus arrays contain precomputed a, b, c, and y values
59
+    // for the quadratic equations. They are used for testing if the functions written by
60
+    // the student are correct.
61
+    // For example: if a = 357, b = -1000, c = 698, then y = 1.4804781099
62
+
59 63
     double values[] = {357 , -1000 , 698 , 1.4804781099 , 748 , -392 , 51 , 0.28391805554 ,
60
-        689 , -689 , 172 , 0.519048482944 , 90 , 521 , 751 , -2.71178575308 , 5 , 107 ,
61
-        465 , -6.0642692054 , 1609 , -983 , 150 , 0.314734649792 , 273 , 496 , 224 ,
62
-        -0.839700867988 , 2 , 91 , 920 , -15.1630045473 , 48 , 300 , 463 , -2.77889067238 ,
63
-        852 , 907 , 241 , -0.510947439149};
64
+                       689 , -689 , 172 , 0.519048482944 , 90 , 521 , 751 , -2.71178575308 , 5 , 107 ,
65
+                       465 , -6.0642692054 , 1609 , -983 , 150 , 0.314734649792 , 273 , 496 , 224 ,
66
+                       -0.839700867988 , 2 , 91 , 920 , -15.1630045473 , 48 , 300 , 463 , -2.77889067238 ,
67
+                       852 , 907 , 241 , -0.510947439149};
64 68
 
65 69
     double valuesForMinus[] = {129 , -486 , 456 , 1.76744186047 , 384 , 980 , 625 , -1.30208333333 ,
66
-        270 , -904 , 755 , 1.59515823795 , 67 , -450 , 752 , 3.12650485528 , 98 , 506 , 651 ,
67
-        -2.72985550047 , 38 , -373 , 901 , 4.29396930804 , 273 , -282 , 72 , 0.461538461538 ,
68
-        225 , -889 , 874 , 1.84 , 8 , 136 , 522 , -11.1457513111 , 5 , 77 , 214 , -11.760788100};
70
+                               270 , -904 , 755 , 1.59515823795 , 67 , -450 , 752 , 3.12650485528 , 98 , 506 , 651 ,
71
+                               -2.72985550047 , 38 , -373 , 901 , 4.29396930804 , 273 , -282 , 72 , 0.461538461538 ,
72
+                               225 , -889 , 874 , 1.84 , 8 , 136 , 522 , -11.1457513111 , 5 , 77 , 214 , -11.760788100};
69 73
 
70 74
     double a, b, c, expected;
71 75
 
72
-    //Verifying if the equation written by the student is correct
76
+    // Validate the QuadraticPlus function....
77
+
73 78
     for (int i = 0; i < 40 && pass; i+=4){
74 79
         a        = values[i];
75 80
         b        = values[i+1];
@@ -77,17 +82,16 @@ void MainWindow::quadraticFormulaCheck()
77 82
         expected = values[i+3];
78 83
 
79 84
         resultFromFunction = frogger->QuadraticPlus(a,b,c);
80
-
81
-        if( fabs(resultFromFunction - expected) > 0.00001) {
82
-            pass = false;
83
-        }
85
+        pass = ( fabs(resultFromFunction - expected) < 0.00001) ;
84 86
     }
87
+
85 88
     if(!pass){
86 89
         QMessageBox::information(this, "Error", "La funcion cuadratica esta mal escrita!");
87 90
         exit(1);
88 91
     }
89 92
 
90
-    //Verifying if the equation written by the student is correct
93
+    // Validate the QuadraticMinus function....
94
+
91 95
     for (int i = 0; i < 40 && pass; i+=4){
92 96
         a        = valuesForMinus[i];
93 97
         b        = valuesForMinus[i+1];
@@ -95,97 +99,67 @@ void MainWindow::quadraticFormulaCheck()
95 99
         expected = valuesForMinus[i+3];
96 100
 
97 101
         resultFromFunction = frogger->QuadraticMinus(a,b,c);
98
-
99
-        if( fabs(resultFromFunction - expected) > 0.00001) {
100
-            pass = false;
101
-        }
102
+        pass =  ( fabs(resultFromFunction - expected) < 0.00001 );
102 103
     }
104
+
103 105
     if(!pass){
104 106
         QMessageBox::information(this, "Error", "La funcion cuadratica esta mal escrita!");
105 107
         exit(1);
106 108
     }
107 109
 }
108 110
 
109
-void MainWindow::on_RunPushButton_clicked()
110
-{
111
-    int a = 0;
112
-    int b = 0;
113
-    int c = 0;
114
-    int det = 0;
111
+void MainWindow::clearTheTextBoxes() {
112
+    ui->alineEdit->clear();
113
+    ui->blineEdit->clear();
114
+    ui->clineEdit->clear();
115
+}
116
+
117
+bool MainWindow::aTextBoxIsEmpty() {
118
+    return (ui->alineEdit->text().length() == 0 ||
119
+            ui->blineEdit->text().length() == 0 ||
120
+            ui->clineEdit->text().length() == 0);
121
+}
122
+
123
+
124
+void MainWindow::on_RunPushButton_clicked() {
125
+    int a = 0, b = 0, c = 0;
126
+    int det;
127
+
115 128
     a = (ui->alineEdit->text().toInt());
116 129
     b = (ui->blineEdit->text().toInt());
117 130
     c = (ui->clineEdit->text().toInt());
118 131
 
119 132
     det = (pow(b,2) - (4*a*c));
120 133
 
121
-    if(a > 0){
134
+    if(a > 0)
122 135
         QMessageBox::information(this, "Error", "La parabola abre hacia arriba y por lo tanto el sapo no brincara");
123
-        ui->alineEdit->clear();
124
-        ui->blineEdit->clear();
125
-        ui->clineEdit->clear();
126
-    }
127
-    else if(a == 0){
136
+    else if(a == 0)
128 137
         QMessageBox::information(this, "Error", "No hay parabola y por lo tanto el sapo no brincara");
129
-        ui->alineEdit->clear();
130
-        ui->blineEdit->clear();
131
-        ui->clineEdit->clear();
132
-    }
133
-    else{
134
-        if(det < 0){
138
+    else {
139
+        if(det < 0)
135 140
             QMessageBox::information(this, "Error", "No tiene intercepto y por lo tanto el sapo no brincara");
136
-            ui->alineEdit->clear();
137
-            ui->blineEdit->clear();
138
-            ui->clineEdit->clear();
139
-        }
140
-        else if(det == 0){
141
+        else if(det == 0)
141 142
             QMessageBox::information(this, "Error", "El vertice esta en el intercepto y por lo tanto el sapo no brincara");
142
-            ui->alineEdit->clear();
143
-            ui->blineEdit->clear();
144
-            ui->clineEdit->clear();
145
-        }
146 143
         else{
147 144
             frogger->run(a, b, c);
148 145
             ui->RunPushButton->setEnabled(false);
149
-            ui->alineEdit->clear();
150
-            ui->blineEdit->clear();
151
-            ui->clineEdit->clear();
152 146
         }
153 147
     }
154
-
155
-
148
+    clearTheTextBoxes();
156 149
 }
157 150
 
158
-void MainWindow::on_retryButton_clicked()
159
-{
151
+void MainWindow::on_retryButton_clicked() {
160 152
     frogger->reset();
161 153
 }
162 154
 
163
-void MainWindow::on_alineEdit_textChanged(const QString &)
164
-{
165
-    if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
166
-        ui->RunPushButton->setEnabled(true);
167
-    }
168
-    else{
169
-        ui->RunPushButton->setEnabled(false);
170
-    }
155
+void MainWindow::on_alineEdit_textChanged(const QString &) {
156
+    ui->RunPushButton->setEnabled(!aTextBoxIsEmpty());
171 157
 }
172 158
 
173
-void MainWindow::on_blineEdit_textChanged(const QString &)
174
-{
175
-    if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
176
-        ui->RunPushButton->setEnabled(true);
177
-    }
178
-    else{
179
-        ui->RunPushButton->setEnabled(false);
180
-    }
159
+void MainWindow::on_blineEdit_textChanged(const QString &) {
160
+    ui->RunPushButton->setEnabled(!aTextBoxIsEmpty());
181 161
 }
182 162
 
183
-void MainWindow::on_clineEdit_textChanged(const QString &)
184
-{
185
-    if(ui->alineEdit->text() != "" && ui->blineEdit->text() != "" && ui->clineEdit->text() != "" ){
186
-        ui->RunPushButton->setEnabled(true);
187
-    }
188
-    else{
189
-        ui->RunPushButton->setEnabled(false);
190
-    }
163
+void MainWindow::on_clineEdit_textChanged(const QString &) {
164
+    ui->RunPushButton->setEnabled(!aTextBoxIsEmpty());
191 165
 }

+ 4
- 0
mainwindow.h Целия файл

@@ -30,6 +30,10 @@ private slots:
30 30
 
31 31
     void on_clineEdit_textChanged(const QString &arg1);
32 32
 
33
+    void clearTheTextBoxes();
34
+
35
+    bool aTextBoxIsEmpty();
36
+
33 37
 private:
34 38
     Ui::MainWindow *ui;
35 39
     QGraphicsScene*scene;