diff --git a/QtCollider/QcSignalSpy.h b/QtCollider/QcSignalSpy.h
index 3b74216952c..b093933d472 100644
--- a/QtCollider/QcSignalSpy.h
+++ b/QtCollider/QcSignalSpy.h
@@ -91,7 +91,12 @@ class QcSignalSpy : public QObject {
for (int i = 0; i < _argTypes.count(); ++i) {
QMetaType::Type type = static_cast(_argTypes.at(i));
- args << QVariant(type, argData[i + 1]);
+ if (type == QMetaType::QVariant) {
+ // avoid creating a QVariant
+ args << QVariant(type, argData[i + 1]).value();
+ } else {
+ args << QVariant(type, argData[i + 1]);
+ }
}
react(args);
diff --git a/QtCollider/widgets/QcWebView.cpp b/QtCollider/widgets/QcWebView.cpp
index fe4b1b68ae9..1661333c1e9 100644
--- a/QtCollider/widgets/QcWebView.cpp
+++ b/QtCollider/widgets/QcWebView.cpp
@@ -153,8 +153,7 @@ void WebView::toPlainText(QcCallback* cb) const {
void WebView::runJavaScript(const QString& script, QcCallback* cb) {
if (page()) {
if (cb) {
- // convert QVariant to string until we deal with QVariants
- page()->runJavaScript(script, [cb](const QVariant& t) { cb->call(t.toString()); });
+ page()->runJavaScript(script, cb->asFunctor());
} else {
page()->runJavaScript(script, [](const QVariant&) {});
}