Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo Ferrazzo committed Apr 4, 2015
1 parent 5e07c65 commit 99c138e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/pubsub/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);

qmlRegisterType<ZMQSocket>("zmq.Components", 1, 0, "ZMQSocket");
qmlRegisterSingletonType<ByteArrayTools>("zmq.Components", 1, 0, "BATools", byteArrayTools_factory);
qmlRegisterSingletonType<ByteArrayTools>("zmq.Components", 1, 0, "BAT", byteArrayTools_factory);

QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
Expand Down
7 changes: 5 additions & 2 deletions examples/pubsub/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ Window {
id: sender
type: ZMQSocket.Pub
addresses: ["tcp://127.0.0.1:8000"]
method: ZMQSocket.Bind
}

ZMQSocket {
id: receiver
type:ZMQSocket.Sub
addresses: ["tcp://127.0.0.1:8000"]
subscriptions: [""]
method: ZMQSocket.Connect

onMessageReceived: {
console.log(BAT.stringify(message));
Expand All @@ -50,4 +48,9 @@ Window {
text: qsTr("Click to send the zmq message")
anchors.centerIn: parent
}

Component.onCompleted: {
sender.bindSocket();
receiver.connectSocket();
}
}
7 changes: 5 additions & 2 deletions examples/rpc/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ Window {
id: sender
type: ZMQSocket.Pub
addresses: ["tcp://127.0.0.1:8000"]
method: ZMQSocket.Bind
}

ZMQRPCSocket {
id: receiver
type:ZMQSocket.Sub
addresses: ["tcp://127.0.0.1:8000"]
method: ZMQSocket.Connect
subscriptions: [""]

function writeHello(str, num, flo) {
Expand All @@ -50,4 +48,9 @@ Window {
text: qsTr("Click to invoke the remote method")
anchors.centerIn: parent
}

Component.onCompleted: {
sender.bindSocket();
receiver.connectSocket();
}
}

0 comments on commit 99c138e

Please sign in to comment.