Date:2011-01-14 14:30:00 (13 years 2 months ago)
Author:kyak
Commit:bd53759d021da31acec7f6080450085c1fae98f4
Message:Tile: the 15 Puzzle game written in Qt4

This was my first real try for Qt (and C++, too).
Don't beat me hard :)
Files: Tile/Makefile (1 diff)
Tile/src/Tile.pro (1 diff)
Tile/src/main.cpp (1 diff)
Tile/src/tile.cpp (1 diff)
Tile/src/tile.h (1 diff)
Tile/src/tile.ui (1 diff)

Change Details

Tile/Makefile
1#
2# This is free software, licensed under the GNU General Public License v2.
3# See /LICENSE for more information.
4#
5
6include $(TOPDIR)/rules.mk
7
8PKG_NAME:=Tile
9PKG_VERSION:=20110114
10PKG_RELEASE:=1
11
12include $(INCLUDE_DIR)/package.mk
13PKG_UNPACK:=$(CP) ./src/{tile.*,main.cpp,Tile.pro} $(PKG_BUILD_DIR)
14
15$(call include_mk,qmake.mk)
16
17define Package/Tile
18    SECTION:=games
19    CATEGORY:=Games
20    TITLE:=15 Puzzle game, written in Qt
21    DEPENDS:=+qt4 +qt4-gui +dejavu-fonts-ttf
22endef
23
24define Build/Prepare
25    $(call Build/Prepare/Default)
26    (\
27cd $(PKG_BUILD_DIR); \
28echo "QMAKE_LIBS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib" >> Tile.pro; \
29echo "INCLUDEPATH += $(STAGING_DIR)/usr/include/QtGui" >> Tile.pro; \
30echo "INCLUDEPATH += $(STAGING_DIR)/usr/include/QtCore" >> Tile.pro; \
31)
32endef
33
34define Build/Configure
35    $(call Build/Configure/Qmake,Tile)
36endef
37
38define Package/Tile/install
39    $(INSTALL_DIR) $(1)/usr/bin
40    $(INSTALL_BIN) $(PKG_BUILD_DIR)/Tile $(1)/usr/bin/
41endef
42
43$(eval $(call BuildPackage,Tile))
Tile/src/Tile.pro
1# -------------------------------------------------
2# Project created by QtCreator 2011-01-13T20:55:49
3# -------------------------------------------------
4TARGET = Tile
5TEMPLATE = app
6SOURCES += main.cpp \
7    tile.cpp
8HEADERS += tile.h
9FORMS += tile.ui
Tile/src/main.cpp
1#include <QtGui/QApplication>
2#include "tile.h"
3
4
5#if defined(Q_WS_QWS)
6#include <QtGui/QWSServer>
7#endif
8
9int main(int argc, char *argv[])
10{
11    QApplication a(argc, argv);
12    Tile w;
13    #if defined(Q_WS_QWS)
14        QWSServer::setCursorVisible(false);
15    #endif
16    w.show();
17    return a.exec();
18}
Tile/src/tile.cpp
1#include "tile.h"
2#include "ui_tile.h"
3
4Tile::Tile(QWidget *parent) :
5    QMainWindow(parent),
6    ui(new Ui::Tile)
7{
8    ui->setupUi(this);
9    ui->pushButton_16->hide();
10    ui->pushButton->setProperty("id","1");
11    ui->pushButton_2->setProperty("id","2");
12    ui->pushButton_3->setProperty("id","3");
13    ui->pushButton_4->setProperty("id","4");
14    ui->pushButton_5->setProperty("id","5");
15    ui->pushButton_6->setProperty("id","6");
16    ui->pushButton_7->setProperty("id","7");
17    ui->pushButton_8->setProperty("id","8");
18    ui->pushButton_9->setProperty("id","9");
19    ui->pushButton_10->setProperty("id","10");
20    ui->pushButton_11->setProperty("id","11");
21    ui->pushButton_12->setProperty("id","12");
22    ui->pushButton_13->setProperty("id","13");
23    ui->pushButton_14->setProperty("id","14");
24    ui->pushButton_15->setProperty("id","15");
25    ui->pushButton_16->setProperty("id","16");
26    /*ui->pushButton_Reset->setProperty("id","Reset");
27    ui->pushButton_Shuffle->setProperty("id","Shuffle");
28    ui->pushButton_Help->setProperty("id","Help");
29    ui->pushButton_Quit->setProperty("id","Quit");*/
30    /*
31    ui->pushButton->setAccessibleDescription("1");
32    ui->pushButton_2->setAccessibleDescription("2");
33    ui->pushButton_3->setAccessibleDescription("3");
34    ui->pushButton_4->setAccessibleDescription("4");
35    ui->pushButton_5->setAccessibleDescription("5");
36    ui->pushButton_6->setAccessibleDescription("6");
37    ui->pushButton_7->setAccessibleDescription("7");
38    ui->pushButton_8->setAccessibleDescription("8");
39    ui->pushButton_9->setAccessibleDescription("9");
40    ui->pushButton_10->setAccessibleDescription("10");
41    ui->pushButton_11->setAccessibleDescription("11");
42    ui->pushButton_12->setAccessibleDescription("12");
43    ui->pushButton_13->setAccessibleDescription("13");
44    ui->pushButton_14->setAccessibleDescription("14");
45    ui->pushButton_15->setAccessibleDescription("15");
46    ui->pushButton_16->setAccessibleDescription("16");
47    */
48    // Create seed for the random
49    // That is needed only once on application startup
50    QTime time = QTime::currentTime();
51    qsrand((uint)time.msec());
52
53    qApp->installEventFilter(this);
54    //ui->pushButton->installEventFilter(this);
55}
56
57Tile::~Tile()
58{
59    delete ui;
60}
61
62void Tile::changeEvent(QEvent *e)
63{
64    QMainWindow::changeEvent(e);
65    switch (e->type()) {
66    case QEvent::LanguageChange:
67        ui->retranslateUi(this);
68        break;
69    default:
70        break;
71    }
72}
73
74void Tile::checkNeighbours()
75{
76    QPushButton *button = qobject_cast< QPushButton* >(QObject::sender());
77    //int id = button->accessibleDescription().toInt();
78    int id = button->property("id").toInt();
79    //check button to the right
80    if (id != 16 && id != 12 && id != 8 && id != 4) {
81        QPushButton *button_neighbour = idtoButton(id+1);
82        if (button_neighbour->text() == "16" && button_neighbour->isHidden()) {
83            swapButtons(button, button_neighbour);
84            return;
85        }
86    }
87    //check button to the left
88    if (id != 13 && id != 9 && id != 5 && id != 1) {
89        QPushButton *button_neighbour = idtoButton(id-1);
90        if (button_neighbour->text() == "16" && button_neighbour->isHidden()) {
91            swapButtons(button, button_neighbour);
92            return;
93        }
94    }
95    //check button to the bottom
96    if (id != 16 && id != 15 && id != 14 && id != 13) {
97        QPushButton *button_neighbour = idtoButton(id+4);
98        if (button_neighbour->text() == "16" && button_neighbour->isHidden()) {
99            swapButtons(button, button_neighbour);
100            return;
101        }
102    }
103    //check button to the up
104    if (id != 4 && id != 3 && id != 2 && id != 1) {
105        QPushButton *button_neighbour = idtoButton(id-4);
106        if (button_neighbour->text() == "16" && button_neighbour->isHidden()) {
107            swapButtons(button, button_neighbour);
108            return;
109        }
110    }
111    //qDebug() << "No swap candidates...";
112    return;
113}
114
115QPushButton* Tile::idtoButton(int id)
116{
117    switch (id) {
118    case 1:
119        return ui->pushButton;
120    case 2:
121        return ui->pushButton_2;
122    case 3:
123        return ui->pushButton_3;
124    case 4:
125        return ui->pushButton_4;
126    case 5:
127        return ui->pushButton_5;
128    case 6:
129        return ui->pushButton_6;
130    case 7:
131        return ui->pushButton_7;
132    case 8:
133        return ui->pushButton_8;
134    case 9:
135        return ui->pushButton_9;
136    case 10:
137        return ui->pushButton_10;
138    case 11:
139        return ui->pushButton_11;
140    case 12:
141        return ui->pushButton_12;
142    case 13:
143        return ui->pushButton_13;
144    case 14:
145        return ui->pushButton_14;
146    case 15:
147        return ui->pushButton_15;
148    case 16:
149        return ui->pushButton_16;
150    default:
151        break;
152    }
153    return NULL;
154}
155
156void Tile::swapButtons(QPushButton *button, QPushButton *button_neighbour) {
157    button->hide();
158    button_neighbour->setText(button->text());
159    button->setText("16");
160    button_neighbour->show();
161    button_neighbour->setFocus();
162}
163
164void Tile::Reset()
165{
166    for (int i = 1; i < 16; i++) {
167        QPushButton *button = idtoButton(i);
168        QString str;
169        button->show();
170        button->setText(str.setNum(i));
171    }
172    QPushButton *button = idtoButton(16);
173    button->hide();
174    button->setText("16");
175}
176
177void Tile::Quit()
178{
179    switch (QMessageBox::information(this,
180                             "Confirm Quit",
181                             "Are you sure to quit?",
182                             "&Quit","&Cancel"))
183    {
184    case 0:
185        qApp->quit();
186    default:
187        break;
188    }
189}
190
191void Tile::Shuffle()
192{
193    Reset();
194    for (int i = 1; i < 16; i++) {
195        //get random number 1..15
196        int id = randInt(1,15);
197        //swap it
198        QPushButton *button_1 = idtoButton(i);
199        QPushButton *button_2 = idtoButton(id);
200        QString str = button_1->text();
201        button_1->setText(button_2->text());
202        button_2->setText(str);
203    }
204    if (!isSolvable()) {
205        Shuffle();
206    }
207}
208
209int Tile::randInt(int low, int high)
210{
211    // Random number between low and high
212    return qrand() % ((high + 1) - low) + low;
213}
214
215bool Tile::isSolvable()
216{
217    //http://mathworld.wolfram.com/15Puzzle.html
218    //accumulator
219    int acc = 0;
220    //iterate through all tiles
221    for (int i = 1; i < 17; i++) {
222        //get button from id
223        QPushButton *button = idtoButton(i);
224        //get the number on tile
225        int num = button->text().toInt();
226        if (num == 16) {
227            //get row of empty tile
228            if (i < 5) {
229                acc = acc + 1;
230            } else if (i < 9) {
231                acc = acc + 2;
232            } else if (i < 13) {
233                acc = acc + 3;
234            } else {
235                acc = acc + 4;
236            }
237            continue;
238        }
239        //iterate though the rest of tiles
240        for (int j = i+1; j < 17; j++) {
241            //get next button
242            QPushButton *button_next = idtoButton(j);
243            //get the number of next tile
244            int num_next = button_next->text().toInt();
245            //compare and increment accumulator
246            if (num_next < num) {
247                acc++;
248            }
249        }
250    }
251    //qDebug() << acc;
252    if (acc%2 == 0) {
253        return 1;
254    } else {
255        return 0;
256    }
257}
258
259void Tile::Help()
260{
261    QMessageBox::about(this,
262            "15 Puzzle",
263            "\
264This is the famous 15 Puzzle game.\n\
265The object of the puzzle is to place the\n\
266tiles in order by making sliding moves\n\
267that use the empty space.\n\
268\n\
269\"Reset\" (Alt+R): reset the puzzle to solved position\n\
270\"Shuffle\" (Alt+S): shuffle the puzzle. Note that this\n\
271always produces solvable positions, don\'t give up\n\
272\"Help\" (Alt+H): show this help\n\
273\"Quit\" (Alt+Q): quit the app");
274}
275
276void Tile::keyPressEvent(QKeyEvent *event)
277{
278   if (event->key() == Qt::Key_Escape || event->key() == Qt::Key_Q) {
279       Quit();
280   } else if (event->key() == Qt::Key_Up) {
281       //focusNextChild();
282       //qDebug() << qApp->focusWidget();
283       QPushButton *button = qobject_cast< QPushButton* >(qApp->focusWidget());
284       keyUp(button);
285   } else if (event->key() == Qt::Key_Down) {
286       //focusPreviousChild();
287       //qDebug() << qApp->focusWidget();
288       QPushButton *button = qobject_cast< QPushButton* >(qApp->focusWidget());
289       keyDown(button);
290   } else {
291       return;
292   }
293}
294
295bool Tile::eventFilter(QObject *obj, QEvent *event)
296{
297    QKeyEvent *keyEvent = NULL;//event data, if this is a keystroke event
298    bool result = false;//return true to consume the keystroke
299
300    if (event->type() == QEvent::KeyPress)
301    {
302         keyEvent = dynamic_cast<QKeyEvent*>(event);
303         //override Key Up and Key Down only
304         if (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down) {
305            this->keyPressEvent(keyEvent);
306            result = true;
307        } else {
308            result = QObject::eventFilter(obj, event);
309        }
310    }//if type()
311
312    /*else if (event->type() == QEvent::KeyRelease)
313    {
314        keyEvent = dynamic_cast<QKeyEvent*>(event);
315        this->keyReleaseEvent(keyEvent);
316        result = true;
317    }*///else if type()
318
319    //### Standard event processing ###
320    else
321        result = QObject::eventFilter(obj, event);
322
323    return result;
324}//eventFilter
325
326void Tile::keyUp(QPushButton *button) {
327       int id = button->property("id").toInt();
328       QPushButton *button_up;
329       if (id < 5) {
330           button_up = idtoButton(id+12);
331       } else {
332           button_up = idtoButton(id-4);
333       }
334       if (button_up->isHidden()) {
335           keyUp(button_up);
336       } else {
337           button_up->setFocus();
338       }
339}
340
341void Tile::keyDown(QPushButton *button) {
342       int id = button->property("id").toInt();
343       QPushButton *button_down;
344       if (id > 12) {
345           button_down = idtoButton(id-12);
346       } else {
347           button_down = idtoButton(id+4);
348       }
349       if (button_down->isHidden()) {
350           keyDown(button_down);
351       } else {
352           button_down->setFocus();
353       }
354}
Tile/src/tile.h
1#ifndef TILE_H
2#define TILE_H
3
4#include <QMainWindow>
5#include <QDebug>
6#include <QPushButton>
7#include <QTime>
8#include <QMessageBox>
9#include <QKeyEvent>
10
11namespace Ui {
12    class Tile;
13}
14
15class Tile : public QMainWindow {
16    Q_OBJECT
17public:
18    Tile(QWidget *parent = 0);
19    ~Tile();
20
21public slots:
22    void checkNeighbours();
23    QPushButton* idtoButton(int id);
24    void swapButtons(QPushButton *button, QPushButton *button_neighbour);
25    void Reset();
26    void Quit();
27    void Shuffle();
28    int randInt(int low, int high);
29    bool isSolvable();
30    void Help();
31    void keyPressEvent(QKeyEvent *event);
32    bool eventFilter(QObject *obj, QEvent *event);
33    void keyUp(QPushButton *button);
34    void keyDown(QPushButton *button);
35
36protected:
37    void changeEvent(QEvent *e);
38
39private:
40    Ui::Tile *ui;
41};
42
43#endif // TILE_H
Tile/src/tile.ui
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>Tile</class>
4 <widget class="QMainWindow" name="Tile">
5  <property name="geometry">
6   <rect>
7    <x>0</x>
8    <y>0</y>
9    <width>320</width>
10    <height>240</height>
11   </rect>
12  </property>
13  <property name="windowTitle">
14   <string>Tile</string>
15  </property>
16  <property name="toolTip">
17   <string notr="true"/>
18  </property>
19  <widget class="QWidget" name="centralWidget">
20   <widget class="QPushButton" name="pushButton">
21    <property name="geometry">
22     <rect>
23      <x>0</x>
24      <y>0</y>
25      <width>60</width>
26      <height>60</height>
27     </rect>
28    </property>
29    <property name="maximumSize">
30     <size>
31      <width>16777215</width>
32      <height>16777213</height>
33     </size>
34    </property>
35    <property name="font">
36     <font>
37      <family>DejaVu Sans</family>
38      <pointsize>28</pointsize>
39     </font>
40    </property>
41    <property name="text">
42     <string>1</string>
43    </property>
44    <property name="flat">
45     <bool>false</bool>
46    </property>
47   </widget>
48   <widget class="QPushButton" name="pushButton_2">
49    <property name="geometry">
50     <rect>
51      <x>60</x>
52      <y>0</y>
53      <width>60</width>
54      <height>60</height>
55     </rect>
56    </property>
57    <property name="font">
58     <font>
59      <family>DejaVu Sans</family>
60      <pointsize>28</pointsize>
61     </font>
62    </property>
63    <property name="text">
64     <string>2</string>
65    </property>
66   </widget>
67   <widget class="QPushButton" name="pushButton_3">
68    <property name="geometry">
69     <rect>
70      <x>120</x>
71      <y>0</y>
72      <width>60</width>
73      <height>60</height>
74     </rect>
75    </property>
76    <property name="font">
77     <font>
78      <family>DejaVu Sans</family>
79      <pointsize>28</pointsize>
80     </font>
81    </property>
82    <property name="text">
83     <string>3</string>
84    </property>
85   </widget>
86   <widget class="QPushButton" name="pushButton_4">
87    <property name="geometry">
88     <rect>
89      <x>180</x>
90      <y>0</y>
91      <width>60</width>
92      <height>60</height>
93     </rect>
94    </property>
95    <property name="font">
96     <font>
97      <family>DejaVu Sans</family>
98      <pointsize>28</pointsize>
99     </font>
100    </property>
101    <property name="text">
102     <string>4</string>
103    </property>
104   </widget>
105   <widget class="QPushButton" name="pushButton_5">
106    <property name="geometry">
107     <rect>
108      <x>0</x>
109      <y>60</y>
110      <width>60</width>
111      <height>60</height>
112     </rect>
113    </property>
114    <property name="font">
115     <font>
116      <family>DejaVu Sans</family>
117      <pointsize>28</pointsize>
118     </font>
119    </property>
120    <property name="text">
121     <string>5</string>
122    </property>
123   </widget>
124   <widget class="QPushButton" name="pushButton_6">
125    <property name="geometry">
126     <rect>
127      <x>60</x>
128      <y>60</y>
129      <width>60</width>
130      <height>60</height>
131     </rect>
132    </property>
133    <property name="font">
134     <font>
135      <family>DejaVu Sans</family>
136      <pointsize>28</pointsize>
137     </font>
138    </property>
139    <property name="text">
140     <string>6</string>
141    </property>
142   </widget>
143   <widget class="QPushButton" name="pushButton_7">
144    <property name="geometry">
145     <rect>
146      <x>120</x>
147      <y>60</y>
148      <width>60</width>
149      <height>60</height>
150     </rect>
151    </property>
152    <property name="font">
153     <font>
154      <family>DejaVu Sans</family>
155      <pointsize>28</pointsize>
156     </font>
157    </property>
158    <property name="text">
159     <string>7</string>
160    </property>
161   </widget>
162   <widget class="QPushButton" name="pushButton_8">
163    <property name="geometry">
164     <rect>
165      <x>180</x>
166      <y>60</y>
167      <width>60</width>
168      <height>60</height>
169     </rect>
170    </property>
171    <property name="font">
172     <font>
173      <family>DejaVu Sans</family>
174      <pointsize>28</pointsize>
175     </font>
176    </property>
177    <property name="text">
178     <string>8</string>
179    </property>
180   </widget>
181   <widget class="QPushButton" name="pushButton_9">
182    <property name="geometry">
183     <rect>
184      <x>0</x>
185      <y>120</y>
186      <width>60</width>
187      <height>60</height>
188     </rect>
189    </property>
190    <property name="font">
191     <font>
192      <family>DejaVu Sans</family>
193      <pointsize>28</pointsize>
194     </font>
195    </property>
196    <property name="text">
197     <string>9</string>
198    </property>
199   </widget>
200   <widget class="QPushButton" name="pushButton_10">
201    <property name="geometry">
202     <rect>
203      <x>60</x>
204      <y>120</y>
205      <width>60</width>
206      <height>60</height>
207     </rect>
208    </property>
209    <property name="font">
210     <font>
211      <family>DejaVu Sans</family>
212      <pointsize>28</pointsize>
213     </font>
214    </property>
215    <property name="text">
216     <string>10</string>
217    </property>
218   </widget>
219   <widget class="QPushButton" name="pushButton_11">
220    <property name="geometry">
221     <rect>
222      <x>120</x>
223      <y>120</y>
224      <width>60</width>
225      <height>60</height>
226     </rect>
227    </property>
228    <property name="font">
229     <font>
230      <family>DejaVu Sans</family>
231      <pointsize>28</pointsize>
232     </font>
233    </property>
234    <property name="text">
235     <string>11</string>
236    </property>
237   </widget>
238   <widget class="QPushButton" name="pushButton_12">
239    <property name="geometry">
240     <rect>
241      <x>180</x>
242      <y>120</y>
243      <width>60</width>
244      <height>60</height>
245     </rect>
246    </property>
247    <property name="font">
248     <font>
249      <family>DejaVu Sans</family>
250      <pointsize>28</pointsize>
251     </font>
252    </property>
253    <property name="text">
254     <string>12</string>
255    </property>
256   </widget>
257   <widget class="QPushButton" name="pushButton_13">
258    <property name="geometry">
259     <rect>
260      <x>0</x>
261      <y>180</y>
262      <width>60</width>
263      <height>60</height>
264     </rect>
265    </property>
266    <property name="font">
267     <font>
268      <family>DejaVu Sans</family>
269      <pointsize>28</pointsize>
270     </font>
271    </property>
272    <property name="text">
273     <string>13</string>
274    </property>
275   </widget>
276   <widget class="QPushButton" name="pushButton_14">
277    <property name="geometry">
278     <rect>
279      <x>60</x>
280      <y>180</y>
281      <width>60</width>
282      <height>60</height>
283     </rect>
284    </property>
285    <property name="font">
286     <font>
287      <family>DejaVu Sans</family>
288      <pointsize>28</pointsize>
289     </font>
290    </property>
291    <property name="text">
292     <string>14</string>
293    </property>
294   </widget>
295   <widget class="QPushButton" name="pushButton_15">
296    <property name="geometry">
297     <rect>
298      <x>120</x>
299      <y>180</y>
300      <width>60</width>
301      <height>60</height>
302     </rect>
303    </property>
304    <property name="font">
305     <font>
306      <family>DejaVu Sans</family>
307      <pointsize>28</pointsize>
308     </font>
309    </property>
310    <property name="text">
311     <string>15</string>
312    </property>
313   </widget>
314   <widget class="QPushButton" name="pushButton_16">
315    <property name="geometry">
316     <rect>
317      <x>180</x>
318      <y>180</y>
319      <width>60</width>
320      <height>60</height>
321     </rect>
322    </property>
323    <property name="font">
324     <font>
325      <family>DejaVu Sans</family>
326      <pointsize>28</pointsize>
327     </font>
328    </property>
329    <property name="text">
330     <string>16</string>
331    </property>
332   </widget>
333   <widget class="QPushButton" name="pushButton_Reset">
334    <property name="geometry">
335     <rect>
336      <x>255</x>
337      <y>20</y>
338      <width>60</width>
339      <height>20</height>
340     </rect>
341    </property>
342    <property name="focusPolicy">
343     <enum>Qt::NoFocus</enum>
344    </property>
345    <property name="text">
346     <string>&amp;Reset</string>
347    </property>
348   </widget>
349   <widget class="QPushButton" name="pushButton_Shuffle">
350    <property name="geometry">
351     <rect>
352      <x>255</x>
353      <y>80</y>
354      <width>60</width>
355      <height>20</height>
356     </rect>
357    </property>
358    <property name="focusPolicy">
359     <enum>Qt::NoFocus</enum>
360    </property>
361    <property name="text">
362     <string>&amp;Shuffle</string>
363    </property>
364   </widget>
365   <widget class="QPushButton" name="pushButton_Quit">
366    <property name="geometry">
367     <rect>
368      <x>255</x>
369      <y>200</y>
370      <width>60</width>
371      <height>20</height>
372     </rect>
373    </property>
374    <property name="focusPolicy">
375     <enum>Qt::NoFocus</enum>
376    </property>
377    <property name="text">
378     <string>&amp;Quit</string>
379    </property>
380   </widget>
381   <widget class="QPushButton" name="pushButton_Help">
382    <property name="geometry">
383     <rect>
384      <x>255</x>
385      <y>140</y>
386      <width>60</width>
387      <height>20</height>
388     </rect>
389    </property>
390    <property name="focusPolicy">
391     <enum>Qt::NoFocus</enum>
392    </property>
393    <property name="text">
394     <string>&amp;Help</string>
395    </property>
396   </widget>
397   <widget class="Line" name="line">
398    <property name="geometry">
399     <rect>
400      <x>240</x>
401      <y>0</y>
402      <width>20</width>
403      <height>240</height>
404     </rect>
405    </property>
406    <property name="orientation">
407     <enum>Qt::Vertical</enum>
408    </property>
409   </widget>
410  </widget>
411 </widget>
412 <layoutdefault spacing="6" margin="11"/>
413 <tabstops>
414  <tabstop>pushButton</tabstop>
415  <tabstop>pushButton_2</tabstop>
416  <tabstop>pushButton_3</tabstop>
417  <tabstop>pushButton_4</tabstop>
418  <tabstop>pushButton_Reset</tabstop>
419  <tabstop>pushButton_5</tabstop>
420  <tabstop>pushButton_6</tabstop>
421  <tabstop>pushButton_7</tabstop>
422  <tabstop>pushButton_8</tabstop>
423  <tabstop>pushButton_Shuffle</tabstop>
424  <tabstop>pushButton_9</tabstop>
425  <tabstop>pushButton_10</tabstop>
426  <tabstop>pushButton_11</tabstop>
427  <tabstop>pushButton_12</tabstop>
428  <tabstop>pushButton_Help</tabstop>
429  <tabstop>pushButton_13</tabstop>
430  <tabstop>pushButton_14</tabstop>
431  <tabstop>pushButton_15</tabstop>
432  <tabstop>pushButton_16</tabstop>
433  <tabstop>pushButton_Quit</tabstop>
434 </tabstops>
435 <resources/>
436 <connections>
437  <connection>
438   <sender>pushButton</sender>
439   <signal>clicked()</signal>
440   <receiver>Tile</receiver>
441   <slot>checkNeighbours()</slot>
442   <hints>
443    <hint type="sourcelabel">
444     <x>40</x>
445     <y>23</y>
446    </hint>
447    <hint type="destinationlabel">
448     <x>373</x>
449     <y>34</y>
450    </hint>
451   </hints>
452  </connection>
453  <connection>
454   <sender>pushButton_2</sender>
455   <signal>clicked()</signal>
456   <receiver>Tile</receiver>
457   <slot>checkNeighbours()</slot>
458   <hints>
459    <hint type="sourcelabel">
460     <x>109</x>
461     <y>20</y>
462    </hint>
463    <hint type="destinationlabel">
464     <x>343</x>
465     <y>47</y>
466    </hint>
467   </hints>
468  </connection>
469  <connection>
470   <sender>pushButton_3</sender>
471   <signal>clicked()</signal>
472   <receiver>Tile</receiver>
473   <slot>checkNeighbours()</slot>
474   <hints>
475    <hint type="sourcelabel">
476     <x>156</x>
477     <y>15</y>
478    </hint>
479    <hint type="destinationlabel">
480     <x>371</x>
481     <y>19</y>
482    </hint>
483   </hints>
484  </connection>
485  <connection>
486   <sender>pushButton_4</sender>
487   <signal>clicked()</signal>
488   <receiver>Tile</receiver>
489   <slot>checkNeighbours()</slot>
490   <hints>
491    <hint type="sourcelabel">
492     <x>236</x>
493     <y>21</y>
494    </hint>
495    <hint type="destinationlabel">
496     <x>357</x>
497     <y>29</y>
498    </hint>
499   </hints>
500  </connection>
501  <connection>
502   <sender>pushButton_5</sender>
503   <signal>clicked()</signal>
504   <receiver>Tile</receiver>
505   <slot>checkNeighbours()</slot>
506   <hints>
507    <hint type="sourcelabel">
508     <x>46</x>
509     <y>100</y>
510    </hint>
511    <hint type="destinationlabel">
512     <x>340</x>
513     <y>91</y>
514    </hint>
515   </hints>
516  </connection>
517  <connection>
518   <sender>pushButton_6</sender>
519   <signal>clicked()</signal>
520   <receiver>Tile</receiver>
521   <slot>checkNeighbours()</slot>
522   <hints>
523    <hint type="sourcelabel">
524     <x>116</x>
525     <y>75</y>
526    </hint>
527    <hint type="destinationlabel">
528     <x>369</x>
529     <y>136</y>
530    </hint>
531   </hints>
532  </connection>
533  <connection>
534   <sender>pushButton_7</sender>
535   <signal>clicked()</signal>
536   <receiver>Tile</receiver>
537   <slot>checkNeighbours()</slot>
538   <hints>
539    <hint type="sourcelabel">
540     <x>165</x>
541     <y>71</y>
542    </hint>
543    <hint type="destinationlabel">
544     <x>356</x>
545     <y>81</y>
546    </hint>
547   </hints>
548  </connection>
549  <connection>
550   <sender>pushButton_8</sender>
551   <signal>clicked()</signal>
552   <receiver>Tile</receiver>
553   <slot>checkNeighbours()</slot>
554   <hints>
555    <hint type="sourcelabel">
556     <x>239</x>
557     <y>110</y>
558    </hint>
559    <hint type="destinationlabel">
560     <x>396</x>
561     <y>107</y>
562    </hint>
563   </hints>
564  </connection>
565  <connection>
566   <sender>pushButton_9</sender>
567   <signal>clicked()</signal>
568   <receiver>Tile</receiver>
569   <slot>checkNeighbours()</slot>
570   <hints>
571    <hint type="sourcelabel">
572     <x>38</x>
573     <y>158</y>
574    </hint>
575    <hint type="destinationlabel">
576     <x>355</x>
577     <y>149</y>
578    </hint>
579   </hints>
580  </connection>
581  <connection>
582   <sender>pushButton_10</sender>
583   <signal>clicked()</signal>
584   <receiver>Tile</receiver>
585   <slot>checkNeighbours()</slot>
586   <hints>
587    <hint type="sourcelabel">
588     <x>103</x>
589     <y>139</y>
590    </hint>
591    <hint type="destinationlabel">
592     <x>395</x>
593     <y>160</y>
594    </hint>
595   </hints>
596  </connection>
597  <connection>
598   <sender>pushButton_11</sender>
599   <signal>clicked()</signal>
600   <receiver>Tile</receiver>
601   <slot>checkNeighbours()</slot>
602   <hints>
603    <hint type="sourcelabel">
604     <x>179</x>
605     <y>168</y>
606    </hint>
607    <hint type="destinationlabel">
608     <x>376</x>
609     <y>180</y>
610    </hint>
611   </hints>
612  </connection>
613  <connection>
614   <sender>pushButton_12</sender>
615   <signal>clicked()</signal>
616   <receiver>Tile</receiver>
617   <slot>checkNeighbours()</slot>
618   <hints>
619    <hint type="sourcelabel">
620     <x>239</x>
621     <y>174</y>
622    </hint>
623    <hint type="destinationlabel">
624     <x>414</x>
625     <y>201</y>
626    </hint>
627   </hints>
628  </connection>
629  <connection>
630   <sender>pushButton_13</sender>
631   <signal>clicked()</signal>
632   <receiver>Tile</receiver>
633   <slot>checkNeighbours()</slot>
634   <hints>
635    <hint type="sourcelabel">
636     <x>48</x>
637     <y>211</y>
638    </hint>
639    <hint type="destinationlabel">
640     <x>344</x>
641     <y>218</y>
642    </hint>
643   </hints>
644  </connection>
645  <connection>
646   <sender>pushButton_14</sender>
647   <signal>clicked()</signal>
648   <receiver>Tile</receiver>
649   <slot>checkNeighbours()</slot>
650   <hints>
651    <hint type="sourcelabel">
652     <x>102</x>
653     <y>200</y>
654    </hint>
655    <hint type="destinationlabel">
656     <x>335</x>
657     <y>211</y>
658    </hint>
659   </hints>
660  </connection>
661  <connection>
662   <sender>pushButton_15</sender>
663   <signal>clicked()</signal>
664   <receiver>Tile</receiver>
665   <slot>checkNeighbours()</slot>
666   <hints>
667    <hint type="sourcelabel">
668     <x>161</x>
669     <y>194</y>
670    </hint>
671    <hint type="destinationlabel">
672     <x>360</x>
673     <y>188</y>
674    </hint>
675   </hints>
676  </connection>
677  <connection>
678   <sender>pushButton_16</sender>
679   <signal>clicked()</signal>
680   <receiver>Tile</receiver>
681   <slot>checkNeighbours()</slot>
682   <hints>
683    <hint type="sourcelabel">
684     <x>225</x>
685     <y>229</y>
686    </hint>
687    <hint type="destinationlabel">
688     <x>387</x>
689     <y>234</y>
690    </hint>
691   </hints>
692  </connection>
693  <connection>
694   <sender>pushButton_Reset</sender>
695   <signal>clicked()</signal>
696   <receiver>Tile</receiver>
697   <slot>Reset()</slot>
698   <hints>
699    <hint type="sourcelabel">
700     <x>284</x>
701     <y>31</y>
702    </hint>
703    <hint type="destinationlabel">
704     <x>288</x>
705     <y>59</y>
706    </hint>
707   </hints>
708  </connection>
709  <connection>
710   <sender>pushButton_Quit</sender>
711   <signal>clicked()</signal>
712   <receiver>Tile</receiver>
713   <slot>Quit()</slot>
714   <hints>
715    <hint type="sourcelabel">
716     <x>273</x>
717     <y>211</y>
718    </hint>
719    <hint type="destinationlabel">
720     <x>287</x>
721     <y>120</y>
722    </hint>
723   </hints>
724  </connection>
725  <connection>
726   <sender>pushButton_Shuffle</sender>
727   <signal>clicked()</signal>
728   <receiver>Tile</receiver>
729   <slot>Shuffle()</slot>
730   <hints>
731    <hint type="sourcelabel">
732     <x>278</x>
733     <y>90</y>
734    </hint>
735    <hint type="destinationlabel">
736     <x>267</x>
737     <y>121</y>
738    </hint>
739   </hints>
740  </connection>
741  <connection>
742   <sender>pushButton_Help</sender>
743   <signal>clicked()</signal>
744   <receiver>Tile</receiver>
745   <slot>Help()</slot>
746   <hints>
747    <hint type="sourcelabel">
748     <x>290</x>
749     <y>148</y>
750    </hint>
751    <hint type="destinationlabel">
752     <x>292</x>
753     <y>178</y>
754    </hint>
755   </hints>
756  </connection>
757 </connections>
758 <slots>
759  <slot>checkNeighbours()</slot>
760  <slot>Reset()</slot>
761  <slot>Quit()</slot>
762  <slot>Shuffle()</slot>
763  <slot>Help()</slot>
764 </slots>
765</ui>

Archive Download the corresponding diff file



interactive