mirror of
https://github.com/thp/pyotherside.git
synced 2025-01-28 23:52:55 +08:00
2a79458c68
Also update examples to use the new feature.
35 lines
830 B
QML
35 lines
830 B
QML
import QtQuick 2.0
|
|
import io.thp.pyotherside 1.0
|
|
|
|
Rectangle {
|
|
width: 400
|
|
height: width
|
|
|
|
Python {
|
|
Component.onCompleted: {
|
|
// Add the directory of this .qml file to the search path
|
|
addImportPath(Qt.resolvedUrl('.'));
|
|
|
|
setHandler('append', function (message, number) {
|
|
output.text += '\n' + message + number;
|
|
});
|
|
|
|
setHandler('color', function(color) {
|
|
output.color = color;
|
|
});
|
|
|
|
// Import the main module
|
|
importModule('events_example', function () {
|
|
console.log('Event example module is now imported');
|
|
});
|
|
}
|
|
|
|
onReceived: console.log('Unhandled event: ' + data)
|
|
}
|
|
|
|
Text {
|
|
id: output
|
|
anchors.centerIn: parent
|
|
}
|
|
}
|