From e49b346e63922ee233ac48a86a76734b8b835ea0 Mon Sep 17 00:00:00 2001 From: Qiaoyong Zhong Date: Sat, 19 Apr 2014 14:59:55 +0800 Subject: [PATCH] added application icon and menubar --- 2048-qt.pro | 4 ++++ 2048.ico | Bin 0 -> 4286 bytes qml/2048.js | 4 ---- qml/main.qml | 22 ++++++++++++++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 2048.ico 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 0000000000000000000000000000000000000000..22109e04a9f44bde18ec7b7a4b7410d0246521bc GIT binary patch literal 4286 zcmeI0u}T9$5QaxAZ4|*eSlRmm7M9V@SMU{VQ>5?}d;{?n1WA#?B1H-d3kAW#!e}&! z290>`cj4E~-Q@zpx`i3p?A^})&p$J}fvjc=?ypiYKJ9qfY|YFz+;B^_ zFn$f<2q!J!u7@9~i@DVw36{n#zAi#L=w1qYr#f#FwA?@S$6_fB4AP=j)up z&-xU9K1cfvmODrDz4%vq5%c#q+Oh8+)rjYPd=HIz|I|hJ=PnrXPDE_>yDHg+*KulwNh1` literal 0 HcmV?d00001 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",