Integrate OCaml in Qt project
This commit is contained in:
parent
3c0c2cff6f
commit
dbc17bb003
8 changed files with 59 additions and 2 deletions
19
src/qt/About.qml
Normal file
19
src/qt/About.qml
Normal file
|
@ -0,0 +1,19 @@
|
|||
import QtQuick 2.4
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
Window {
|
||||
title: "About"
|
||||
// A background map is 32 x 32 tiles.
|
||||
// Each tile is 8 x 8 pixels.
|
||||
width: 128
|
||||
height: 128
|
||||
maximumWidth: width
|
||||
minimumWidth: width
|
||||
maximumHeight: height
|
||||
minimumHeight: height
|
||||
|
||||
Text {
|
||||
id: name
|
||||
text: qsTr("About name")
|
||||
}
|
||||
}
|
|
@ -1,6 +1,14 @@
|
|||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/callback.h>
|
||||
|
||||
void load_caml(char *argv[])
|
||||
{
|
||||
caml_main(argv);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
@ -8,5 +16,7 @@ int main(int argc, char *argv[])
|
|||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
|
||||
load_caml(argv);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,18 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: qsTr("Help")
|
||||
MenuItem {
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
var component = Qt.createComponent("About.qml")
|
||||
var about = component.createObject(root)
|
||||
about.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MainForm {
|
||||
|
|
|
@ -6,6 +6,12 @@ CONFIG += c++11
|
|||
|
||||
SOURCES += main.cpp
|
||||
|
||||
# `ocamlc -where` = /usr/lib/ocaml
|
||||
INCLUDEPATH += /usr/lib/ocaml
|
||||
|
||||
LIBS += -L/home/fabs/Code/oboy/_build/default/src/core -loboy # TODO: fix path to OCaml library
|
||||
LIBS += -L/usr/lib/ocaml -lm -ldl -lasmrun # /usr/lib/ocaml/Makefile.config | grep NATIVECCLIBS
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<file>MainForm.ui.qml</file>
|
||||
<file>BackgroundMap.qml</file>
|
||||
<file>BackgroundMapForm.ui.qml</file>
|
||||
<file>About.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue