Skip to content

Instantly share code, notes, and snippets.

@YtvwlD
Created June 14, 2016 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YtvwlD/33504e43fe2c9259230152afdac22d7a to your computer and use it in GitHub Desktop.
Save YtvwlD/33504e43fe2c9259230152afdac22d7a to your computer and use it in GitHub Desktop.
pyotherside crash qqmlengine
unix:!android {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
def test():
return ["Hello World!", 123]
#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();
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import io.thp.pyotherside 1.4
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Python {
Component.onCompleted: {
addImportPath(Qt.resolvedUrl("."));
importModule("lib", function() {
call("lib.test", [], function(result) {
console.log("Result: " + result);
});
});
}
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>lib.py</file>
</qresource>
</RCC>
TEMPLATE = app
QT += qml quick widgets
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment