added application icon and menubar

master
Qiaoyong Zhong 11 years ago
parent 4495dc56ff
commit e49b346e63

@ -11,3 +11,7 @@ QML_IMPORT_PATH =
# Default rules for deployment. # Default rules for deployment.
include(deployment.pri) include(deployment.pri)
# Setting the application icon
RC_ICONS = 2048.ico # On Windows
ICON = 2048.ico # On Mac OSX

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -45,10 +45,6 @@ function startupFunction() {
} }
function moveKey(event) { function moveKey(event) {
if ((event.key == Qt.Key_Q) && (event.modifiers & Qt.ControlModifier)) {
Qt.quit();
}
var isMoved = false; var isMoved = false;
var i, j, v, v2; var i, j, v, v2;
var oldScore = score; var oldScore = score;

@ -7,13 +7,31 @@ import "2048.js" as MyScript
ApplicationWindow { ApplicationWindow {
visible: true visible: true
width: 560 width: 550
height: 730 height: 740
title: qsTr("2048 Game"); title: qsTr("2048 Game");
flags: Qt.Window | Qt.MSWindowsFixedSizeDialogHint
x: (Screen.width - width) / 2 x: (Screen.width - width) / 2
y: (Screen.height - height) / 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 { Item {
id: helper id: helper
property var myColors: {"bglight": "#FAF8EF", property var myColors: {"bglight": "#FAF8EF",

Loading…
Cancel
Save