Add empty QML app

This commit is contained in:
Fabien Freling 2016-03-06 21:33:37 +01:00
parent b4c81fa3f9
commit 161f5681ee
7 changed files with 121 additions and 0 deletions

3
.gitignore vendored
View file

@ -10,3 +10,6 @@ _build
# Game Boy
*.gb
# Qt
*.pro.user

23
qt/MainForm.ui.qml Normal file
View file

@ -0,0 +1,23 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
Item {
property alias button1: button1
property alias button2: button2
RowLayout {
anchors.centerIn: parent
Button {
id: button1
text: qsTr("Open ROM...")
}
Button {
id: button2
text: qsTr("Press Me 2")
}
}
}

13
qt/deployment.pri Normal file
View file

@ -0,0 +1,13 @@
unix:!android {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)

12
qt/main.cpp Normal file
View file

@ -0,0 +1,12 @@
#include <QApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

49
qt/main.qml Normal file
View file

@ -0,0 +1,49 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
ApplicationWindow {
visible: true
width: 256
height: 128
title: qsTr("OBoy")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
Menu {
title: qsTr("View")
MenuItem {
text: qsTr("Background maps")
onTriggered: console.log("Background maps");
}
}
}
MainForm {
anchors.fill: parent
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
}
}

15
qt/oboy.pro Normal file
View file

@ -0,0 +1,15 @@
TEMPLATE = app
QT += qml quick widgets
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)

6
qt/qml.qrc Normal file
View file

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>MainForm.ui.qml</file>
</qresource>
</RCC>