summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 \