summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-20 19:17:32 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-20 19:17:32 +0200
commite50edc952ce15f3c11f4cdfad74ec984043cb080 (patch)
tree060893ceb61fa700053b61db8f0d8ebed462e1c3 /src
parenta7c39b36c157e08fdbca6edc97950cd08d682024 (diff)
parent86d77a900852691267f556fbde98406a12ee4310 (diff)
downloadqtwebchannel-e50edc952ce15f3c11f4cdfad74ec984043cb080.tar.gz
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: examples/webchannel/webchannel.pro Change-Id: Ia768202d177a24ae90358b5d88621a5fa88f9002
Diffstat (limited to 'src')
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp23
-rw-r--r--src/webchannel/qwebchannel.js3
-rw-r--r--src/webchannel/webchannel.pro1
3 files changed, 6 insertions, 21 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index 1271fda..eeab014 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -43,11 +43,6 @@
#include <QJsonArray>
#include <QUuid>
-#if HAVE_QML
-#include <QtQml/QJSValue>
-#include <QtQml/QJSEngine>
-#endif
-
QT_BEGIN_NAMESPACE
namespace {
@@ -194,7 +189,9 @@ QJsonObject QMetaObjectPublisher::classInfoForObject(const QObject *object) cons
data[KEY_SIGNALS] = qtSignals;
data[KEY_METHODS] = qtMethods;
data[KEY_PROPERTIES] = qtProperties;
- data[KEY_ENUMS] = qtEnums;
+ if (!qtEnums.isEmpty()) {
+ data[KEY_ENUMS] = qtEnums;
+ }
return data;
}
@@ -380,19 +377,7 @@ void QMetaObjectPublisher::signalEmitted(const QObject *object, const int signal
message[KEY_SIGNAL] = signalIndex;
if (!arguments.isEmpty()) {
// TODO: wrap (new) objects on the fly
- QJsonArray args;
-#if HAVE_QML
- foreach (const QVariant &arg, arguments) {
- if (arg.canConvert<QJSValue>()) {
- const QJSValue &jsValue = arg.value<QJSValue>();
- args.append(qjsvalue_cast<QJsonValue>(jsValue));
- } else {
- args.append(QJsonValue::fromVariant(arg));
- }
- }
-#else
- args = QJsonArray::fromVariantList(arguments);
-#endif
+ QJsonArray args = QJsonArray::fromVariantList(arguments);
message[KEY_ARGS] = args;
}
message[KEY_TYPE] = TypeSignal;
diff --git a/src/webchannel/qwebchannel.js b/src/webchannel/qwebchannel.js
index 3feb829..d2c6525 100644
--- a/src/webchannel/qwebchannel.js
+++ b/src/webchannel/qwebchannel.js
@@ -236,8 +236,9 @@ function QObject(name, data, webChannel)
object.__objectSignals__[signalIndex] = object.__objectSignals__[signalIndex] || [];
object.__objectSignals__[signalIndex].push(callback);
- if (!isPropertyNotifySignal) {
+ if (!isPropertyNotifySignal && signalName !== "destroyed") {
// only required for "pure" signals, handled separately for properties in propertyUpdate
+ // also note that we always get notified about the destroyed signal
webChannel.exec({
type: QWebChannelMessageTypes.connectToSignal,
object: object.__id__,
diff --git a/src/webchannel/webchannel.pro b/src/webchannel/webchannel.pro
index 024956e..eba8123 100644
--- a/src/webchannel/webchannel.pro
+++ b/src/webchannel/webchannel.pro
@@ -29,7 +29,6 @@ SOURCES += \
qtHaveModule(qml) {
QT += qml
- DEFINES += HAVE_QML=1
SOURCES += \
qqmlwebchannel.cpp \