From 473589cd32a298afea438c5d3183e253cfcdb7b8 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 12 Aug 2023 13:36:21 +0200 Subject: [PATCH] Networkpacket: Let Qt generate property setters We don't need to call this explicitly, it is only called by assigning properties --- core/networkpacket.h | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/core/networkpacket.h b/core/networkpacket.h index 0a2c1c011..a3ba709e8 100644 --- a/core/networkpacket.h +++ b/core/networkpacket.h @@ -23,11 +23,11 @@ class FileTransferJob; class KDECONNECTCORE_EXPORT NetworkPacket { Q_GADGET - Q_PROPERTY(QString id READ id WRITE setId) - Q_PROPERTY(QString type READ type WRITE setType) - Q_PROPERTY(QVariantMap body READ body WRITE setBody) - Q_PROPERTY(QVariantMap payloadTransferInfo READ payloadTransferInfo WRITE setPayloadTransferInfo) - Q_PROPERTY(qint64 payloadSize READ payloadSize WRITE setPayloadSize) + Q_PROPERTY(QString id READ id MEMBER m_id) + Q_PROPERTY(QString type READ type MEMBER m_type) + Q_PROPERTY(QVariantMap body READ body MEMBER m_body) + Q_PROPERTY(QVariantMap payloadTransferInfo READ payloadTransferInfo MEMBER m_payloadTransferInfo) + Q_PROPERTY(qint64 payloadSize READ payloadSize MEMBER m_payloadSize) public: const static int s_protocolVersion; @@ -39,19 +39,15 @@ public: QByteArray serialize() const; static bool unserialize(const QByteArray &json, NetworkPacket *out); - const QString &id() const + inline QString id() const { return m_id; } - const QString &type() const + inline QString type() const { return m_type; } - QVariantMap &body() - { - return m_body; - } - const QVariantMap &body() const + QVariantMap body() const { return m_body; } @@ -107,23 +103,6 @@ public: } private: - void setId(const QString &id) - { - m_id = id; - } - void setType(const QString &t) - { - m_type = t; - } - void setBody(const QVariantMap &b) - { - m_body = b; - } - void setPayloadSize(qint64 s) - { - m_payloadSize = s; - } - QString m_id; QString m_type; QVariantMap m_body;