Add empty QML app

master
Fabien Freling 7 years ago
parent b4c81fa3f9
commit 161f5681ee
  1. 3
      .gitignore
  2. 23
      qt/MainForm.ui.qml
  3. 13
      qt/deployment.pri
  4. 12
      qt/main.cpp
  5. 49
      qt/main.qml
  6. 15
      qt/oboy.pro
  7. 6
      qt/qml.qrc

3
.gitignore vendored

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

@ -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")
}
}
}

@ -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)

@ -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();
}

@ -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();
}
}
}

@ -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)

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