From 774fe41da2f9dea4071d46e8dd686ba468e01c64 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 27 Oct 2021 23:11:36 +0200 Subject: [PATCH] Revert "Pass QVariants by reference when possible" This reverts commit c8c193690a442fc8ed33553fa1d12deed55f9ebe. --- declarativeplugin/responsewaiter.cpp | 7 ++++--- declarativeplugin/responsewaiter.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/declarativeplugin/responsewaiter.cpp b/declarativeplugin/responsewaiter.cpp index a03be4e4f..683a05350 100644 --- a/declarativeplugin/responsewaiter.cpp +++ b/declarativeplugin/responsewaiter.cpp @@ -43,7 +43,7 @@ DBusResponseWaiter::DBusResponseWaiter() ; } -QVariant DBusResponseWaiter::waitForReply(const QVariant &variant) const +QVariant DBusResponseWaiter::waitForReply(QVariant variant) const { if (QDBusPendingCall* call = extractPendingCall(variant)) { @@ -74,7 +74,8 @@ DBusAsyncResponse::DBusAsyncResponse(QObject* parent) connect(&m_timeout, &QTimer::timeout, this, &DBusAsyncResponse::onTimeout); } -void DBusAsyncResponse::setPendingCall(const QVariant &variant) + +void DBusAsyncResponse::setPendingCall(QVariant variant) { if (QDBusPendingCall* call = DBusResponseWaiter::instance()->extractPendingCall(variant)) { @@ -123,7 +124,7 @@ void DBusAsyncResponse::onTimeout() Q_EMIT error(QStringLiteral("timeout when waiting dbus response!")); } -QDBusPendingCall* DBusResponseWaiter::extractPendingCall(const QVariant& variant) const +QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const { for (int type : qAsConst(m_registered)) { diff --git a/declarativeplugin/responsewaiter.h b/declarativeplugin/responsewaiter.h index d7cc37758..b25a74685 100644 --- a/declarativeplugin/responsewaiter.h +++ b/declarativeplugin/responsewaiter.h @@ -23,9 +23,9 @@ public: static DBusResponseWaiter* instance(); ///extract QDbusPendingCall from \p variant and blocks until completed - Q_INVOKABLE QVariant waitForReply(const QVariant &variant) const; + Q_INVOKABLE QVariant waitForReply(QVariant variant) const; - QDBusPendingCall* extractPendingCall(const QVariant& variant) const; + QDBusPendingCall* extractPendingCall(QVariant& variant) const; private: DBusResponseWaiter(); @@ -44,7 +44,7 @@ public: explicit DBusAsyncResponse(QObject* parent = nullptr); ~DBusAsyncResponse() override = default; - Q_INVOKABLE void setPendingCall(const QVariant &e); + Q_INVOKABLE void setPendingCall(QVariant e); void setAutodelete(bool b) {m_autodelete = b;}; bool autodelete() const {return m_autodelete;}