diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-01-15 14:53:20 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-16 14:21:15 +0100 |
commit | 1b06776be339e1d27de69c74928444917736f8c1 (patch) | |
tree | 381d678f8719ed3d90a0e42d998b9137d7e02823 | |
parent | c5d1360a94123f4ed4da1dab4b0ead754b91e8f7 (diff) | |
download | qtwebchannel-1b06776be339e1d27de69c74928444917736f8c1.tar.gz |
Remove examples written by Noam which are under the Nokia license.
I'll write new examples from scratch using the proper license.
Change-Id: If13e57cf8b19cf45178b6fccace59cb56410d84e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | examples/examples.pro | 6 | ||||
-rw-r--r-- | examples/hybridshell/hybridshell.pro | 17 | ||||
-rw-r--r-- | examples/hybridshell/index.html | 82 | ||||
-rw-r--r-- | examples/hybridshell/main.cpp | 51 | ||||
-rw-r--r-- | examples/hybridshell/main.qml | 83 | ||||
-rw-r--r-- | examples/hybridshell/resources.qrc | 6 | ||||
-rw-r--r-- | examples/hybridshell/shell.cpp | 70 | ||||
-rw-r--r-- | examples/hybridshell/shell.h | 67 | ||||
-rw-r--r-- | examples/qmlapp/index.html | 36 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 97 | ||||
-rw-r--r-- | examples/qtobject/index.html | 89 | ||||
-rw-r--r-- | examples/qtobject/main.cpp | 52 | ||||
-rw-r--r-- | examples/qtobject/main.qml | 78 | ||||
-rw-r--r-- | examples/qtobject/qtobject.pro | 17 | ||||
-rw-r--r-- | examples/qtobject/resources.qrc | 6 | ||||
-rw-r--r-- | examples/qtobject/testobject.cpp | 49 | ||||
-rw-r--r-- | examples/qtobject/testobject.h | 53 |
17 files changed, 0 insertions, 859 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 554ec11..114d0fb 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,9 +1,3 @@ TEMPLATE = subdirs SUBDIRS += standalone - -qtHaveModule(quick) { - SUBDIRS += \ - hybridshell \ - qtobject -} diff --git a/examples/hybridshell/hybridshell.pro b/examples/hybridshell/hybridshell.pro deleted file mode 100644 index 4ff38db..0000000 --- a/examples/hybridshell/hybridshell.pro +++ /dev/null @@ -1,17 +0,0 @@ -QT += qml quick - -CONFIG += warn_on - -SOURCES += \ - main.cpp \ - shell.cpp - -HEADERS += \ - shell.h - -RESOURCES += \ - resources.qrc - -OTHER_FILES += \ - main.qml \ - index.html diff --git a/examples/hybridshell/index.html b/examples/hybridshell/index.html deleted file mode 100644 index 91c447a..0000000 --- a/examples/hybridshell/index.html +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>QML/HTML Hybrid Shell</title> - <style type="text/css"> - html, body { - margin:0; - padding:0; - width:100%; - height:100%; - } - #layout { - height:100%; - width:92%; - margin: 0 auto; - } - #output { - width:100%; - margin-top:1%; - height: 94%; - display: block; - border-radius: 5px; - border-style: solid; - border-color: #666666; - background-image: -webkit-linear-gradient(left top,#dddddd, #ffffff) - } - #input { - width:100%; - height: 3%; - margin-top:1%; - margin-bottom:1%; - display: block; - background-color: #dddddd; - border-radius: 3px; - border-style: solid; - border-color: #dddddd; - background-image: -webkit-linear-gradient(left,#eeeeee, #cccccc) - } - </style> - <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> - <script type="text/javascript"> - function out(line) - { - document.querySelector("#output").value += line + "\r\n"; - } - function send() - { - var input = document.querySelector("#input"); - var text = input.value; - out("> " + text); - input.value = ""; - navigator.webChannel.exec(text); - } - - function handleKey(code) - { - switch (code) { - case 13: - send(); - break; - } - } - - window.onload = function() { - out("Starting..."); - - var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); - new QWebChannel(baseUrl, function(webChannel) { - window.navigator.webChannel = webChannel; - out("Ready"); - webChannel.subscribe("stdout", out); - }, true); - } - </script> - </head> - <body> - <div id="layout"> - <textarea readonly id="output" ></textarea> - <input type="text" id="input" onkeyup="handleKey(event.keyCode)"></input> - </div> - </body> -</html> diff --git a/examples/hybridshell/main.cpp b/examples/hybridshell/main.cpp deleted file mode 100644 index 8c7e9b0..0000000 --- a/examples/hybridshell/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui/QGuiApplication> - -#include <QtQml> -#include <QQuickView> - -#include "shell.h" - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - qmlRegisterType<Shell>("QtWebChannel.Examples", 1, 0, "HybridShell"); - - QQuickView viewer; - viewer.setSource(QStringLiteral("qrc:/main.qml")); - viewer.show(); - - return app.exec(); -} diff --git a/examples/hybridshell/main.qml b/examples/hybridshell/main.qml deleted file mode 100644 index 24dc729..0000000 --- a/examples/hybridshell/main.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -import QtWebChannel 1.0 -import QtWebChannel.Examples 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -Rectangle { - HybridShell { - id: shell - onStdoutData: { - console.log(data); - webChannel.sendMessage("stdout", data); - } - onStderrData: { - console.error(data); - webChannel.sendMessage("stderr", data); - } - } - - WebChannel { - id: webChannel - onRawMessageReceived: { - shell.exec(JSON.parse(rawMessage).data); - } - - onInitialized: { - shell.start() - webView.url = "qrc:/index.html?webChannelBaseUrl=" + webChannel.baseUrl; - } - } - - width: 480 - height: 600 - - WebView { - id: webView - anchors.fill: parent - url: "about:blank" - experimental.preferences.developerExtrasEnabled: true - } -} diff --git a/examples/hybridshell/resources.qrc b/examples/hybridshell/resources.qrc deleted file mode 100644 index b93a6b2..0000000 --- a/examples/hybridshell/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>index.html</file> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/hybridshell/shell.cpp b/examples/hybridshell/shell.cpp deleted file mode 100644 index b15c2e8..0000000 --- a/examples/hybridshell/shell.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "shell.h" -#include <QtDebug> - -Shell::Shell(QObject *parent) : - QObject(parent) -{ - connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(handleOutput())); - connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(handleOutput())); -} - -void Shell::start() -{ - process.start("sh"); -} - -void Shell::exec(const QString& data) -{ - process.write(data.toUtf8()); - process.write("\n"); -} - -void Shell::handleOutput() -{ - QByteArray data = process.readAllStandardOutput(); - if (!data.isEmpty()) - emit stdoutData(data); - data = process.readAllStandardError(); - if (!data.isEmpty()) - emit stderrData(data); -} diff --git a/examples/hybridshell/shell.h b/examples/hybridshell/shell.h deleted file mode 100644 index c2313fc..0000000 --- a/examples/hybridshell/shell.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SHELL_H -#define SHELL_H - -#include <QObject> -#include <QProcess> -class Shell : public QObject -{ - Q_OBJECT -public: - explicit Shell(QObject *parent = 0); - -signals: - void stdoutData(const QString& data); - void stderrData(const QString& data); - -public slots: - void start(); - void exec(const QString& data); - -private slots: - void handleOutput(); - -private: - QProcess process; -}; - -#endif // SHELL_H diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html deleted file mode 100644 index b3b8bb1..0000000 --- a/examples/qmlapp/index.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> - <script type="text/javascript"> - function output(x) - { - document.querySelector("#out").innerHTML += x + "<br/>"; - } - window.onload = function() { - var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); - new QWebChannel(baseUrl, function(c) { - c.subscribe( - "foobar", - function(message) { - output(message); - } - ); - window.send = function() { - c.exec( - {a:"This is a request from HTML"}, - function(response) { - output(response.b); - } - ); - }; - window.send(); - }, true); - }; - </script> - </head> - <body> - <a href="javascript:send()">Go</a> - <div id="out"></div> - </body> -</html> diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml deleted file mode 100644 index 35bce57..0000000 --- a/examples/qmlapp/qmlapp.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -import QtWebChannel 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -Rectangle { - width: 500 - height: 600 - WebChannel { - id: webChannel - - onRawMessageReceived: { - console.log(rawMessage); - var msg = JSON.parse(rawMessage); - editor.text += msg.data.a + "\n"; - sendMessage("b", "This is a response from QML"); - } - - onInitialized: { - console.log(baseUrl); - } - } - - TextEdit { - text: "enter data here\n" - id: editor - anchors.top: parent.top - width: parent.width - height: 400 - } - - Text { - id: txt - anchors.top: editor.bottom - width: parent.width - height: 100 - text: "Click to send message to HTML client" - MouseArea { - anchors.fill: parent - onClicked: { - webChannel.sendMessage("foobar", editor.text); - } - } - } - - WebView { - id: webView - width: parent.width - anchors.top: txt.bottom - height: 100 - url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl; - experimental.preferences.developerExtrasEnabled: true - } - -} diff --git a/examples/qtobject/index.html b/examples/qtobject/index.html deleted file mode 100644 index 4987116..0000000 --- a/examples/qtobject/index.html +++ /dev/null @@ -1,89 +0,0 @@ -<html> - <head> - <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script> - <script type="text/javascript"> - //BEGIN HELPER - function output(x) { - document.querySelector("#out").innerHTML += x + "\n"; - } - function createLink(label, onclick) { - var link = document.createElement("a"); - link.href = "#"; - link.onclick = onclick - link.appendChild(document.createTextNode(label)); - return link; - } - function addObject(object) { - object.timeout.connect(function() { output('timeout of object ' + object.objectName()); }); - object.sig1.connect(function(a, b, c) { - output('sig1 of object ' + object.objectName() + ": a = " + a + ", b = " + b + ", c = " + c); - }); - object.sig2.connect(function() { output('sig2 of object ' + object.objectName()); }); - object.prop1Changed.connect(function() { - // note: notify signal doesn't have the new value, so you must use direct access - output("prop1 of object " + object.objectName() + " changed, direct: " + object.prop1()); - }); - object.prop2Changed.connect(function(newVal) { - output("prop2 of object " + object.objectName() + " changed, new val: " + newVal + ", direct: " + object.prop2()); - }); - object.destroyed.connect(function() { - output("object destroyed " + object.objectName()); - }); - var container = document.getElementById("objects"); - var element = document.createElement("p"); - element.appendChild(document.createTextNode(object.objectName() + ":")); - element.appendChild(createLink("debugMe", function() { - object.debugMe('Debugging!', function(result) { output(result); }); - })); - element.appendChild(createLink("manyArgs", function() { - object.manyArgs(1, 0.5, 'asdf', function(result) { output(result); }); - })); - element.appendChild(createLink("get prop1", function() { - output(object.prop1()); - })); - element.appendChild(createLink("set prop1", function() { - object.prop1 = "Set prop1 on " + (new Date()); - })); - element.appendChild(createLink("get prop2", function() { - output(object.prop2()); - })); - element.appendChild(createLink("set prop2", function() { - object.prop2 = "Set prop2 on " + (new Date()); - })); - element.appendChild(createLink("start timer", function() { - object.startTimer(1000); - })); - element.appendChild(createLink("delete", function() { - object.deleteLater(); - })); - container.appendChild(element); - } - var createdObjects = 0; - function createObject() { - testObjectFactory.createObject("myObj" + (createdObjects++), function(createdObject) { - addObject(createdObject); - }); - } - - //END HELPER - //BEGIN SETUP - var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]); - new QWebChannel(baseUrl, function(channel) { - // do stuff with registered QObjects - addObject(initialTestObject); - }); - //END SETUP - </script> - <style type="text/css"> - #objects a { - margin: 0 10px; - } - </style> - </head> - <body> - <div id="objects"></div> - <br/> - <a href="#" onclick="createObject()">Create New Object</a>. Note: Only created objects can be deleted, the initial object will stay.<br/> - <textarea id="out" style="height:80%; width: 80%"></textarea> - </body> -</html> diff --git a/examples/qtobject/main.cpp b/examples/qtobject/main.cpp deleted file mode 100644 index 4436862..0000000 --- a/examples/qtobject/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui/QGuiApplication> - -#include <QtQml> -#include <QQuickView> - -#include "testobject.h" - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - qmlRegisterType<TestObjectFactory>("QtWebChannel.Examples", 1, 0, "TestObjectFactory"); - qmlRegisterType<TestObject>("QtWebChannel.Examples", 1, 0, "TestObject"); - - QQuickView viewer; - viewer.setSource(QStringLiteral("qrc:/main.qml")); - viewer.show(); - - return app.exec(); -} diff --git a/examples/qtobject/main.qml b/examples/qtobject/main.qml deleted file mode 100644 index d8ec54b..0000000 --- a/examples/qtobject/main.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QWebChannel module on Qt labs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -import QtWebChannel 1.0 -import QtWebChannel.Examples 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -Rectangle { - TestObjectFactory { - id: factory - WebChannel.id: "testObjectFactory" - } - TestObject { - id: testObject - objectName: "initialTestObject" - WebChannel.id: objectName - } - - WebChannel { - id: webChannel - - registeredObjects: [ - factory, - testObject - ]; - } - - width: 480 - height: 800 - - WebView { - id: webView - url: webChannel.baseUrl ? ("qrc:/index.html?webChannelBaseUrl=" + webChannel.baseUrl) : "about:blank"; - anchors.fill: parent - experimental.preferences.developerExtrasEnabled: true - } -} diff --git a/examples/qtobject/qtobject.pro b/examples/qtobject/qtobject.pro deleted file mode 100644 index 557603a..0000000 --- a/examples/qtobject/qtobject.pro +++ /dev/null @@ -1,17 +0,0 @@ -QT += qml quick - -CONFIG += warn_on - -SOURCES += \ - main.cpp \ - testobject.cpp - -HEADERS += \ - testobject.h - -RESOURCES += \ - resources.qrc - -OTHER_FILES += \ - main.qml \ - index.html diff --git a/examples/qtobject/resources.qrc b/examples/qtobject/resources.qrc deleted file mode 100644 index b93a6b2..0000000 --- a/examples/qtobject/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>index.html</file> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/qtobject/testobject.cpp b/examples/qtobject/testobject.cpp deleted file mode 100644 index 9d47e72..0000000 --- a/examples/qtobject/testobject.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "testobject.h" - -TestObject::TestObject(QObject *parent) : - QObject(parent) - , p1("Hello World") -{ - connect(&timer, SIGNAL(timeout()), this, SIGNAL(timeout())); -} - -QString TestObject::debugMe(const QString& data) -{ - qWarning() << data; - return QString("OK from %1: %2").arg(objectName()).arg(data); -} - -void TestObject::setProp1(const QString& s) -{ - p1 = s; - qWarning() << __func__ << p1; - emit sig1(1, 0.5, QStringLiteral("asdf")); - emit prop1Changed(); -} - -void TestObject::setProp2(const QString& s) -{ - p2 = s; - qWarning() << __func__ << p2; - emit sig2(); - emit prop2Changed(s); -} - -QString TestObject::manyArgs(int a, float b, const QString& c) const -{ - qDebug() << a << b << c; - return c; -} - -TestObjectFactory::TestObjectFactory(QObject* parent) - : QObject(parent) -{ - -} - -TestObject* TestObjectFactory::createObject(const QString& name) -{ - TestObject* ret = new TestObject(this); - ret->setObjectName(name); - return ret; -} diff --git a/examples/qtobject/testobject.h b/examples/qtobject/testobject.h deleted file mode 100644 index 72e57bb..0000000 --- a/examples/qtobject/testobject.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef TESTOBJECT_H -#define TESTOBJECT_H - -#include <QObject> -#include <QtDebug> -#include <QTimer> - -class TestObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed) - Q_PROPERTY(QString prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed) -public: - explicit TestObject(QObject *parent = 0); - QString prop1() const { return "p1" + p1 + objectName(); } - void setProp1(const QString& s); - - QString prop2() const { return "p2" + p2 + objectName(); } - void setProp2(const QString& s); - -signals: - void timeout(); - void sig1(int a, float b, const QString& c); - void sig2(); - void prop1Changed(); - void prop2Changed(const QString& newValue); - -public slots: - void startTimer(int millis) - { - timer.start(millis); - } - - QString debugMe(const QString& data); - - QString manyArgs(int a, float b, const QString& c) const; - -private: - QString p1; - QString p2; - QTimer timer; -}; - -class TestObjectFactory : public QObject -{ - Q_OBJECT -public: - explicit TestObjectFactory(QObject* parent = 0); - - Q_INVOKABLE TestObject* createObject(const QString& name); -}; - -#endif // TESTOBJECT_H |