summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/qtobject/qml/qtobject/main.qml1
-rw-r--r--examples/qtobject/testobject.cpp2
-rw-r--r--examples/qtobject/testobject.h6
3 files changed, 7 insertions, 2 deletions
diff --git a/examples/qtobject/qml/qtobject/main.qml b/examples/qtobject/qml/qtobject/main.qml
index 7a63cd2..d00c9ac 100644
--- a/examples/qtobject/qml/qtobject/main.qml
+++ b/examples/qtobject/qml/qtobject/main.qml
@@ -49,6 +49,7 @@ import QtWebKit.experimental 1.0
Rectangle {
MetaObjectPublisher {
id: publisher
+ webChannel: webChannel
}
TestObject {
diff --git a/examples/qtobject/testobject.cpp b/examples/qtobject/testobject.cpp
index 4bcd92f..e18dbc0 100644
--- a/examples/qtobject/testobject.cpp
+++ b/examples/qtobject/testobject.cpp
@@ -18,6 +18,7 @@ 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)
@@ -25,6 +26,7 @@ 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
diff --git a/examples/qtobject/testobject.h b/examples/qtobject/testobject.h
index 39dc608..f3f1c03 100644
--- a/examples/qtobject/testobject.h
+++ b/examples/qtobject/testobject.h
@@ -7,8 +7,8 @@
class TestObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(QString prop1 READ prop1 WRITE setProp1)
- Q_PROPERTY(QString prop2 READ prop2 WRITE setProp2)
+ 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(); }
@@ -21,6 +21,8 @@ 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)