-
-
Notifications
You must be signed in to change notification settings - Fork 34
QML plugin
Jean-Michaël Celerier edited this page Jul 4, 2017
·
9 revisions
-
Ensure that libossia finds Qt when building :
cmake ../libossia -DCMAKE_PREFIX_PATH=~/Qt/5.9/gcc_64/lib/cmake/Qt5 -DOSSIA_QT=1
-
make
-
Create a folder
Ossia
in `~/Qt/5.9/gcc_64/qml/ -
Inside, copy (or better, symlink) the whole content of
libossia/OSSIA/ossia-qt/Ossia
as well aslibossia.so
.
import QtQuick 2.5
import Ossia 1.0 as Ossia
Item {
id: root
Ossia.OSCQueryDevice {
id: dev
name: "myDevice"
}
Rectangle {
Ossia.Node { name: "rect" } // /rect is a container
Ossia.Property on x { } // /rect/x is a float node
Ossia.Property on y { } // /rect/y is a float node
}
Ossia.Parameter {
node: "/my/absolute/node"
min: -5
max: 26
value: 12
access: Ossia.Access.Get
bounding: Ossia.Bounding.Wrap
filterRepetitions: Ossia.Repetitions.Filtered
unit: "distance.cm"
description: "length of the bamboozle"
tags: ["foo", "bar"]
priority: 36
refreshRate: 50
stepSize: 20
defaultValue: 7
critical: true
hidden: true
muted: true
onValueChanged: console.log(value)
}
Item {
Ossia.Node { name: "foo" } // /foo
Ossia.Signal {
node: "buzz" // Relative to closest parent; here /foo/buzz
onTriggered: console.log('bang')
}
}
Column {
Ossia.Node { name: "array" }
Repeater {
model: Ossia.Instances { name: "child"; count: 10 }
Rectangle {
Ossia.Node { name: "child." + index }
Ossia.Property on color { } // /array/child.3/color for instance
}
}
}
Component.onCompleted: dev.recreate(root)
}
Example:
import QtQuick 2.5
import Ossia 1.0 as Ossia
Item {
Component.onCompleted: {
// Identify the app
Ossia.Logger.appName = "MyApp";
// Where will the logger send its messages
Ossia.Logger.loggerHost = "ws://127.0.0.1:1337";
// How often the heartbeat will tick, in seconds.
// 0 will disable heartbeat.
Ossia.Logger.heartbeat = 5;
// Allows redirection of Qt / JS messages going through
// console.log / qDebug into websockets.
Ossia.Logger.logQtMessages = true;
Ossia.Logger.startHeartbeat({});
// Manual logging:
// Ossia.Logger.trace("problem: " + 123);
Ossia.Logger.info("problem: " + 123);
// Ossia.Logger.debug("problem: " + 123);
Ossia.Logger.warning("problem: " + 123);
Ossia.Logger.error("problem: " + 123);
// Ossia.Logger.critical("problem: " + 123);
}
}