diff --git a/2048-qt.pro b/2048-qt.pro index 1cdc565..2ba36fa 100644 --- a/2048-qt.pro +++ b/2048-qt.pro @@ -11,3 +11,7 @@ QML_IMPORT_PATH = # Default rules for deployment. include(deployment.pri) + +# Setting the application icon +RC_ICONS = 2048.ico # On Windows +ICON = 2048.ico # On Mac OSX diff --git a/2048.ico b/2048.ico new file mode 100644 index 0000000..22109e0 Binary files /dev/null and b/2048.ico differ diff --git a/qml/2048.js b/qml/2048.js index 11d519b..fca6c09 100644 --- a/qml/2048.js +++ b/qml/2048.js @@ -45,10 +45,6 @@ function startupFunction() { } function moveKey(event) { - if ((event.key == Qt.Key_Q) && (event.modifiers & Qt.ControlModifier)) { - Qt.quit(); - } - var isMoved = false; var i, j, v, v2; var oldScore = score; diff --git a/qml/main.qml b/qml/main.qml index b162236..57b2933 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -7,13 +7,31 @@ import "2048.js" as MyScript ApplicationWindow { visible: true - width: 560 - height: 730 + width: 550 + height: 740 title: qsTr("2048 Game"); + flags: Qt.Window | Qt.MSWindowsFixedSizeDialogHint x: (Screen.width - width) / 2 y: (Screen.height - height) / 2 + menuBar: MenuBar { + Menu { + title: qsTr("File") + MenuItem { + text: qsTr("New Game") + shortcut: "Ctrl+N" + onTriggered: MyScript.startupFunction(); + } + MenuItem { + text: qsTr("Exit") + shortcut: "Ctrl+Q" + onTriggered: Qt.quit(); + } + } + } + + Item { id: helper property var myColors: {"bglight": "#FAF8EF",