summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2024-04-02 13:57:20 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2024-04-04 14:55:27 +0200
commitadac139e17ae5fcabcc786c62b67f05659f7fb76 (patch)
treea4bcd83b5be3f8f583333490a4bec4a831bd4fcd
parent6c1e2179956119f062d311368546cbeb65e2de78 (diff)
Fix the QAbstractGrpcClient::channel signature
Make the methods return shared_ptr, but not const ref. Add the nodiscard and noexcept attributes. Task-number: QTBUG-123625 Change-Id: Icb1f864b38720606dd8a2f81c0181c374122db74 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-rw-r--r--src/grpc/qabstractgrpcclient.cpp4
-rw-r--r--src/grpc/qabstractgrpcclient.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/grpc/qabstractgrpcclient.cpp b/src/grpc/qabstractgrpcclient.cpp
index abb98f1..1d1f168 100644
--- a/src/grpc/qabstractgrpcclient.cpp
+++ b/src/grpc/qabstractgrpcclient.cpp
@@ -207,9 +207,9 @@ std::shared_ptr<QGrpcCallReply> QAbstractGrpcClient::call(QLatin1StringView meth
\since 6.7
Returns the channel attached to this client.
*/
-const std::shared_ptr<QAbstractGrpcChannel> &QAbstractGrpcClient::channel()
+std::shared_ptr<QAbstractGrpcChannel> QAbstractGrpcClient::channel() const noexcept
{
- Q_D(QAbstractGrpcClient);
+ Q_D(const QAbstractGrpcClient);
return d->channel;
}
diff --git a/src/grpc/qabstractgrpcclient.h b/src/grpc/qabstractgrpcclient.h
index 9e2ba78..0325037 100644
--- a/src/grpc/qabstractgrpcclient.h
+++ b/src/grpc/qabstractgrpcclient.h
@@ -31,7 +31,7 @@ class Q_GRPC_EXPORT QAbstractGrpcClient : public QObject
WRITE attachChannel NOTIFY channelChanged)
public:
void attachChannel(const std::shared_ptr<QAbstractGrpcChannel> &channel);
- const std::shared_ptr<QAbstractGrpcChannel> &channel();
+ [[nodiscard]] std::shared_ptr<QAbstractGrpcChannel> channel() const noexcept;
~QAbstractGrpcClient() override;
Q_SIGNALS: