summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-12-28 19:20:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-08 15:59:28 +0100
commit66c0d916131c1e9e896705971f20385c75e753a2 (patch)
tree59b25cd7b9bc1ff688ff46c2b4f4c21fa60019cf /examples
parent318576f0cc0ebef78c5b27106b1a8429eb54fac8 (diff)
downloadqtwebchannel-66c0d916131c1e9e896705971f20385c75e753a2.tar.gz
Simplify usage of QWebChannel on the server side.
This is achieved by hiding the MetaObjectPublisher completely as private API. The QWebChannel is the only publisher API and now handles both the socket as well as the publisher internally. This now allows us to create a proper QML api in the new QmlWebChannel. Change-Id: I3096364af8485353ca9bc19df4a81a8e4552c3d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qtobject/main.qml13
-rw-r--r--examples/standalone/main.cpp9
2 files changed, 2 insertions, 20 deletions
diff --git a/examples/qtobject/main.qml b/examples/qtobject/main.qml
index 76ef3d9..7bfe714 100644
--- a/examples/qtobject/main.qml
+++ b/examples/qtobject/main.qml
@@ -55,22 +55,11 @@ Rectangle {
objectName: "initialTestObject"
}
- MetaObjectPublisher {
- id: publisher
- webChannel: webChannel
- }
-
WebChannel {
id: webChannel
- onRawMessageReceived: {
- if (!publisher.handleRawMessage(rawMessage)) {
- console.log("unhandled request: ", rawMessage);
- }
- }
-
onInitialized: {
- publisher.registerObjects({
+ registerObjects({
"testObjectFactory": factory,
"initialTestObject": testObject
});
diff --git a/examples/standalone/main.cpp b/examples/standalone/main.cpp
index 6970633..1187950 100644
--- a/examples/standalone/main.cpp
+++ b/examples/standalone/main.cpp
@@ -41,7 +41,6 @@
****************************************************************************/
#include "qwebchannel.h"
-#include "qmetaobjectpublisher.h"
#include <QApplication>
#include <QDialog>
@@ -111,16 +110,10 @@ int main(int argc, char** argv)
QApplication app(argc, argv);
QWebChannel channel;
- QMetaObjectPublisher publisher;
- publisher.setWebChannel(&channel);
- QObject::connect(&channel, SIGNAL(rawMessageReceived(QString)),
- &publisher, SLOT(handleRawMessage(QString)));
Dialog dialog(&channel);
- QVariantMap objects;
- objects[QStringLiteral("dialog")] = QVariant::fromValue(&dialog);
- publisher.registerObjects(objects);
+ channel.registerObject(QStringLiteral("dialog"), &dialog);
return app.exec();
}